From 6b0820ecfcfd2f267600320b85bb7e1b144f3f64 Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire Date: Fri, 7 Jul 2023 14:31:23 +0100 Subject: [PATCH] feat: update tests --- spec/requests/users_controller_spec.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/spec/requests/users_controller_spec.rb b/spec/requests/users_controller_spec.rb index 92e575cec..e63689441 100644 --- a/spec/requests/users_controller_spec.rb +++ b/spec/requests/users_controller_spec.rb @@ -304,7 +304,7 @@ RSpec.describe UsersController, type: :request do it "allows changing email but not dpo or key_contact" do user.reload - expect(user.unconfirmed_email).to eq(new_email) + expect(user.email).to eq(new_email) expect(user.is_data_protection_officer?).to be false expect(user.is_key_contact?).to be false end @@ -702,7 +702,7 @@ RSpec.describe UsersController, type: :request do it "allows changing email and dpo" do user.reload - expect(user.unconfirmed_email).to eq(new_email) + expect(user.email).to eq(new_email) expect(user.is_data_protection_officer?).to be true expect(user.is_key_contact?).to be true end @@ -749,7 +749,7 @@ RSpec.describe UsersController, type: :request do it "allows changing email, dpo, key_contact" do patch "/users/#{other_user.id}", headers: headers, params: params other_user.reload - expect(other_user.unconfirmed_email).to eq(new_email) + expect(other_user.email).to eq(new_email) expect(other_user.is_data_protection_officer?).to be true expect(other_user.is_key_contact?).to be true end @@ -1454,14 +1454,14 @@ RSpec.describe UsersController, type: :request do it "allows changing email and dpo" do request user.reload - expect(user.unconfirmed_email).to eq(new_email) + expect(user.email).to eq(new_email) expect(user.is_data_protection_officer?).to be true expect(user.is_key_contact?).to be true end - it "sends a confirmation email to both emails" do - expect(notify_client).to receive(:send_email).with(email_address: new_email, template_id: User::CONFIRMABLE_TEMPLATE_ID, personalisation:).once - expect(notify_client).to receive(:send_email).with(email_address: user.email, template_id: User::CONFIRMABLE_TEMPLATE_ID, personalisation:).once + it "does not send a confirmation email to either email" do + expect(notify_client).not_to receive(:send_email).with(email_address: new_email, template_id: User::CONFIRMABLE_TEMPLATE_ID, personalisation:) + expect(notify_client).not_to receive(:send_email).with(email_address: user.email, template_id: User::CONFIRMABLE_TEMPLATE_ID, personalisation:) request end end @@ -1507,7 +1507,7 @@ RSpec.describe UsersController, type: :request do it "allows changing email, dpo, key_contact" do patch "/users/#{other_user.id}", headers: headers, params: params other_user.reload - expect(other_user.unconfirmed_email).to eq(new_email) + expect(other_user.email).to eq(new_email) expect(other_user.is_data_protection_officer?).to be true expect(other_user.is_key_contact?).to be true end @@ -1564,7 +1564,7 @@ RSpec.describe UsersController, type: :request do it "allows changing email, dpo, key_contact" do patch "/users/#{other_user.id}", headers: headers, params: params other_user.reload - expect(other_user.unconfirmed_email).to eq(new_email) + expect(other_user.email).to eq(new_email) expect(other_user.is_data_protection_officer?).to be true expect(other_user.is_key_contact?).to be true end