spec/mongoid/changeable_spec.rb in mongoid-7.1.0.rc0 vs spec/mongoid/changeable_spec.rb in mongoid-7.1.0
- old
+ new
@@ -947,9 +947,32 @@
[ nil, "Captain Obvious" ]
)
end
end
+ context 'when habtm association changes' do
+
+ let(:person) do
+ Person.create!(title: "Grand Poobah")
+ end
+
+ let(:user_account) do
+ UserAccount.create!
+ end
+
+ before do
+ person.user_accounts << user_account
+ end
+
+ it 'returns a hash of changes' do
+ pending 'https://jira.mongodb.org/browse/MONGOID-4843'
+
+ person.changes.should == {
+ user_account_ids: [[], [user_account.id]]
+ }
+ end
+ end
+
context "when the document has not changed" do
let(:acolyte) do
Acolyte.instantiate("_id" => BSON::ObjectId.new)
end