Browse Source

Fix the tests

pull/332/head
Kat 3 years ago
parent
commit
ed390ff499
  1. 3
      spec/features/form/accessible_autocomplete_spec.rb
  2. 9
      spec/features/form/check_answers_page_spec.rb

3
spec/features/form/accessible_autocomplete_spec.rb

@ -9,6 +9,7 @@ RSpec.describe "Accessible Automcomplete" do
:case_log, :case_log,
:in_progress, :in_progress,
la_known: "Yes", la_known: "Yes",
la: "Westminster",
is_la_inferred: false, is_la_inferred: false,
owning_organisation: user.organisation, owning_organisation: user.organisation,
managing_organisation: user.organisation, managing_organisation: user.organisation,
@ -39,7 +40,7 @@ RSpec.describe "Accessible Automcomplete" do
end end
it "has the correct option selected if one has been saved" do it "has the correct option selected if one has been saved" do
case_log.update!(postcode_known: "No", la: "Oxford") case_log.update!(postcode_known: "No", la_known: "Yes", la: "Oxford")
visit("/logs/#{case_log.id}/accessible-select") visit("/logs/#{case_log.id}/accessible-select")
expect(page).to have_select("case-log-la-field", selected: %w[Oxford]) expect(page).to have_select("case-log-la-field", selected: %w[Oxford])
end end

9
spec/features/form/check_answers_page_spec.rb

@ -18,6 +18,7 @@ RSpec.describe "Form Check Answers Page" do
FactoryBot.create( FactoryBot.create(
:case_log, :case_log,
la_known: "Yes", la_known: "Yes",
la: "Westminster",
is_la_inferred: false, is_la_inferred: false,
owning_organisation: user.organisation, owning_organisation: user.organisation,
managing_organisation: user.organisation, managing_organisation: user.organisation,
@ -86,14 +87,14 @@ RSpec.describe "Form Check Answers Page" do
it "updates the change/answer link when answers get updated" do it "updates the change/answer link when answers get updated" do
visit("/logs/#{empty_case_log.id}/household-needs/check-answers") visit("/logs/#{empty_case_log.id}/household-needs/check-answers")
assert_selector "a", text: /Answer (?!the missing questions)/, count: 5 assert_selector "a", text: /Answer (?!the missing questions)/, count: 4
assert_selector "a", text: "Change", count: 0 assert_selector "a", text: "Change", count: 1
visit("/logs/#{empty_case_log.id}/accessibility-requirements") visit("/logs/#{empty_case_log.id}/accessibility-requirements")
check("case-log-accessibility-requirements-housingneeds-c-field") check("case-log-accessibility-requirements-housingneeds-c-field")
click_button("Save and continue") click_button("Save and continue")
visit("/logs/#{empty_case_log.id}/household-needs/check-answers") visit("/logs/#{empty_case_log.id}/household-needs/check-answers")
assert_selector "a", text: /Answer (?!the missing questions)/, count: 4 assert_selector "a", text: /Answer (?!the missing questions)/, count: 3
assert_selector "a", text: "Change", count: 1 assert_selector "a", text: "Change", count: 2
expect(page).to have_link("Change", href: "/logs/#{empty_case_log.id}/accessibility-requirements") expect(page).to have_link("Change", href: "/logs/#{empty_case_log.id}/accessibility-requirements")
end end

Loading…
Cancel
Save