Browse Source

CLDC-3168: Add Kent Reliance to mortgage lender options

pull/2244/head
Rachael Booth 11 months ago committed by Rachael Booth
parent
commit
d2c8c58c3e
  1. 57
      app/models/form/sales/questions/mortgage_lender.rb
  2. 293
      spec/models/form/sales/questions/mortgage_lender_spec.rb

57
app/models/form/sales/questions/mortgage_lender.rb

@ -7,7 +7,6 @@ class Form::Sales::Questions::MortgageLender < ::Form::Question
@type = "select" @type = "select"
@hint_text = "" @hint_text = ""
@page = page @page = page
@answer_options = ANSWER_OPTIONS
@bottom_guidance_partial = "mortgage_lender" @bottom_guidance_partial = "mortgage_lender"
@ownershipsch = ownershipsch @ownershipsch = ownershipsch
@question_number = question_number @question_number = question_number
@ -54,54 +53,24 @@ class Form::Sales::Questions::MortgageLender < ::Form::Question
"37" => "Virgin Money", "37" => "Virgin Money",
"38" => "West Bromwich Building Society", "38" => "West Bromwich Building Society",
"39" => "Yorkshire Building Society", "39" => "Yorkshire Building Society",
"41" => "Kent Reliance",
"40" => "Other", "40" => "Other",
"0" => "Don’t know", "0" => "Don’t know",
}.freeze }.freeze
OPTIONS_INTRODUCED_2024 = %w[41].freeze
OPTIONS_NOT_DISPLAYED = %w[0].freeze
def answer_options
if form.start_year_after_2024?
ANSWER_OPTIONS
else
ANSWER_OPTIONS.dup.reject { |k, _v| OPTIONS_INTRODUCED_2024.include?(k) }
end
end
def displayed_answer_options(_log, _user = nil) def displayed_answer_options(_log, _user = nil)
{ answer_options.reject { |k, _v| OPTIONS_NOT_DISPLAYED.include?(k) }
"" => "Select an option",
"1" => "Atom Bank",
"2" => "Barclays Bank PLC",
"3" => "Bath Building Society",
"4" => "Buckinghamshire Building Society",
"5" => "Cambridge Building Society",
"6" => "Coventry Building Society",
"7" => "Cumberland Building Society",
"8" => "Darlington Building Society",
"9" => "Dudley Building Society",
"10" => "Ecology Building Society",
"11" => "Halifax",
"12" => "Hanley Economic Building Society",
"13" => "Hinckley and Rugby Building Society",
"14" => "Holmesdale Building Society",
"15" => "Ipswich Building Society",
"16" => "Leeds Building Society",
"17" => "Lloyds Bank",
"18" => "Mansfield Building Society",
"19" => "Market Harborough Building Society",
"20" => "Melton Mowbray Building Society",
"21" => "Nationwide Building Society",
"22" => "Natwest",
"23" => "Nedbank Private Wealth",
"24" => "Newbury Building Society",
"25" => "OneSavings Bank",
"26" => "Parity Trust",
"27" => "Penrith Building Society",
"28" => "Pepper Homeloans",
"29" => "Royal Bank of Scotland",
"30" => "Santander",
"31" => "Skipton Building Society",
"32" => "Teachers Building Society",
"33" => "The Co-operative Bank",
"34" => "Tipton & Coseley Building Society",
"35" => "TSB",
"36" => "Ulster Bank",
"37" => "Virgin Money",
"38" => "West Bromwich Building Society",
"39" => "Yorkshire Building Society",
"40" => "Other",
}
end end
def question_number def question_number

293
spec/models/form/sales/questions/mortgage_lender_spec.rb

@ -6,6 +6,14 @@ RSpec.describe Form::Sales::Questions::MortgageLender, type: :model do
let(:question_id) { nil } let(:question_id) { nil }
let(:question_definition) { nil } let(:question_definition) { nil }
let(:page) { instance_double(Form::Page) } let(:page) { instance_double(Form::Page) }
let(:subsection) { instance_double(Form::Subsection) }
let(:form) { instance_double(Form) }
before do
allow(form).to receive(:start_year_after_2024?)
allow(page).to receive(:subsection).and_return(subsection)
allow(subsection).to receive(:form).and_return(form)
end
it "has correct page" do it "has correct page" do
expect(question.page).to eq(page) expect(question.page).to eq(page)
@ -44,96 +52,203 @@ RSpec.describe Form::Sales::Questions::MortgageLender, type: :model do
expect(question.top_guidance_partial).to be_nil expect(question.top_guidance_partial).to be_nil
end end
it "has the correct answer_options" do context "when form year is before 2024" do
expect(question.answer_options).to eq({ before do
"" => "Select an option", allow(form).to receive(:start_year_after_2024?).and_return(false)
"0" => "Don’t know", end
"1" => "Atom Bank",
"2" => "Barclays Bank PLC", it "has the correct answer_options" do
"3" => "Bath Building Society", expect(question.answer_options).to eq({
"4" => "Buckinghamshire Building Society", "" => "Select an option",
"5" => "Cambridge Building Society", "0" => "Don’t know",
"6" => "Coventry Building Society", "1" => "Atom Bank",
"7" => "Cumberland Building Society", "2" => "Barclays Bank PLC",
"8" => "Darlington Building Society", "3" => "Bath Building Society",
"9" => "Dudley Building Society", "4" => "Buckinghamshire Building Society",
"10" => "Ecology Building Society", "5" => "Cambridge Building Society",
"11" => "Halifax", "6" => "Coventry Building Society",
"12" => "Hanley Economic Building Society", "7" => "Cumberland Building Society",
"13" => "Hinckley and Rugby Building Society", "8" => "Darlington Building Society",
"14" => "Holmesdale Building Society", "9" => "Dudley Building Society",
"15" => "Ipswich Building Society", "10" => "Ecology Building Society",
"16" => "Leeds Building Society", "11" => "Halifax",
"17" => "Lloyds Bank", "12" => "Hanley Economic Building Society",
"18" => "Mansfield Building Society", "13" => "Hinckley and Rugby Building Society",
"19" => "Market Harborough Building Society", "14" => "Holmesdale Building Society",
"20" => "Melton Mowbray Building Society", "15" => "Ipswich Building Society",
"21" => "Nationwide Building Society", "16" => "Leeds Building Society",
"22" => "Natwest", "17" => "Lloyds Bank",
"23" => "Nedbank Private Wealth", "18" => "Mansfield Building Society",
"24" => "Newbury Building Society", "19" => "Market Harborough Building Society",
"25" => "OneSavings Bank", "20" => "Melton Mowbray Building Society",
"26" => "Parity Trust", "21" => "Nationwide Building Society",
"27" => "Penrith Building Society", "22" => "Natwest",
"28" => "Pepper Homeloans", "23" => "Nedbank Private Wealth",
"29" => "Royal Bank of Scotland", "24" => "Newbury Building Society",
"30" => "Santander", "25" => "OneSavings Bank",
"31" => "Skipton Building Society", "26" => "Parity Trust",
"32" => "Teachers Building Society", "27" => "Penrith Building Society",
"33" => "The Co-operative Bank", "28" => "Pepper Homeloans",
"34" => "Tipton & Coseley Building Society", "29" => "Royal Bank of Scotland",
"35" => "TSB", "30" => "Santander",
"36" => "Ulster Bank", "31" => "Skipton Building Society",
"37" => "Virgin Money", "32" => "Teachers Building Society",
"38" => "West Bromwich Building Society", "33" => "The Co-operative Bank",
"39" => "Yorkshire Building Society", "34" => "Tipton & Coseley Building Society",
"40" => "Other", "35" => "TSB",
}) "36" => "Ulster Bank",
"37" => "Virgin Money",
"38" => "West Bromwich Building Society",
"39" => "Yorkshire Building Society",
"40" => "Other",
})
end
it "has the correct displayed_answer_options" do
expect(question.displayed_answer_options(nil, nil)).to eq({
"" => "Select an option",
"1" => "Atom Bank",
"2" => "Barclays Bank PLC",
"3" => "Bath Building Society",
"4" => "Buckinghamshire Building Society",
"5" => "Cambridge Building Society",
"6" => "Coventry Building Society",
"7" => "Cumberland Building Society",
"8" => "Darlington Building Society",
"9" => "Dudley Building Society",
"10" => "Ecology Building Society",
"11" => "Halifax",
"12" => "Hanley Economic Building Society",
"13" => "Hinckley and Rugby Building Society",
"14" => "Holmesdale Building Society",
"15" => "Ipswich Building Society",
"16" => "Leeds Building Society",
"17" => "Lloyds Bank",
"18" => "Mansfield Building Society",
"19" => "Market Harborough Building Society",
"20" => "Melton Mowbray Building Society",
"21" => "Nationwide Building Society",
"22" => "Natwest",
"23" => "Nedbank Private Wealth",
"24" => "Newbury Building Society",
"25" => "OneSavings Bank",
"26" => "Parity Trust",
"27" => "Penrith Building Society",
"28" => "Pepper Homeloans",
"29" => "Royal Bank of Scotland",
"30" => "Santander",
"31" => "Skipton Building Society",
"32" => "Teachers Building Society",
"33" => "The Co-operative Bank",
"34" => "Tipton & Coseley Building Society",
"35" => "TSB",
"36" => "Ulster Bank",
"37" => "Virgin Money",
"38" => "West Bromwich Building Society",
"39" => "Yorkshire Building Society",
"40" => "Other",
})
end
end end
it "has the correct displayed_answer_options" do context "when form year is >= 2024" do
expect(question.displayed_answer_options(nil, nil)).to eq({ before do
"" => "Select an option", allow(form).to receive(:start_year_after_2024?).and_return(true)
"1" => "Atom Bank", end
"2" => "Barclays Bank PLC",
"3" => "Bath Building Society", it "has the correct answer_options" do
"4" => "Buckinghamshire Building Society", expect(question.answer_options).to eq({
"5" => "Cambridge Building Society", "" => "Select an option",
"6" => "Coventry Building Society", "0" => "Don’t know",
"7" => "Cumberland Building Society", "1" => "Atom Bank",
"8" => "Darlington Building Society", "2" => "Barclays Bank PLC",
"9" => "Dudley Building Society", "3" => "Bath Building Society",
"10" => "Ecology Building Society", "4" => "Buckinghamshire Building Society",
"11" => "Halifax", "5" => "Cambridge Building Society",
"12" => "Hanley Economic Building Society", "6" => "Coventry Building Society",
"13" => "Hinckley and Rugby Building Society", "7" => "Cumberland Building Society",
"14" => "Holmesdale Building Society", "8" => "Darlington Building Society",
"15" => "Ipswich Building Society", "9" => "Dudley Building Society",
"16" => "Leeds Building Society", "10" => "Ecology Building Society",
"17" => "Lloyds Bank", "11" => "Halifax",
"18" => "Mansfield Building Society", "12" => "Hanley Economic Building Society",
"19" => "Market Harborough Building Society", "13" => "Hinckley and Rugby Building Society",
"20" => "Melton Mowbray Building Society", "14" => "Holmesdale Building Society",
"21" => "Nationwide Building Society", "15" => "Ipswich Building Society",
"22" => "Natwest", "16" => "Leeds Building Society",
"23" => "Nedbank Private Wealth", "17" => "Lloyds Bank",
"24" => "Newbury Building Society", "18" => "Mansfield Building Society",
"25" => "OneSavings Bank", "19" => "Market Harborough Building Society",
"26" => "Parity Trust", "20" => "Melton Mowbray Building Society",
"27" => "Penrith Building Society", "21" => "Nationwide Building Society",
"28" => "Pepper Homeloans", "22" => "Natwest",
"29" => "Royal Bank of Scotland", "23" => "Nedbank Private Wealth",
"30" => "Santander", "24" => "Newbury Building Society",
"31" => "Skipton Building Society", "25" => "OneSavings Bank",
"32" => "Teachers Building Society", "26" => "Parity Trust",
"33" => "The Co-operative Bank", "27" => "Penrith Building Society",
"34" => "Tipton & Coseley Building Society", "28" => "Pepper Homeloans",
"35" => "TSB", "29" => "Royal Bank of Scotland",
"36" => "Ulster Bank", "30" => "Santander",
"37" => "Virgin Money", "31" => "Skipton Building Society",
"38" => "West Bromwich Building Society", "32" => "Teachers Building Society",
"39" => "Yorkshire Building Society", "33" => "The Co-operative Bank",
"40" => "Other", "34" => "Tipton & Coseley Building Society",
}) "35" => "TSB",
"36" => "Ulster Bank",
"37" => "Virgin Money",
"38" => "West Bromwich Building Society",
"39" => "Yorkshire Building Society",
"41" => "Kent Reliance",
"40" => "Other",
})
end
it "has the correct displayed_answer_options" do
expect(question.displayed_answer_options(nil, nil)).to eq({
"" => "Select an option",
"1" => "Atom Bank",
"2" => "Barclays Bank PLC",
"3" => "Bath Building Society",
"4" => "Buckinghamshire Building Society",
"5" => "Cambridge Building Society",
"6" => "Coventry Building Society",
"7" => "Cumberland Building Society",
"8" => "Darlington Building Society",
"9" => "Dudley Building Society",
"10" => "Ecology Building Society",
"11" => "Halifax",
"12" => "Hanley Economic Building Society",
"13" => "Hinckley and Rugby Building Society",
"14" => "Holmesdale Building Society",
"15" => "Ipswich Building Society",
"16" => "Leeds Building Society",
"17" => "Lloyds Bank",
"18" => "Mansfield Building Society",
"19" => "Market Harborough Building Society",
"20" => "Melton Mowbray Building Society",
"21" => "Nationwide Building Society",
"22" => "Natwest",
"23" => "Nedbank Private Wealth",
"24" => "Newbury Building Society",
"25" => "OneSavings Bank",
"26" => "Parity Trust",
"27" => "Penrith Building Society",
"28" => "Pepper Homeloans",
"29" => "Royal Bank of Scotland",
"30" => "Santander",
"31" => "Skipton Building Society",
"32" => "Teachers Building Society",
"33" => "The Co-operative Bank",
"34" => "Tipton & Coseley Building Society",
"35" => "TSB",
"36" => "Ulster Bank",
"37" => "Virgin Money",
"38" => "West Bromwich Building Society",
"39" => "Yorkshire Building Society",
"41" => "Kent Reliance",
"40" => "Other",
})
end
end end
end end

Loading…
Cancel
Save