spec/mongoid/association/depending_spec.rb in mongoid-7.3.5 vs spec/mongoid/association/depending_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::Association::Depending do
@@ -379,24 +378,24 @@
end
context "when strategy is delete" do
let(:parent) do
- Person.create
+ Person.create!
end
let!(:child) do
- parent.posts.create(title: "Testing")
+ parent.posts.create!(title: "Testing")
end
include_examples 'destroys dependents if parent is destroyed but does not if parent is deleted'
end
context "when strategy is destroy" do
let(:parent) do
- Person.create
+ Person.create!
end
let!(:child) do
parent.create_game(name: "Pong")
end
@@ -429,15 +428,15 @@
end
context "when nullifying a references many" do
let(:parent) do
- Movie.create(title: "Bladerunner")
+ Movie.create!(title: "Bladerunner")
end
let!(:rating) do
- parent.ratings.create(value: 10)
+ parent.ratings.create!(value: 10)
end
let(:from_db) do
Rating.find(rating.id)
end
@@ -448,11 +447,11 @@
context "when nullifying a references one" do
context "when the relation exists" do
let(:parent) do
- Book.create(title: "Neuromancer")
+ Book.create!(title: "Neuromancer")
end
let!(:rating) do
parent.create_rating(value: 10)
end
@@ -465,11 +464,11 @@
end
context "when no association target exists" do
let(:parent) do
- Book.create(title: "Neuromancer")
+ Book.create!(title: "Neuromancer")
end
[:delete, :destroy].each do |method|
describe "##{method}" do
@@ -482,15 +481,15 @@
end
context "when nullifying a many to many" do
let(:person) do
- Person.create
+ Person.create!
end
let!(:preference) do
- person.preferences.create(name: "Setting")
+ person.preferences.create!(name: "Setting")
end
let(:from_db) do
Preference.find(preference.id)
end
@@ -651,11 +650,11 @@
end
context 'when the strategy is :delete_all' do
let(:person) do
- Person.create
+ Person.create!
end
context "when cascading a has one" do
context "when the relation exists" do
@@ -694,14 +693,14 @@
context "when cascading a has many" do
context "when the relation has documents" do
let!(:post_one) do
- person.posts.create(title: "one")
+ person.posts.create!(title: "one")
end
let!(:post_two) do
- person.posts.create(title: "two")
+ person.posts.create!(title: "two")
end
context "when the documents are in memory" do
before do