-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
None
This pull requests makes Mongoid::IdentityMap.get(Person, person.id.to_s) equivalent to Mongoid::IdentityMap.get(Person, person.id).
The motivation behind this pull request was that in upgrading to Mongoid 3, not having this broke some of my controller tests that had expectations on an object. Here's a trivial example.
# Say there's some method we want to ensure gets called when it is edited person = FlightPassenger.create person.should_receive(:check_name_against_terrorist_database) post(:edit, {:flight_passenger => {:id => person.id, :first_name => "Jon"}, :format => :json}
In the controller action, the id would come through as a String. Because the IdentityMap would not be used, the object returned in the action would not have the same memory address as person, so the mock expectation would fail.