Browse Source

CLDC-3499: Update task list spec

CLDC-3499-remove-pre-2025-tests
samyou-softwire 2 weeks ago
parent
commit
3a4747d193
  1. 11
      spec/features/form/helpers.rb
  2. 25
      spec/features/form/tasklist_page_spec.rb

11
spec/features/form/helpers.rb

@ -18,17 +18,6 @@ module Helpers
click_button("Save and continue")
end
def answer_all_questions_in_income_subsection(lettings_log)
visit("/lettings-logs/#{lettings_log.id}/net-income")
fill_in("lettings-log-earnings-field", with: 18_000)
choose("lettings-log-incfreq-2-field")
click_button("Save and continue")
choose("lettings-log-benefits-0-field")
click_button("Save and continue")
choose("lettings-log-hb-1-field")
click_button("Save and continue")
end
def sign_in(user)
visit("/lettings-logs")
fill_in("user[email]", with: user.email)

25
spec/features/form/tasklist_page_spec.rb

@ -42,38 +42,16 @@ RSpec.describe "Task List" do
let(:id) { lettings_log.id }
let(:status) { lettings_log.status }
around do |example|
Timecop.freeze(Time.zone.local(2022, 1, 1)) do
Singleton.__init__(FormHandler)
example.run
end
Timecop.return
Singleton.__init__(FormHandler)
end
before do
Timecop.freeze(Time.zone.local(2021, 5, 1))
setup_completed_log.update!(startdate: Time.zone.local(2021, 5, 1))
allow(lettings_log.form).to receive(:new_logs_end_date).and_return(Time.zone.today + 1.day)
sign_in user
end
after do
Timecop.unfreeze
end
it "shows if the section has not been started" do
visit("/lettings-logs/#{empty_lettings_log.id}")
expect(page).to have_content("This log has not been started.")
end
describe "completed subsection count" do
let(:real_2021_2022_form) { Form.new("config/forms/2021_2022.json") }
before do
allow(FormHandler.instance).to receive(:get_form).and_return(real_2021_2022_form)
end
it "shows number of completed sections if one section is completed" do
visit("/lettings-logs/#{setup_completed_log.id}")
expect(page).to have_content("1 of 7 subsections completed.")
@ -81,9 +59,8 @@ RSpec.describe "Task List" do
end
it "show skip link for next incomplete section" do
answer_all_questions_in_income_subsection(setup_completed_log)
visit("/lettings-logs/#{setup_completed_log.id}")
expect(page).to have_link("Skip to next incomplete section", href: /#household-characteristics/)
expect(page).to have_link("Skip to next incomplete section", href: /#property-information/)
end
it "has a review section which has a button that allows the data inputter to review the lettings log" do

Loading…
Cancel
Save