Browse Source

add about log start date to test form, fix tests

pull/193/head
MadeTech Dushan 4 years ago
parent
commit
fbf2033797
  1. 8
      spec/features/form/tasklist_page_spec.rb
  2. 22
      spec/fixtures/forms/2021_2022.json
  3. 4
      spec/helpers/tasklist_helper_spec.rb
  4. 4
      spec/requests/case_log_controller_spec.rb

8
spec/features/form/tasklist_page_spec.rb

@ -32,13 +32,13 @@ RSpec.describe "Task List" do
end
it "shows the number of completed sections if no sections are completed" do
visit("/logs/#{empty_case_log.id}")
expect(page).to have_content("You’ve completed 0 of 9 sections.")
visit("/case-logs/#{empty_case_log.id}")
expect(page).to have_content("You’ve completed 0 of 10 sections.")
end
it "shows the number of completed sections if one section is completed" do
answer_all_questions_in_income_subsection(empty_case_log)
visit("/logs/#{empty_case_log.id}")
expect(page).to have_content("You’ve completed 1 of 9 sections.")
visit("/case-logs/#{empty_case_log.id}")
expect(page).to have_content("You’ve completed 1 of 10 sections.")
end
end

22
spec/fixtures/forms/2021_2022.json vendored

@ -222,6 +222,28 @@
}
}
},
"about_this_log": {
"label": "About this log",
"subsections": {
"about_this_log": {
"label": "About this log",
"pages": {
"startdate": {
"header": "",
"description": "",
"questions": {
"startdate": {
"check_answer_label": "Tenancy start date",
"header": "What is the tenancy start date?",
"hint_text": "For example, 27 3 2007",
"type": "date"
}
}
}
}
}
}
},
"tenancy_and_property": {
"label": "Tenancy and property information",
"subsections": {

4
spec/helpers/tasklist_helper_spec.rb

@ -21,7 +21,7 @@ RSpec.describe TasklistHelper do
describe "get sections count" do
it "returns the total of sections if no status is given" do
expect(get_subsections_count(empty_case_log)).to eq(9)
expect(get_subsections_count(form, empty_case_log)).to eq(10)
end
it "returns 0 sections for completed sections if no sections are completed" do
@ -29,7 +29,7 @@ RSpec.describe TasklistHelper do
end
it "returns the number of not started sections" do
expect(get_subsections_count(empty_case_log, :not_started)).to eq(8)
expect(get_subsections_count(form, empty_case_log, :not_started)).to eq(9)
end
it "returns the number of sections in progress" do

4
spec/requests/case_log_controller_spec.rb

@ -200,7 +200,7 @@ RSpec.describe CaseLogsController, type: :request do
end
it "displays a section status for a case log" do
assert_select ".govuk-tag", text: /Not started/, count: 8
assert_select ".govuk-tag", text: /Not started/, count: 9
assert_select ".govuk-tag", text: /Completed/, count: 0
assert_select ".govuk-tag", text: /Cannot start yet/, count: 1
end
@ -222,7 +222,7 @@ RSpec.describe CaseLogsController, type: :request do
end
it "displays a section status for a case log" do
assert_select ".govuk-tag", text: /Not started/, count: 7
assert_select ".govuk-tag", text: /Not started/, count: 8
assert_select ".govuk-tag", text: /Completed/, count: 1
assert_select ".govuk-tag", text: /Cannot start yet/, count: 1
end

Loading…
Cancel
Save