Created
July 9, 2010 21:48
-
-
Save mrrooijen/470114 to your computer and use it in GitHub Desktop.
Stub Paperclip Attachment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# With regular RSpec stubbing | |
it 'should allow JPG images' do | |
photo = Photo.new :photo => fixture_file_upload('photos/chameleon.jpg', 'image/jpeg') | |
photo.stub!(:save_attached_files).and_return true | |
photo.save.should be_true | |
end | |
## | |
# With Mocha on "any" instance of a Class | |
Picture.any_instance.stubs(:save_attached_files).returns(true) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment