Displaying 2 results from an estimated 2 matches for "assert_no_difference".
2008 May 13
0
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_au...
2007 Aug 18
0
RSpec and acts_as_attachment
...It''s a model that is using acts_as_attachment but the
weird thing is the equivalent Test::Unit case passes. Does anyone
have any ideas?
Best,
Dave
# it was a Test::Unit case first
def test_should_be_invalid_without_file
UserFile.any_instance.expects(:with_image).never
assert_no_difference UserFile, :count do
user_file = create_user_file :uploaded_data => nil
assert user_file.errors.on(:filename)
assert user_file.errors.on(:size)
assert user_file.errors.on(:content_type)
end
end
# Converting the above to the following spec
it ''shou...