Browse Source

update tests to reflect changes in class interfaces for page and question

pull/1333/head
Arthur Campbell 3 years ago
parent
commit
5bbac4ccda
  1. 6
      spec/models/form/lettings/pages/person_age_spec.rb
  2. 6
      spec/models/form/lettings/questions/age_spec.rb

6
spec/models/form/lettings/pages/person_age_spec.rb

@ -1,12 +1,12 @@
require "rails_helper"
RSpec.describe Form::Lettings::Pages::PersonAge, type: :model do
subject(:page) { described_class.new(nil, page_definition, subsection, person_index:, is_child:) }
subject(:page) { described_class.new(nil, page_definition, subsection, person_index:, person_type:) }
let(:page_definition) { nil }
let(:subsection) { instance_double(Form::Subsection) }
let(:person_index) { 2 }
let(:is_child) { false }
let(:person_type) { "non_child" }
it "has correct subsection" do
expect(page.subsection).to eq(subsection)
@ -26,7 +26,7 @@ RSpec.describe Form::Lettings::Pages::PersonAge, type: :model do
end
context "when child" do
let(:is_child) { true }
let(:person_type) { "child" }
it "has the correct id" do
expect(page.id).to eq("person_2_age_child")

6
spec/models/form/lettings/questions/age_spec.rb

@ -1,12 +1,12 @@
require "rails_helper"
RSpec.describe Form::Lettings::Questions::Age, type: :model do
subject(:question) { described_class.new(nil, question_definition, page, person_index:, is_child:) }
subject(:question) { described_class.new(nil, question_definition, page, person_index:, person_type:) }
let(:question_definition) { nil }
let(:page) { instance_double(Form::Page) }
let(:person_index) { 2 }
let(:is_child) { false }
let(:person_type) { "non_child" }
it "has correct page" do
expect(question.page).to eq(page)
@ -25,7 +25,7 @@ RSpec.describe Form::Lettings::Questions::Age, type: :model do
end
context "when child" do
let(:is_child) { true }
let(:person_type) { "child" }
it "has the correct hint" do
expect(question.hint_text).to eq("For a child under 1, enter 1")

Loading…
Cancel
Save