From b9e5f927cf1f6deae662538e58b75188c3982eb4 Mon Sep 17 00:00:00 2001 From: Phil Lee Date: Tue, 10 Jan 2023 12:48:20 +0000 Subject: [PATCH] extract old_visible_id in factory to trait --- spec/factories/organisation.rb | 5 ++++- spec/services/bulk_upload/processor_spec.rb | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/spec/factories/organisation.rb b/spec/factories/organisation.rb index 760a8fc8f..147f847d6 100644 --- a/spec/factories/organisation.rb +++ b/spec/factories/organisation.rb @@ -9,7 +9,10 @@ FactoryBot.define do created_at { Time.zone.now } updated_at { Time.zone.now } holds_own_stock { true } - old_visible_id { rand(9_999_999).to_s } + + trait :with_old_visible_id do + old_visible_id { rand(9_999_999).to_s } + end end factory :organisation_rent_period do diff --git a/spec/services/bulk_upload/processor_spec.rb b/spec/services/bulk_upload/processor_spec.rb index e187e9262..4afa500fb 100644 --- a/spec/services/bulk_upload/processor_spec.rb +++ b/spec/services/bulk_upload/processor_spec.rb @@ -19,7 +19,7 @@ RSpec.describe BulkUpload::Processor do it "persist the validation errors" do allow(BulkUpload::Downloader).to receive(:new).with(bulk_upload:).and_return(mock_downloader) - expect { processor.call }.to change(BulkUploadError, :count).by(10) + expect { processor.call }.to change(BulkUploadError, :count).by(8) end it "deletes the local file afterwards" do