Assert_no_difference question

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?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs