Hello Guy wrote:

> edit: when i type for line 3 "assert !sp.save" there is no failure, but
> then
> the test is not right, or?

All test cases follow some variation this pattern:

   assemble - put together the objects you need
   activate - the "money line" - the one that calls production code to test
   assert   - check the money line did the right thing.

Your test has two money lines, but that's not the actual problem.

The problem is assert() sucks, and does not tell you what's wrong.

To test "did my object save correctly?", always use this:

   sp.save!  #  with the bang !

never this:

   assert sp.save

The reason is the first one will tell you what is going wrong. Maybe your new() 
arguments do not satisfy one of your validations.

-- 
   Phlip


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to