spec/mongoid/serializable_spec.rb in mongoid-7.3.5 vs spec/mongoid/serializable_spec.rb in mongoid-7.4.0
- old
+ new
@@ -1,7 +1,6 @@
# frozen_string_literal: true
-# encoding: utf-8
require "spec_helper"
describe Mongoid::Serializable do
@@ -339,11 +338,11 @@
end
end
context "when only two attributes are loaded" do
before do
- person.save
+ person.save!
end
let(:from_db) do
Person.only("_id", "username").first
end
@@ -406,21 +405,21 @@
end
context "when the model is saved before the relation is added" do
before do
- person.save
+ person.save!
end
context "when a model has an embeds many" do
let!(:address_one) do
person.addresses.build(street: "Kudamm")
end
before do
- person.save
+ person.save!
end
it "includes the relation" do
expect(person.serializable_hash.keys).to include('addresses')
end
@@ -430,11 +429,11 @@
let!(:name) do
person.build_name(first_name: "Leo", last_name: "Marvin")
end
before do
- person.save
+ person.save!
end
it "includes the relation" do
expect(person.serializable_hash.keys).to include('name')
end
@@ -448,11 +447,11 @@
let!(:address_one) do
person.addresses.build(street: "Kudamm")
end
before do
- person.save
+ person.save!
end
it "includes the relation" do
expect(person.serializable_hash.keys).to include('addresses')
end
@@ -462,11 +461,11 @@
let!(:name) do
person.build_name(first_name: "Leo", last_name: "Marvin")
end
before do
- person.save
+ person.save!
end
it "includes the relation" do
expect(person.serializable_hash.keys).to include('name')
end
@@ -502,11 +501,11 @@
end
context "when the ids were not loaded" do
before do
- person.save
+ person.save!
end
let(:from_db) do
Person.only("addresses.street").first
end
@@ -610,13 +609,13 @@
}
})
end
before do
- person.save
+ person.save!
end
- it "includes the specific ralations" do
+ it "includes the specific relations" do
expect(relation_hash[0]["locations"].map do |location|
location["name"]
end).to include "Home"
expect(relation_hash[1]["locations"].map do |location|
location["name"]