Browse Source

Change feature spec to request spec

pull/119/head
MadeTech Dushan 3 years ago
parent
commit
b1ded73911
  1. 9
      spec/features/form/tasklist_page_spec.rb
  2. 22
      spec/requests/case_log_controller_spec.rb

9
spec/features/form/tasklist_page_spec.rb

@ -26,15 +26,6 @@ RSpec.describe "Task List" do
sign_in user sign_in user
end end
it "shows the correct status if one section is completed" do
answer_all_questions_in_income_subsection(empty_case_log)
visit("/case_logs/#{empty_case_log.id}")
assert_selector ".govuk-tag", text: /Not started/, count: 7
assert_selector ".govuk-tag", text: /Completed/, count: 1
assert_selector ".govuk-tag", text: /Cannot start yet/, count: 1
end
it "skips to the first section if no answers are completed" do it "skips to the first section if no answers are completed" do
visit("/case_logs/#{empty_case_log.id}") visit("/case_logs/#{empty_case_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: /#household_characteristics/)

22
spec/requests/case_log_controller_spec.rb

@ -198,6 +198,28 @@ RSpec.describe CaseLogsController, type: :request do
end end
end end
context "case log with a single section complete" do
let(:section_completed_case_log) do
FactoryBot.create(
:case_log,
:conditional_section_complete,
owning_organisation: organisation,
managing_organisation: organisation,
)
end
before do
sign_in user
get "/case_logs/#{section_completed_case_log.id}", headers: headers, params: {}
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: /Completed/, count: 1
assert_select ".govuk-tag", text: /Cannot start yet/, count: 1
end
end
context "case logs that are not owned or managed by your organisation" do context "case logs that are not owned or managed by your organisation" do
before do before do
sign_in user sign_in user

Loading…
Cancel
Save