From b1ded73911a3cb59e0bbef18e5c7a8752d21b106 Mon Sep 17 00:00:00 2001 From: MadeTech Dushan Date: Tue, 30 Nov 2021 11:47:18 +0000 Subject: [PATCH] Change feature spec to request spec --- spec/features/form/tasklist_page_spec.rb | 9 --------- spec/requests/case_log_controller_spec.rb | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/spec/features/form/tasklist_page_spec.rb b/spec/features/form/tasklist_page_spec.rb index a9511e8c9..7c7108b38 100644 --- a/spec/features/form/tasklist_page_spec.rb +++ b/spec/features/form/tasklist_page_spec.rb @@ -26,15 +26,6 @@ RSpec.describe "Task List" do sign_in user 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 visit("/case_logs/#{empty_case_log.id}") expect(page).to have_link("Skip to next incomplete section", href: /#household_characteristics/) diff --git a/spec/requests/case_log_controller_spec.rb b/spec/requests/case_log_controller_spec.rb index ecfa5b2fe..9a7020548 100644 --- a/spec/requests/case_log_controller_spec.rb +++ b/spec/requests/case_log_controller_spec.rb @@ -198,6 +198,28 @@ RSpec.describe CaseLogsController, type: :request do 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 before do sign_in user