Skip to content

Commit

Permalink
Merge 64e6d3c into 7acfcc6
Browse files Browse the repository at this point in the history
  • Loading branch information
Frank Macreery committed Sep 20, 2013
2 parents 7acfcc6 + 64e6d3c commit cd5db35
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions spec/integration/mongoid_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,36 @@
end
end
end

context "with non-unique identities" do
before(:each) do
Garner.configure do |config|
config.mongoid_identity_fields = [:_id, :_slugs]
end

class Other
include Mongoid::Document
include Mongoid::Slug

field :name, :type => String
slug :name
end
end

it "honors objects that take another object's identity" do
one = Other.create!({ :name => "foo" })
garnered_one = Other.garnered_find("foo")
garnered_one.should == one

one.update_attributes!({ :name => "bar" })

two = Other.create!({ :name => "foo" })
garnered_one = Other.garnered_find("bar")
garnered_two = Other.garnered_find("foo")
garnered_one.should == one
garnered_two.should == two
end
end
end

context "binding at the class level" do
Expand Down

0 comments on commit cd5db35

Please sign in to comment.