On 20 November 2010 12:28, Neil Bye <[email protected]> wrote:
>>> class AnnnetteTest < ActiveSupport::TestCase
>>> def test_should_not_be_valid_without_story
>>> a = Annnette.create(:story => 'Neil')
>>> assert a.errors.on(:story)
>>
> So I change line 6 to
>
> a = Annnette.create(:story => nil)
>
> and I still get
>
> 1) Failure:
> <nil> is not true.

You should possibly not be using .create as that does a save at that
point. The save will fail (because there's no story) and "a" won't be
assigned anything.

instead, try:
a = Annnette.new(:story => nil)

Or load a valid Annnette from your fixtures (or factories), set the
story to nil, and check the errors.

-- 
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 [email protected].
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