As Fred mentioned earlier, you need to set family_rate to
something valid, which accdg to your model validation should
be a number greater than or equal to 0.01.

Otherwise the last assert fee.valid? will return false.  You may
have set a valid per_person_rate, but since family_rate is nil,
the object will not be valid.

So looking at your test again, you can do this:

 def test_positive_perpersonrate
   fee=Fee.new(:family_rate => 1.0)   #provide a valid value for family_rate

   fee.per_person_rate = -1.0
   assert !fee.valid?
   assert_equal "should be greater than 0", fee.errors.on(:per_person_rate)

   fee.per_person_rate = 0.0
   assert !fee.valid?
   assert_equal "should be greater than 0", fee.errors.on(:per_person_rate)

   fee.per_person_rate = 1.0
   assert fee.valid?
 end


Hope this helps.

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to