Browse Source

Add nationality page

pull/909/head^2
Kat 4 years ago
parent
commit
994a047d35
  1. 16
      app/models/form/sales/pages/nationality1.rb
  2. 1
      app/models/form/sales/subsections/household_characteristics.rb
  3. 33
      spec/models/form/sales/pages/nationality1_spec.rb
  4. 1
      spec/models/form/sales/subsections/household_characteristics_spec.rb

16
app/models/form/sales/pages/nationality1.rb

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

1
app/models/form/sales/subsections/household_characteristics.rb

@ -11,6 +11,7 @@ class Form::Sales::Subsections::HouseholdCharacteristics < ::Form::Subsection
@pages ||= [
Form::Sales::Pages::Age1.new(nil, nil, self),
Form::Sales::Pages::GenderIdentity1.new(nil, nil, self),
Form::Sales::Pages::Nationality1.new(nil, nil, self),
Form::Sales::Pages::Buyer1LiveInProperty.new(nil, nil, self),
Form::Sales::Pages::Buyer2RelationshipToBuyer1.new(nil, nil, self),
Form::Sales::Pages::Buyer1EthnicGroup.new(nil, nil, self),

33
spec/models/form/sales/pages/nationality1_spec.rb

@ -0,0 +1,33 @@
require "rails_helper"
RSpec.describe Form::Sales::Pages::Nationality1, type: :model do
subject(:page) { described_class.new(page_id, page_definition, subsection) }
let(:page_id) { nil }
let(:page_definition) { nil }
let(:subsection) { instance_double(Form::Subsection) }
it "has correct subsection" do
expect(page.subsection).to eq(subsection)
end
it "has correct questions" do
expect(page.questions.map(&:id)).to eq(%w[national othernational])
end
it "has the correct id" do
expect(page.id).to eq("buyer_1_nationality")
end
it "has the correct header" do
expect(page.header).to eq("")
end
it "has the correct description" do
expect(page.description).to eq("")
end
it "has correct depends_on" do
expect(page.depends_on).to be_nil
end
end

1
spec/models/form/sales/subsections/household_characteristics_spec.rb

@ -24,6 +24,7 @@ RSpec.describe Form::Sales::Subsections::HouseholdCharacteristics, type: :model
buyer_1_ethnic_background_arab
buyer_1_ethnic_background_mixed
buyer_1_ethnic_background_white
buyer_1_nationality
buyer_2_age
],
)

Loading…
Cancel
Save