From d53c31602d00f7f9ce24961b960b3cbd29b28db6 Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire <94526761+natdeanlewissoftwire@users.noreply.github.com> Date: Tue, 26 Mar 2024 15:48:11 +0000 Subject: [PATCH] feat: update flaky tests (#2352) --- .../tasks/send_missing_addresses_csv_spec.rb | 28 +++++++++---------- ...ate_schemes_and_locations_from_csv_spec.rb | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/spec/lib/tasks/send_missing_addresses_csv_spec.rb b/spec/lib/tasks/send_missing_addresses_csv_spec.rb index b6e2b2958..5eb20d4a5 100644 --- a/spec/lib/tasks/send_missing_addresses_csv_spec.rb +++ b/spec/lib/tasks/send_missing_addresses_csv_spec.rb @@ -41,7 +41,7 @@ RSpec.describe "correct_addresses" do it "prints out the jobs enqueued" do expect(Rails.logger).to receive(:info).with(nil) - expect(Rails.logger).to receive(:info).with("Sending missing lettings addresses CSV for test organisation to data_coordinator1@example.com, data_coordinator2@example.com") + expect(Rails.logger).to receive(:info).with(match(/^Sending missing lettings addresses CSV for test organisation to (?:data_coordinator1@example\.com, data_coordinator2@example\.com|data_coordinator2@example\.com, data_coordinator1@example\.com)$/)) task.invoke end end @@ -60,7 +60,7 @@ RSpec.describe "correct_addresses" do it "prints out the jobs enqueued" do expect(Rails.logger).to receive(:info).with(nil) - expect(Rails.logger).to receive(:info).with("Sending missing lettings addresses CSV for test organisation to data_provider3@example.com, data_provider4@example.com") + expect(Rails.logger).to receive(:info).with(match(/^Sending missing lettings addresses CSV for test organisation to (?:data_provider3@example\.com, data_provider4@example\.com|data_provider4@example\.com, data_provider3@example\.com)$/)) task.invoke end end @@ -93,7 +93,7 @@ RSpec.describe "correct_addresses" do it "prints out the jobs enqueued" do expect(Rails.logger).to receive(:info).with(nil) - expect(Rails.logger).to receive(:info).with("Sending missing lettings addresses CSV for test organisation to data_coordinator1@example.com, data_coordinator2@example.com") + expect(Rails.logger).to receive(:info).with(match(/^Sending missing lettings addresses CSV for test organisation to (?:data_coordinator1@example\.com, data_coordinator2@example\.com|data_coordinator2@example\.com, data_coordinator1@example\.com)$/)) task.invoke end end @@ -112,7 +112,7 @@ RSpec.describe "correct_addresses" do it "prints out the jobs enqueued" do expect(Rails.logger).to receive(:info).with(nil) - expect(Rails.logger).to receive(:info).with("Sending missing lettings addresses CSV for test organisation to data_provider3@example.com, data_provider4@example.com") + expect(Rails.logger).to receive(:info).with(match(/^Sending missing lettings addresses CSV for test organisation to (?:data_provider3@example\.com, data_provider4@example\.com|data_provider4@example\.com, data_provider3@example\.com)$/)) task.invoke end end @@ -145,7 +145,7 @@ RSpec.describe "correct_addresses" do it "prints out the jobs enqueued" do expect(Rails.logger).to receive(:info).with(nil) - expect(Rails.logger).to receive(:info).with("Sending missing lettings addresses CSV for test organisation to data_coordinator1@example.com, data_coordinator2@example.com") + expect(Rails.logger).to receive(:info).with(match(/^Sending missing lettings addresses CSV for test organisation to (?:data_coordinator1@example\.com, data_coordinator2@example\.com|data_coordinator2@example\.com, data_coordinator1@example\.com)$/)) task.invoke end end @@ -164,7 +164,7 @@ RSpec.describe "correct_addresses" do it "prints out the jobs enqueued" do expect(Rails.logger).to receive(:info).with(nil) - expect(Rails.logger).to receive(:info).with("Sending missing lettings addresses CSV for test organisation to data_provider3@example.com, data_provider4@example.com") + expect(Rails.logger).to receive(:info).with(match(/^Sending missing lettings addresses CSV for test organisation to (?:data_provider3@example\.com, data_provider4@example\.com|data_provider4@example\.com, data_provider3@example\.com)$/)) task.invoke end end @@ -184,7 +184,7 @@ RSpec.describe "correct_addresses" do it "prints out the jobs enqueued" do expect(Rails.logger).to receive(:info).with(nil) - expect(Rails.logger).to receive(:info).with("Sending missing lettings addresses CSV for test organisation to data_provider3@example.com, data_provider4@example.com") + expect(Rails.logger).to receive(:info).with(match(/^Sending missing lettings addresses CSV for test organisation to (?:data_provider3@example\.com, data_provider4@example\.com|data_provider4@example\.com, data_provider3@example\.com)$/)) task.invoke end end @@ -262,7 +262,7 @@ RSpec.describe "correct_addresses" do it "prints out the jobs enqueued" do expect(Rails.logger).to receive(:info).with(nil) - expect(Rails.logger).to receive(:info).with("Sending missing sales addresses CSV for test organisation to data_coordinator1@example.com, data_coordinator2@example.com") + expect(Rails.logger).to receive(:info).with(match(/^Sending missing sales addresses CSV for test organisation to (?:data_coordinator1@example\.com, data_coordinator2@example\.com|data_coordinator2@example\.com, data_coordinator1@example\.com)$/)) task.invoke end end @@ -281,7 +281,7 @@ RSpec.describe "correct_addresses" do it "prints out the jobs enqueued" do expect(Rails.logger).to receive(:info).with(nil) - expect(Rails.logger).to receive(:info).with("Sending missing sales addresses CSV for test organisation to data_provider3@example.com, data_provider4@example.com") + expect(Rails.logger).to receive(:info).with(match(/^Sending missing sales addresses CSV for test organisation to (?:data_provider3@example\.com, data_provider4@example\.com|data_provider4@example\.com, data_provider3@example\.com)$/)) task.invoke end end @@ -314,7 +314,7 @@ RSpec.describe "correct_addresses" do it "prints out the jobs enqueued" do expect(Rails.logger).to receive(:info).with(nil) - expect(Rails.logger).to receive(:info).with("Sending missing sales addresses CSV for test organisation to data_coordinator1@example.com, data_coordinator2@example.com") + expect(Rails.logger).to receive(:info).with(match(/^Sending missing sales addresses CSV for test organisation to (?:data_coordinator1@example\.com, data_coordinator2@example\.com|data_coordinator2@example\.com, data_coordinator1@example\.com)$/)) task.invoke end end @@ -333,7 +333,7 @@ RSpec.describe "correct_addresses" do it "prints out the jobs enqueued" do expect(Rails.logger).to receive(:info).with(nil) - expect(Rails.logger).to receive(:info).with("Sending missing sales addresses CSV for test organisation to data_provider3@example.com, data_provider4@example.com") + expect(Rails.logger).to receive(:info).with(match(/^Sending missing sales addresses CSV for test organisation to (?:data_provider3@example\.com, data_provider4@example\.com|data_provider4@example\.com, data_provider3@example\.com)$/)) task.invoke end end @@ -366,7 +366,7 @@ RSpec.describe "correct_addresses" do it "prints out the jobs enqueued" do expect(Rails.logger).to receive(:info).with(nil) - expect(Rails.logger).to receive(:info).with("Sending missing sales addresses CSV for test organisation to data_coordinator1@example.com, data_coordinator2@example.com") + expect(Rails.logger).to receive(:info).with(match(/^Sending missing sales addresses CSV for test organisation to (?:data_coordinator1@example\.com, data_coordinator2@example\.com|data_coordinator2@example\.com, data_coordinator1@example\.com)$/)) task.invoke end end @@ -385,7 +385,7 @@ RSpec.describe "correct_addresses" do it "prints out the jobs enqueued" do expect(Rails.logger).to receive(:info).with(nil) - expect(Rails.logger).to receive(:info).with("Sending missing sales addresses CSV for test organisation to data_provider3@example.com, data_provider4@example.com") + expect(Rails.logger).to receive(:info).with(match(/^Sending missing sales addresses CSV for test organisation to (?:data_provider3@example\.com, data_provider4@example\.com|data_provider4@example\.com, data_provider3@example\.com)$/)) task.invoke end end @@ -405,7 +405,7 @@ RSpec.describe "correct_addresses" do it "prints out the jobs enqueued" do expect(Rails.logger).to receive(:info).with(nil) - expect(Rails.logger).to receive(:info).with("Sending missing sales addresses CSV for test organisation to data_provider3@example.com, data_provider4@example.com") + expect(Rails.logger).to receive(:info).with(match(/^Sending missing sales addresses CSV for test organisation to (?:data_provider3@example\.com, data_provider4@example\.com|data_provider4@example\.com, data_provider3@example\.com)$/)) task.invoke end end diff --git a/spec/lib/tasks/update_schemes_and_locations_from_csv_spec.rb b/spec/lib/tasks/update_schemes_and_locations_from_csv_spec.rb index 50dd98400..963b997ad 100644 --- a/spec/lib/tasks/update_schemes_and_locations_from_csv_spec.rb +++ b/spec/lib/tasks/update_schemes_and_locations_from_csv_spec.rb @@ -205,7 +205,7 @@ RSpec.describe "bulk_update" do expect(Rails.logger).to receive(:info).with("Updating scheme S#{schemes[0].id} with sensitive: No") expect(Rails.logger).to receive(:info).with("Updating scheme S#{schemes[0].id} with scheme_type: Direct Access Hostel") expect(Rails.logger).to receive(:info).with("Clearing location and scheme for logs with startdate and scheme S#{schemes[0].id}. Log IDs: ") - expect(Rails.logger).to receive(:info).with("Clearing location and scheme for logs without startdate and scheme S#{schemes[0].id}. Log IDs: #{lettings_log.id}, #{lettings_log_4.id}, #{lettings_log_5.id}") + expect(Rails.logger).to receive(:info).with(match(/^Clearing location and scheme for logs without startdate and scheme S#{schemes[0].id}\. Log IDs: (?=.*#{lettings_log.id})(?=.*#{lettings_log_4.id})(?=.*#{lettings_log_5.id}).*$/)) expect(Rails.logger).to receive(:info).with("Updating scheme S#{schemes[0].id} with arrangement_type: Another registered stock owner") expect(Rails.logger).to receive(:info).with("Updating scheme S#{schemes[0].id} with primary_client_group: People with drug problems") expect(Rails.logger).to receive(:info).with("Updating scheme S#{schemes[0].id} with has_other_client_group: No")