Browse Source

Add La nominations page and questions

pull/1115/head
Kat 4 years ago
parent
commit
615214dfff
  1. 15
      app/models/form/sales/pages/la_nominations.rb
  2. 18
      app/models/form/sales/questions/la_nominations.rb
  3. 6
      spec/models/form/sales/pages/la_nominations_spec.rb
  4. 10
      spec/models/form/sales/questions/la_nominations_spec.rb

15
app/models/form/sales/pages/la_nominations.rb

@ -0,0 +1,15 @@
class Form::Sales::Pages::LaNominations < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "la_nominations"
@header = ""
@description = ""
@subsection = subsection
end
def questions
@questions ||= [
Form::Sales::Questions::LaNominations.new(nil, nil, self),
]
end
end

18
app/models/form/sales/questions/la_nominations.rb

@ -0,0 +1,18 @@
class Form::Sales::Questions::LaNominations < ::Form::Question
def initialize(id, hsh, page)
super
@id = "lanomagr"
@check_answer_label = "Household rehoused under a local authority nominations agreement?"
@header = "Was the household rehoused under a 'local authority nominations agreement'?"
@type = "radio"
@answer_options = ANSWER_OPTIONS
@page = page
@hint_text = "A local authority nominations agreement is a written agreement between a local authority and private registered provider (PRP) that some or all of its sales vacancies are offered to local authorities for rehousing"
end
ANSWER_OPTIONS = {
"1" => { "value" => "Yes" },
"2" => { "value" => "No" },
"3" => { "value" => "Don’t know" },
}.freeze
end

6
spec/models/form/sales/pages/staircase_spec.rb → spec/models/form/sales/pages/la_nominations_spec.rb

@ -1,6 +1,6 @@
require "rails_helper" require "rails_helper"
RSpec.describe Form::Sales::Pages::Staircase, type: :model do RSpec.describe Form::Sales::Pages::LaNominations, type: :model do
subject(:page) { described_class.new(page_id, page_definition, subsection) } subject(:page) { described_class.new(page_id, page_definition, subsection) }
let(:page_id) { nil } let(:page_id) { nil }
@ -12,11 +12,11 @@ RSpec.describe Form::Sales::Pages::Staircase, type: :model do
end end
it "has correct questions" do it "has correct questions" do
expect(page.questions.map(&:id)).to eq(%w[staircase]) expect(page.questions.map(&:id)).to eq(%w[lanomagr])
end end
it "has the correct id" do it "has the correct id" do
expect(page.id).to eq("staircasing") expect(page.id).to eq("la_nominations")
end end
it "has the correct header" do it "has the correct header" do

10
spec/models/form/sales/questions/staircase_spec.rb → spec/models/form/sales/questions/la_nominations_spec.rb

@ -1,6 +1,6 @@
require "rails_helper" require "rails_helper"
RSpec.describe Form::Sales::Questions::Staircase, type: :model do RSpec.describe Form::Sales::Questions::LaNominations, type: :model do
subject(:question) { described_class.new(question_id, question_definition, page) } subject(:question) { described_class.new(question_id, question_definition, page) }
let(:question_id) { nil } let(:question_id) { nil }
@ -12,15 +12,15 @@ RSpec.describe Form::Sales::Questions::Staircase, type: :model do
end end
it "has the correct id" do it "has the correct id" do
expect(question.id).to eq("staircase") expect(question.id).to eq("lanomagr")
end end
it "has the correct header" do it "has the correct header" do
expect(question.header).to eq("Is this a staircasing transaction?") expect(question.header).to eq("Was the household rehoused under a 'local authority nominations agreement'?")
end end
it "has the correct check_answer_label" do it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq("Staircasing transaction") expect(question.check_answer_label).to eq("Household rehoused under a local authority nominations agreement?")
end end
it "has the correct type" do it "has the correct type" do
@ -44,6 +44,6 @@ RSpec.describe Form::Sales::Questions::Staircase, type: :model do
end end
it "has the correct hint" do it "has the correct hint" do
expect(question.hint_text).to eq("A staircasing transaction is when the household purchases more shares in their property, increasing the proportion they own and decreasing the proportion the housing association owns. Once the household purchases 100% of the shares, they own the property") expect(question.hint_text).to eq("A local authority nominations agreement is a written agreement between a local authority and private registered provider (PRP) that some or all of its sales vacancies are offered to local authorities for rehousing")
end end
end end
Loading…
Cancel
Save