Skip to content

Instantly share code, notes, and snippets.

@freegenie
Created August 14, 2010 20:53
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 freegenie/524705 to your computer and use it in GitHub Desktop.
Save freegenie/524705 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'mongo_mapper'
require 'joint'
require 'shoulda'
MongoMapper.database = 'joint_exif_test'
class Photo
include MongoMapper::Document
plugin Joint
attachment :image
end
class TestJointExif < Test::Unit::TestCase
context 'given an image' do
setup do
MongoMapper.database.collections.each(&:remove)
file = File.open('/Users/fabrizioregini/Desktop/bikes.jpg', 'r')
@photo = Photo.create( :image => file )
end
subject { @photo }
should 'remove attachment' do
subject.image = nil
subject.save
assert subject.image? == false # This line fails
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment