spec/functional/document_spec.rb in mongo_mapper-0.14.0 vs spec/functional/document_spec.rb in mongo_mapper-0.15.0
- old
+ new
@@ -238,12 +238,12 @@
@instance.reload
@instance.age.should == 39
end
it "should reset many associations" do
- expect(@instance.foos).to receive(:reset).at_least(1).times
- expect(@instance.bars).to receive(:reset).at_least(1).times
+ @instance.foos.should_receive(:reset).at_least(1).times
+ @instance.bars.should_receive(:reset).at_least(1).times
@instance.reload
end
it "should reset belongs_to association" do
@instance.foo = nil
@@ -269,11 +269,11 @@
@instance.reload.object_id.should == @instance.object_id
end
it "should raise DocumentNotFound if not found" do
@instance.destroy
- expect { @instance.reload }.to raise_error(MongoMapper::DocumentNotFound)
+ lambda { @instance.reload }.should raise_error(MongoMapper::DocumentNotFound)
end
it "should clear keys that were removed from the database" do
@instance.unset(:age)
@instance.reload.age.should be_nil
@@ -281,11 +281,11 @@
end
context "database has keys not defined in model" do
before do
@id = BSON::ObjectId.new
- @document.collection.insert({
+ @document.collection.insert_one({
:_id => @id,
:first_name => 'John',
:last_name => 'Nunemaker',
:age => 27,
:favorite_color => 'red',
@@ -302,9 +302,9 @@
doc.skills.should == ['ruby', 'rails', 'javascript', 'xhtml', 'css']
end
end
it "should not walk ObjectSpace when creating a model" do
- expect(ObjectSpace).to receive(:each_object).never
+ ObjectSpace.should_receive(:each_object).never
Doc()
end
end