From ba6efa7a1f280e1a1fc083b4f8dcc1b108c2f6be Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire Date: Wed, 8 Nov 2023 17:14:39 +0000 Subject: [PATCH] feat: update tests --- .../duplicate_logs_controller_spec.rb | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/spec/requests/duplicate_logs_controller_spec.rb b/spec/requests/duplicate_logs_controller_spec.rb index 933a0f54d..960b43a22 100644 --- a/spec/requests/duplicate_logs_controller_spec.rb +++ b/spec/requests/duplicate_logs_controller_spec.rb @@ -717,13 +717,13 @@ RSpec.describe DuplicateLogsController, type: :request do before do allow(Organisation).to receive(:find).with(user.organisation_id.to_s).and_return(user.organisation) - allow(user.organisation).to receive(:duplicate_lettings_logs_sets).and_return([[1, 2], [3, 4, 5]]) - allow(user.organisation).to receive(:duplicate_sales_logs_sets).and_return([[11, 12]]) + allow(user.organisation).to receive(:editable_duplicate_lettings_logs_sets).and_return([[1, 2], [3, 4, 5]]) + allow(user.organisation).to receive(:editable_duplicate_sales_logs_sets).and_return([[11, 12]]) end it "gets organisation duplicates" do - expect(user.organisation).to receive(:duplicate_lettings_logs_sets) - expect(user.organisation).to receive(:duplicate_sales_logs_sets) + expect(user.organisation).to receive(:editable_duplicate_lettings_logs_sets) + expect(user.organisation).to receive(:editable_duplicate_sales_logs_sets) get organisation_duplicates_path(organisation_id: user.organisation_id) end @@ -759,8 +759,8 @@ RSpec.describe DuplicateLogsController, type: :request do context "when there are no duplicate logs" do before do allow(Organisation).to receive(:find).with(user.organisation_id.to_s).and_return(user.organisation) - allow(user.organisation).to receive(:duplicate_lettings_logs_sets).and_return([]) - allow(user.organisation).to receive(:duplicate_sales_logs_sets).and_return([]) + allow(user.organisation).to receive(:editable_duplicate_lettings_logs_sets).and_return([]) + allow(user.organisation).to receive(:editable_duplicate_sales_logs_sets).and_return([]) get organisation_duplicates_path(organisation_id: user.organisation_id) end @@ -780,13 +780,13 @@ RSpec.describe DuplicateLogsController, type: :request do let(:user) { create(:user, :data_coordinator) } before do - allow(user.organisation).to receive(:duplicate_lettings_logs_sets).and_return([[1, 2], [3, 4, 5]]) - allow(user.organisation).to receive(:duplicate_sales_logs_sets).and_return([[11, 12]]) + allow(user.organisation).to receive(:editable_duplicate_lettings_logs_sets).and_return([[1, 2], [3, 4, 5]]) + allow(user.organisation).to receive(:editable_duplicate_sales_logs_sets).and_return([[11, 12]]) end it "gets organisation duplicates" do - expect(user.organisation).to receive(:duplicate_lettings_logs_sets) - expect(user.organisation).to receive(:duplicate_sales_logs_sets) + expect(user.organisation).to receive(:editable_duplicate_lettings_logs_sets) + expect(user.organisation).to receive(:editable_duplicate_sales_logs_sets) get duplicate_logs_path(organisation_id: user.organisation.id) end end @@ -795,13 +795,13 @@ RSpec.describe DuplicateLogsController, type: :request do let(:user) { create(:user) } before do - allow(user).to receive(:duplicate_lettings_logs_sets).and_return([[1, 2], [3, 4, 5]]) - allow(user).to receive(:duplicate_sales_logs_sets).and_return([[11, 12]]) + allow(user).to receive(:editable_duplicate_lettings_logs_sets).and_return([[1, 2], [3, 4, 5]]) + allow(user).to receive(:editable_duplicate_sales_logs_sets).and_return([[11, 12]]) end it "calls the helper method to retrieve duplicates for the current user" do - expect(user).to receive(:duplicate_lettings_logs_sets) - expect(user).to receive(:duplicate_sales_logs_sets) + expect(user).to receive(:editable_duplicate_lettings_logs_sets) + expect(user).to receive(:editable_duplicate_sales_logs_sets) get duplicate_logs_path end @@ -836,8 +836,8 @@ RSpec.describe DuplicateLogsController, type: :request do context "when there are no duplicate logs" do before do - allow(user).to receive(:duplicate_lettings_logs_sets).and_return([]) - allow(user).to receive(:duplicate_sales_logs_sets).and_return([]) + allow(user).to receive(:editable_duplicate_lettings_logs_sets).and_return([]) + allow(user).to receive(:editable_duplicate_sales_logs_sets).and_return([]) get duplicate_logs_path end