-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
Hi,
I create an embedded document and change the attributes, so that the default scope doesn't match any more. Then the test without reloading fails. The same works the other way round, too.
I found this issue while looking through the sample code from apneadiving for MONGOID-1918.
require 'spec_helper' describe "default scoping on embedded documents" do let(:person) do Person.create end before do person.appointments.create end context "when changing the default scope attribute" do before do a = person.appointments.first a.active = false a.save end context "when reloading" do it "hides the document" do person.reload.appointments.should eq([]) # PASS end end context "when not reloading" do it "hides the document" do person.appointments.should eq([]) # FAIL end end end end
I already looked at the code, but couldn't find the place to fix this issue.