Skip to content

Instantly share code, notes, and snippets.

@emk
Created January 28, 2010 16:13
Show Gist options
  • Save emk/288876 to your computer and use it in GitHub Desktop.
Save emk/288876 to your computer and use it in GitHub Desktop.
require File.join(File.dirname(__FILE__), '..', 'spec_helper')
class Workgroup
include MongoMapper::Document
many :people
end
class Person
include MongoMapper::Document
belongs_to :workgroup
end
describe MongoMapper do
it "should not delete unowned objects when updating 'many' association" do
Person.create
Person.create
Person.count.should == 2
Workgroup.create(:people => [])
# Person.count will currently equal 0, because our unassigned people
# have been deleted. This is not good.
Person.count.should == 2
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment