require "spec_helper"
class Exhibitor
include Mongoid::Document
has_and_belongs_to_many :artworks
end
class Artwork
include Mongoid::Document
has_and_belongs_to_many :exhibitors
end
describe "Test" do
before do
[ Exhibitor, Artwork ].each(&:delete_all)
end
describe "works" do
it "sometimes" do
exhibitor = Exhibitor.create!
artwork = Artwork.create!
exhibitor.artworks = [ artwork ]
exhibitor.save!
exhibitor.artworks.count.should == 1
exhibitor = Exhibitor.find(exhibitor.id)
exhibitor.artworks.count.should == 1
exhibitor.artworks = [] exhibitor.save!
Exhibitor.find(exhibitor.id).artworks.count.should == 0 end
end
end