assert_no_difference question

1 view
Skip to first unread message

sullivan.t

unread,
May 13, 2008, 11:20:37 AM5/13/08
to Ruby on Rails: Talk
I have the following test code:

assert_no_difference Avatar, :count do
a = create_avatar(:description => nil)
assert a.errors.on(:description)
end

further down, create_avatar looks like:

def create_avatar(options = {})
Avatar.create(:description => "Foo Descr.").merge(options)
end

(Borrowed from the user test in acts_as_auth...)

It seems to pass, as my avatar model has:

validates_presence_of :description written.

However, if say I try to force it to fail with assert_difference... it
still passes.

What did I miss?
Reply all
Reply to author
Forward
0 new messages