Skip to content

Instantly share code, notes, and snippets.

@mrrooijen
Created July 9, 2010 21:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrrooijen/470114 to your computer and use it in GitHub Desktop.
Save mrrooijen/470114 to your computer and use it in GitHub Desktop.
Stub Paperclip Attachment
##
# 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