From 110d7cfeb861a717c153ef01b6b17f2f31410d6e Mon Sep 17 00:00:00 2001 From: JG Date: Mon, 23 May 2022 11:56:56 +0100 Subject: [PATCH] resolved failures after switching to Faker --- spec/models/user_spec.rb | 5 +++-- spec/requests/users_controller_spec.rb | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 8863f3bc4..2c01f8e8f 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -155,7 +155,8 @@ RSpec.describe User, type: :model do end describe "paper trail" do - let(:user) { FactoryBot.create(:user) } + let(:previous_name) { "Previous Name" } + let(:user) { FactoryBot.create(:user, name: previous_name) } it "creates a record of changes to a log" do expect { user.update!(name: "new test name") }.to change(user.versions, :count).by(1) @@ -163,7 +164,7 @@ RSpec.describe User, type: :model do it "allows case logs to be restored to a previous version" do user.update!(name: "new test name") - expect(user.paper_trail.previous_version.name).to eq("Danny Rojas") + expect(user.paper_trail.previous_version.name).to eq(previous_name) end it "signing in does not create a new version" do diff --git a/spec/requests/users_controller_spec.rb b/spec/requests/users_controller_spec.rb index 679cc02c6..5fd2cedb7 100644 --- a/spec/requests/users_controller_spec.rb +++ b/spec/requests/users_controller_spec.rb @@ -613,7 +613,7 @@ RSpec.describe UsersController, type: :request do it "does update other values" do expect { patch "/users/#{other_user.id}", headers:, params: } - .to change { other_user.reload.name }.from("Danny Rojas").to("new name") + .to change { other_user.reload.name }.from(other_user.name).to("new name") end end end @@ -1045,7 +1045,7 @@ RSpec.describe UsersController, type: :request do it "does update other values" do expect { patch "/users/#{other_user.id}", headers:, params: } - .to change { other_user.reload.name }.from("Danny Rojas").to("new name") + .to change { other_user.reload.name }.from(other_user.name).to("new name") end end end @@ -1102,7 +1102,7 @@ RSpec.describe UsersController, type: :request do it "does update other values" do expect { patch "/users/#{other_user.id}", headers:, params: } - .to change { other_user.reload.name }.from("Danny Rojas").to("new name") + .to change { other_user.reload.name }.from(other_user.name).to("new name") end end end