Browse Source

resolved failures after switching to Faker

cucumber-rails
JG 3 years ago
parent
commit
110d7cfeb8
  1. 5
      spec/models/user_spec.rb
  2. 6
      spec/requests/users_controller_spec.rb

5
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

6
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

Loading…
Cancel
Save