2009/8/1 karthik k <cse.k.kart...@gmail.com>: > Hi colin > > On small help > > below is the code or checking for uniquness > > def test_check_for_uniqueness_name > post=County.new(:name=>"mynamed",:description=>"mydesc",:region_id=>"3") > assert post.valid?, "post was not valid #{post.errors.inspect}" > > post1=County.new(:name=>"sample",:description=>"mydesc",:region_id=>"4") > assert post1.valid?, post1.errors.full_messages > assert_not_nil post1.errors.on(:name) > end > > when i run unit testing > > 1) Failure: > test_check_for_uniqueness_name(CountyTest) [test/unit/county_test.rb:26]: > <nil> expected to not be nil. >
You have said in the test that you expect post1.errors.on(:name) not to be nil, but the test fails because it is in fact nil. Why did you expect it not to be nil? Colin --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---