diff --git a/spec/helpers/tasklist_helper_spec.rb b/spec/helpers/tasklist_helper_spec.rb index 8a34f86d2..7b16a2507 100644 --- a/spec/helpers/tasklist_helper_spec.rb +++ b/spec/helpers/tasklist_helper_spec.rb @@ -13,7 +13,7 @@ RSpec.describe TasklistHelper do describe "with lettings" do let(:empty_lettings_log) { create(:lettings_log) } - let(:lettings_log) { build(:lettings_log, :in_progress, needstype: 1, startdate: now) } + let(:lettings_log) { build_stubbed(:lettings_log, :in_progress, needstype: 1, startdate: now) } describe "get next incomplete section" do it "returns the first subsection name if it is not completed" do diff --git a/spec/models/form_spec.rb b/spec/models/form_spec.rb index 4370ee43c..0412c6ab2 100644 --- a/spec/models/form_spec.rb +++ b/spec/models/form_spec.rb @@ -84,7 +84,7 @@ RSpec.describe Form, type: :model do end describe "next_incomplete_section_redirect_path" do - let(:lettings_log) { FactoryBot.build(:lettings_log, :in_progress) } + let(:lettings_log) { FactoryBot.build_stubbed(:lettings_log, :in_progress) } let(:subsection) { form.get_subsection("household_characteristics") } let(:later_subsection) { form.get_subsection("declaration") } diff --git a/spec/models/lettings_log_spec.rb b/spec/models/lettings_log_spec.rb index 49f954250..d7c89c446 100644 --- a/spec/models/lettings_log_spec.rb +++ b/spec/models/lettings_log_spec.rb @@ -3551,7 +3551,7 @@ RSpec.describe LettingsLog do end context "when setup section has been completed" do - let(:lettings_log) { build(:lettings_log, :setup_completed) } + let(:lettings_log) { build_stubbed(:lettings_log, :setup_completed) } it "returns true" do expect(lettings_log).to be_non_location_setup_questions_completed @@ -3559,7 +3559,7 @@ RSpec.describe LettingsLog do end context "when the declaration has not been completed for a 2024 log" do - let(:lettings_log) { build(:lettings_log, :setup_completed, startdate: Time.utc(2024, 10, 1), declaration: nil) } + let(:lettings_log) { build_stubbed(:lettings_log, :setup_completed, startdate: Time.utc(2024, 10, 1), declaration: nil) } it "returns false" do expect(lettings_log).not_to be_non_location_setup_questions_completed @@ -3567,7 +3567,7 @@ RSpec.describe LettingsLog do end context "when an optional question has not been completed" do - let(:lettings_log) { build(:lettings_log, :setup_completed, propcode: nil) } + let(:lettings_log) { build_stubbed(:lettings_log, :setup_completed, propcode: nil) } it "returns true" do expect(lettings_log).to be_non_location_setup_questions_completed @@ -3575,7 +3575,7 @@ RSpec.describe LettingsLog do end context "when scheme and location have not been completed" do - let(:lettings_log) { build(:lettings_log, :setup_completed, :sh, scheme_id: nil, location_id: nil) } + let(:lettings_log) { build_stubbed(:lettings_log, :setup_completed, :sh, scheme_id: nil, location_id: nil) } it "returns true" do expect(lettings_log).to be_non_location_setup_questions_completed diff --git a/spec/models/log_spec.rb b/spec/models/log_spec.rb index 73533f881..21ff2849d 100644 --- a/spec/models/log_spec.rb +++ b/spec/models/log_spec.rb @@ -30,7 +30,7 @@ RSpec.describe Log, type: :model do describe "#blank_invalid_non_setup_fields!" do context "when a setup field is invalid for a lettings log" do - subject(:model) { build(:lettings_log, needstype: 404) } + subject(:model) { build_stubbed(:lettings_log, needstype: 404) } it "does not blank it" do model.valid? @@ -39,7 +39,7 @@ RSpec.describe Log, type: :model do end context "when a setup field is invalid for a sales log" do - subject(:model) { build(:sales_log, companybuy: 404) } + subject(:model) { build_stubbed(:sales_log, companybuy: 404) } it "does not blank it" do model.valid? @@ -48,7 +48,7 @@ RSpec.describe Log, type: :model do end context "when a non setup field is invalid for a lettings log" do - subject(:model) { build(:lettings_log, :completed, startdate: Time.zone.local(2023, 12, 12), offered: 234) } + subject(:model) { build_stubbed(:lettings_log, :completed, startdate: Time.zone.local(2023, 12, 12), offered: 234) } it "blanks it" do model.valid? @@ -58,7 +58,7 @@ RSpec.describe Log, type: :model do end context "when a non setup field is invalid for a sales log" do - subject(:model) { build(:sales_log, :completed, age1: 10) } + subject(:model) { build_stubbed(:sales_log, :completed, age1: 10) } it "blanks it" do model.valid? @@ -68,7 +68,7 @@ RSpec.describe Log, type: :model do end context "when prevloc is invalid for a lettings log" do - subject(:model) { build(:lettings_log, :completed, previous_la_known: 1, prevloc: nil) } + subject(:model) { build_stubbed(:lettings_log, :completed, previous_la_known: 1, prevloc: nil) } it "blanks previous_la_known" do model.valid? @@ -78,7 +78,7 @@ RSpec.describe Log, type: :model do end context "when hhmemb is invalid for a lettings log" do - subject(:model) { build(:lettings_log, :setup_completed, hhmemb: 1, joint: 1) } + subject(:model) { build_stubbed(:lettings_log, :setup_completed, hhmemb: 1, joint: 1) } it "does not blank it" do model.valid?