Created
January 28, 2010 16:13
-
-
Save emk/288876 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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