Displaying 1 result from an estimated 1 matches for "test_new_service".
2006 Feb 10
1
Bizarre ActiveRecord::Errors/validation problem
...e, :string, :ilmit => 5, :null => false
t.column :port, :integer, :null => false
t.column :status, :string
end
The model:
class Service < ActiveRecord::Base
validates_presence_of :name, :port, :status
end
The unit tests:
class ServiceTest < Test::Unit::TestCase
def test_new_service
@service = Service.new
@service.name = ''www''
@service.port = 80
@service.status = ''Unknown''
assert @service.save
end
def test_invalid_service
@service = Service.new
assert !@service.save
asser...