spec/mongoid/timestamps/updated_spec.rb in mongoid-7.3.5 vs spec/mongoid/timestamps/updated_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::Timestamps::Updated do
@@ -40,11 +39,11 @@
let(:time) do
Time.new(2012, 1, 1)
end
let(:doc) do
- Dokument.create(updated_at: time)
+ Dokument.create!(updated_at: time)
end
it "does not override it with the default" do
expect(doc.updated_at).to eq(time)
end
@@ -65,17 +64,17 @@
agent.new_record = false
end
it "does not run the update callbacks" do
expect(agent).to receive(:updated_at=).never
- agent.save
+ agent.save!
end
end
context "when the document is created" do
let(:agent) do
- Agent.create
+ Agent.create!
end
it "runs the update callbacks" do
expect(agent.updated_at).to_not be_nil
expect(agent.updated_at).to be_within(10).of(Time.now.utc)