spec/mongoid/serializable_spec.rb in mongoid-9.0.1 vs spec/mongoid/serializable_spec.rb in mongoid-9.0.2
- old
+ new
@@ -509,34 +509,38 @@
let(:hash) do
person.serializable_hash(include: :addresses)
end
it "includes the first relation" do
- expect(relation_hash[0]).to include
+ expect(relation_hash[0]).to include(
{ "_id" => "kudamm", "street" => "Kudamm" }
+ )
end
it "includes the second relation" do
- expect(relation_hash[1]).to include
+ expect(relation_hash[1]).to include(
{ "_id" => "tauentzienstr", "street" => "Tauentzienstr" }
+ )
end
end
context "when providing the include as an array" do
let(:hash) do
person.serializable_hash(include: [ :addresses ])
end
it "includes the first relation" do
- expect(relation_hash[0]).to include
+ expect(relation_hash[0]).to include(
{ "_id" => "kudamm", "street" => "Kudamm" }
+ )
end
it "includes the second relation" do
- expect(relation_hash[1]).to include
+ expect(relation_hash[1]).to include(
{ "_id" => "tauentzienstr", "street" => "Tauentzienstr" }
+ )
end
end
context "when providing the include as a hash" do
@@ -651,35 +655,38 @@
let(:hash) do
person.serializable_hash(include: :name)
end
it "includes the specified relation" do
- expect(relation_hash).to include
- { "_id" => "leo-marvin", "first_name" => "Leo", "last_name" => "Marvin" }
+ expect(relation_hash).to include(
+ { "_id" => "Leo-Marvin", "first_name" => "Leo", "last_name" => "Marvin" }
+ )
end
end
context "when providing the include as an array" do
let(:hash) do
person.serializable_hash(include: [ :name ])
end
it "includes the specified relation" do
- expect(relation_hash).to include
- { "_id" => "leo-marvin", "first_name" => "Leo", "last_name" => "Marvin" }
+ expect(relation_hash).to include(
+ { "_id" => "Leo-Marvin", "first_name" => "Leo", "last_name" => "Marvin" }
+ )
end
end
context "when providing the include as a hash" do
let(:hash) do
person.serializable_hash(include: { name: { except: :_id }})
end
it "includes the specified relation sans exceptions" do
- expect(relation_hash).to include
+ expect(relation_hash).to include(
{ "first_name" => "Leo", "last_name" => "Marvin" }
+ )
end
end
end
context "when including a references many" do