Browse Source

Merge branch 'main' into CLDC-3690-extract-property-validations

pull/2742/head
kosiakkatrina 1 year ago committed by GitHub
parent
commit
bae14a40d7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      .github/workflows/staging_pipeline.yml
  2. 7
      app/models/form/sales/questions/ownership_scheme.rb
  3. 17
      spec/models/form/sales/questions/ownership_scheme_spec.rb

1
.github/workflows/staging_pipeline.yml

@ -8,6 +8,7 @@ on:
types: types:
- opened - opened
- synchronize - synchronize
merge_group:
workflow_dispatch: workflow_dispatch:
defaults: defaults:

7
app/models/form/sales/questions/ownership_scheme.rb

@ -7,7 +7,12 @@ class Form::Sales::Questions::OwnershipScheme < ::Form::Question
end end
def answer_options def answer_options
if form.start_year_2024_or_later? if form.start_year_2025_or_later?
{
"1" => { "value" => "Yes - a shared ownership scheme", "hint" => "When the purchaser buys an initial share of up to 75% of the property value and pays rent to the Private Registered Provider (PRP) on the remaining portion, or a subsequent staircasing transaction" },
"2" => { "value" => "Yes - a discounted ownership scheme" },
}.freeze
elsif form.start_year_2024_or_later?
{ {
"1" => { "value" => "Yes - a shared ownership scheme", "hint" => "When the purchaser buys an initial share of up to 75% of the property value and pays rent to the Private Registered Provider (PRP) on the remaining portion, or a subsequent staircasing transaction" }, "1" => { "value" => "Yes - a shared ownership scheme", "hint" => "When the purchaser buys an initial share of up to 75% of the property value and pays rent to the Private Registered Provider (PRP) on the remaining portion, or a subsequent staircasing transaction" },
"2" => { "value" => "Yes - a discounted ownership scheme" }, "2" => { "value" => "Yes - a discounted ownership scheme" },

17
spec/models/form/sales/questions/ownership_scheme_spec.rb

@ -11,6 +11,7 @@ RSpec.describe Form::Sales::Questions::OwnershipScheme, type: :model do
before do before do
allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(form).to receive(:start_year_2024_or_later?).and_return(false)
allow(form).to receive(:start_year_2025_or_later?).and_return(false)
allow(page).to receive(:subsection).and_return(subsection) allow(page).to receive(:subsection).and_return(subsection)
allow(subsection).to receive(:form).and_return(form) allow(subsection).to receive(:form).and_return(form)
end end
@ -39,7 +40,7 @@ RSpec.describe Form::Sales::Questions::OwnershipScheme, type: :model do
}) })
end end
context "with collection year on or after 2024" do context "with collection year in 2024" do
before do before do
allow(form).to receive(:start_year_2024_or_later?).and_return(true) allow(form).to receive(:start_year_2024_or_later?).and_return(true)
end end
@ -52,4 +53,18 @@ RSpec.describe Form::Sales::Questions::OwnershipScheme, type: :model do
}) })
end end
end end
context "with collection year on or after 2025" do
before do
allow(form).to receive(:start_year_2024_or_later?).and_return(true)
allow(form).to receive(:start_year_2025_or_later?).and_return(true)
end
it "has the correct answer_options" do
expect(question.answer_options).to eq({
"1" => { "value" => "Yes - a shared ownership scheme", "hint" => "When the purchaser buys an initial share of up to 75% of the property value and pays rent to the Private Registered Provider (PRP) on the remaining portion, or a subsequent staircasing transaction" },
"2" => { "value" => "Yes - a discounted ownership scheme" },
})
end
end
end end

Loading…
Cancel
Save