spec/mongoid/reloadable_spec.rb in mongoid-5.1.0 vs spec/mongoid/reloadable_spec.rb in mongoid-5.1.1
- old
+ new
@@ -282,7 +282,22 @@
it "reload should return self" do
expect(object.reload).to eq(from_db)
end
end
+
+ context 'when the document is readonly' do
+
+ before do
+ Person.create
+ end
+
+ let(:reloaded) do
+ Person.only(:name).first.reload
+ end
+
+ it 'resets the readonly state after reloading' do
+ expect(reloaded.readonly?).to be(false)
+ end
+ end
end
end