spec/mongoid/fields/internal/foreign_keys/object_spec.rb in mongoid-3.1.7 vs spec/mongoid/fields/internal/foreign_keys/object_spec.rb in mongoid-4.0.0.alpha1
- old
+ new
@@ -13,11 +13,11 @@
# identity: true
# )
# end
# it "returns true" do
- # field.should be_foreign_key
+ # expect(field).to be_foreign_key
# end
# end
# describe "#serialize" do
@@ -42,81 +42,81 @@
# end
# context "when using object ids" do
# let(:object_id) do
- # Moped::BSON::ObjectId.new
+ # BSON::ObjectId.new
# end
# it "performs conversion on the ids if strings" do
- # field.serialize(object_id.to_s).should eq(object_id)
+ # expect(field.serialize(object_id.to_s)).to eq(object_id)
# end
# end
# context "when not using object ids" do
# context "when using strings" do
# context "when provided a string" do
# let(:object_id) do
- # Moped::BSON::ObjectId.new
+ # BSON::ObjectId.new
# end
# before do
# Person.field(
# :_id,
# type: String,
# pre_processed: true,
- # default: ->{ Moped::BSON::ObjectId.new.to_s }
+ # 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 }
+ # default: ->{ BSON::ObjectId.new }
# )
# end
# it "does not convert" do
- # field.serialize(object_id.to_s).should eq(object_id.to_s)
+ # expect(field.serialize(object_id.to_s)).to eq(object_id.to_s)
# end
# end
# context "when provided a hash" do
# let(:object_id) do
- # Moped::BSON::ObjectId.new
+ # BSON::ObjectId.new
# end
# before do
# Person.field(
# :_id,
# type: String,
# pre_processed: true,
- # default: ->{ Moped::BSON::ObjectId.new.to_s }
+ # 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 }
+ # default: ->{ BSON::ObjectId.new }
# )
# end
# let(:criterion) do
# { "$in" => [ object_id.to_s ] }
# end
# it "does not convert" do
- # field.serialize(criterion).should eq(
+ # expect(field.serialize(criterion)).to eq(
# criterion
# )
# end
# end
# end
@@ -130,18 +130,18 @@
# end
# after do
# Person.field(
# :_id,
- # type: Moped::BSON::ObjectId,
+ # type: BSON::ObjectId,
# pre_processed: true,
- # default: ->{ Moped::BSON::ObjectId.new }
+ # default: ->{ BSON::ObjectId.new }
# )
# end
# it "does not convert" do
- # field.serialize("1").should eq(1)
+ # expect(field.serialize("1")).to eq(1)
# end
# end
# context "when provided a hash with a string value" do
@@ -150,22 +150,22 @@
# end
# after do
# Person.field(
# :_id,
- # type: Moped::BSON::ObjectId,
+ # type: BSON::ObjectId,
# pre_processed: true,
- # default: ->{ Moped::BSON::ObjectId.new }
+ # default: ->{ BSON::ObjectId.new }
# )
# end
# let(:criterion) do
# { "$eq" => "1" }
# end
# it "does not convert" do
- # field.serialize(criterion).should eq(
+ # expect(field.serialize(criterion)).to eq(
# { "$eq" => 1 }
# )
# end
# end
@@ -176,21 +176,21 @@
# end
# after do
# Person.field(
# :_id,
- # type: Moped::BSON::ObjectId,
+ # type: BSON::ObjectId,
# pre_processed: true,
- # default: ->{ Moped::BSON::ObjectId.new }
+ # default: ->{ BSON::ObjectId.new }
# )
# end
# let(:criterion) do
# { "$in" => [ "1" ] }
# end
# it "does not convert" do
- # field.serialize(criterion).should eq(
+ # expect(field.serialize(criterion)).to eq(
# { "$in" => [ 1 ] }
# )
# end
# end
# end