spec/mongoid/relations/conversions_spec.rb in mongoid-3.1.7 vs spec/mongoid/relations/conversions_spec.rb in mongoid-4.0.0.alpha1
- old
+ new
@@ -9,77 +9,79 @@
let(:metadata) do
Person.relations["game"]
end
let(:object) do
- Moped::BSON::ObjectId.new
+ BSON::ObjectId.new
end
let(:flagged) do
described_class.flag(object, metadata)
end
it "returns the object" do
- flagged.should eq(object)
+ expect(flagged).to eq(object)
end
end
context "when the inverse uses string ids" do
before do
Person.field(
:_id,
type: String,
pre_processed: true,
- default: ->{ Moped::BSON::ObjectId.new.to_s }
+ overwrite: true,
+ default: ->{ BSON::ObjectId.new.to_s }
)
end
after do
Person.field(
:_id,
- type: Moped::BSON::ObjectId,
+ type: BSON::ObjectId,
pre_processed: true,
- default: ->{ Moped::BSON::ObjectId.new }
+ overwrite: true,
+ default: ->{ BSON::ObjectId.new }
)
end
let(:metadata) do
Person.relations["game"]
end
context "when provided an object id" do
let(:object) do
- Moped::BSON::ObjectId.new
+ BSON::ObjectId.new
end
let(:flagged) do
described_class.flag(object, metadata)
end
it "returns the object id" do
- flagged.should eq(object)
+ expect(flagged).to eq(object)
end
end
context "when provided a string" do
let(:object) do
- Moped::BSON::ObjectId.new.to_s
+ BSON::ObjectId.new.to_s
end
let(:flagged) do
described_class.flag(object, metadata)
end
it "returns the string" do
- flagged.should eq(object)
+ expect(flagged).to eq(object)
end
it "marks the string as unconvertable" do
- flagged.should be_unconvertable_to_bson
+ expect(flagged).to be_unconvertable_to_bson
end
end
end
context "when the inverse uses integer ids" do
@@ -89,19 +91,19 @@
end
context "when provided an object id" do
let(:object) do
- Moped::BSON::ObjectId.new
+ BSON::ObjectId.new
end
let(:flagged) do
described_class.flag(object, metadata)
end
it "returns the object id" do
- flagged.should eq(object)
+ expect(flagged).to eq(object)
end
end
context "when provided an integer" do
@@ -112,14 +114,14 @@
let(:flagged) do
described_class.flag(object, metadata)
end
it "returns the integer" do
- flagged.should eq(15)
+ expect(flagged).to eq(15)
end
it "marks the integer as unconvertable" do
- flagged.should be_unconvertable_to_bson
+ expect(flagged).to be_unconvertable_to_bson
end
end
end
end
end