diff --git a/app/models/form.rb b/app/models/form.rb index 69e12a317..0353fb08c 100644 --- a/app/models/form.rb +++ b/app/models/form.rb @@ -3,13 +3,13 @@ class Form :start_date, :end_date, :type, :name, :setup_definition, :setup_sections, :form_sections - def initialize(form_path, name, setup_path) - raise "No setup definition file exists for given path".freeze unless File.exist?(setup_path) + include Form::Setup + + def initialize(form_path, name) raise "No form definition file exists for given year".freeze unless File.exist?(form_path) @name = name - @setup_definition = JSON.parse(File.open(setup_path).read) - @setup_sections = setup_definition["sections"].map { |id, s| Form::Section.new(id, s, self) } || [] + @setup_sections = [Form::Setup::Sections::Setup.new(nil, nil, self)] @form_definition = JSON.parse(File.open(form_path).read) @form_sections = form_definition["sections"].map { |id, s| Form::Section.new(id, s, self) } @type = form_definition["form_type"] diff --git a/app/models/form/page.rb b/app/models/form/page.rb index 7822c2b68..1ea95ffd2 100644 --- a/app/models/form/page.rb +++ b/app/models/form/page.rb @@ -4,15 +4,17 @@ class Form::Page def initialize(id, hsh, subsection) @id = id - @header = hsh["header"] - @description = hsh["description"] - @questions = hsh["questions"].map { |q_id, q| Form::Question.new(q_id, q, self) } - @depends_on = hsh["depends_on"] - @derived = hsh["derived"] - @title_text = hsh["title_text"] - @informative_text = hsh["informative_text"] - @hide_subsection_label = hsh["hide_subsection_label"] @subsection = subsection + if hsh + @header = hsh["header"] + @description = hsh["description"] + @questions = hsh["questions"].map { |q_id, q| Form::Question.new(q_id, q, self) } + @depends_on = hsh["depends_on"] + @derived = hsh["derived"] + @title_text = hsh["title_text"] + @informative_text = hsh["informative_text"] + @hide_subsection_label = hsh["hide_subsection_label"] + end end delegate :form, to: :subsection diff --git a/app/models/form/question.rb b/app/models/form/question.rb index e499a93a8..e60802b3c 100644 --- a/app/models/form/question.rb +++ b/app/models/form/question.rb @@ -7,28 +7,30 @@ class Form::Question def initialize(id, hsh, page) @id = id - @check_answer_label = hsh["check_answer_label"] - @header = hsh["header"] - @guidance_partial = hsh["guidance_partial"] - @hint_text = hsh["hint_text"] - @type = hsh["type"] - @min = hsh["min"] - @max = hsh["max"] - @step = hsh["step"] - @width = hsh["width"] - @fields_to_add = hsh["fields-to-add"] - @result_field = hsh["result-field"] - @readonly = hsh["readonly"] - @answer_options = hsh["answer_options"] - @conditional_for = hsh["conditional_for"] - @inferred_answers = hsh["inferred_answers"] - @inferred_check_answers_value = hsh["inferred_check_answers_value"] - @hidden_in_check_answers = hsh["hidden_in_check_answers"] - @prefix = hsh["prefix"] - @suffix = hsh["suffix"] - @requires_js = hsh["requires_js"] - @fields_added = hsh["fields_added"] @page = page + if hsh + @check_answer_label = hsh["check_answer_label"] + @header = hsh["header"] + @guidance_partial = hsh["guidance_partial"] + @hint_text = hsh["hint_text"] + @type = hsh["type"] + @min = hsh["min"] + @max = hsh["max"] + @step = hsh["step"] + @width = hsh["width"] + @fields_to_add = hsh["fields-to-add"] + @result_field = hsh["result-field"] + @readonly = hsh["readonly"] + @answer_options = hsh["answer_options"] + @conditional_for = hsh["conditional_for"] + @inferred_answers = hsh["inferred_answers"] + @inferred_check_answers_value = hsh["inferred_check_answers_value"] + @hidden_in_check_answers = hsh["hidden_in_check_answers"] + @prefix = hsh["prefix"] + @suffix = hsh["suffix"] + @requires_js = hsh["requires_js"] + @fields_added = hsh["fields_added"] + end end delegate :subsection, to: :page diff --git a/app/models/form/section.rb b/app/models/form/section.rb index b99325f90..97a128f74 100644 --- a/app/models/form/section.rb +++ b/app/models/form/section.rb @@ -3,9 +3,11 @@ class Form::Section def initialize(id, hsh, form) @id = id - @label = hsh["label"] - @description = hsh["description"] @form = form - @subsections = hsh["subsections"].map { |s_id, s| Form::Subsection.new(s_id, s, self) } + if hsh + @label = hsh["label"] + @description = hsh["description"] + @subsections = hsh["subsections"].map { |s_id, s| Form::Subsection.new(s_id, s, self) } + end end end diff --git a/app/models/form/setup/pages/needs_type.rb b/app/models/form/setup/pages/needs_type.rb new file mode 100644 index 000000000..fe3a3e7ef --- /dev/null +++ b/app/models/form/setup/pages/needs_type.rb @@ -0,0 +1,18 @@ +class Form::Setup::Pages::NeedsType < ::Form::Page + def initialize(id, hsh, subsection) + super + @id = "needs_type" + @header = "" + @description = "" + @questions = questions + @depends_on = [{ "supported_housing_schemes_enabled?" => true }] + @derived = true + @subsection = subsection + end + + def questions + [ + Form::Setup::Questions::NeedsType.new(nil, nil, self), + ] + end +end diff --git a/app/models/form/setup/pages/property_reference.rb b/app/models/form/setup/pages/property_reference.rb new file mode 100644 index 000000000..0314816c8 --- /dev/null +++ b/app/models/form/setup/pages/property_reference.rb @@ -0,0 +1,16 @@ +class Form::Setup::Pages::PropertyReference < ::Form::Page + def initialize(id, hsh, subsection) + super + @id = "property_reference" + @header = "" + @description = "" + @questions = questions + @subsection = subsection + end + + def questions + [ + Form::Setup::Questions::PropertyReference.new(nil, nil, self), + ] + end +end diff --git a/app/models/form/setup/pages/renewal.rb b/app/models/form/setup/pages/renewal.rb new file mode 100644 index 000000000..959a1d94f --- /dev/null +++ b/app/models/form/setup/pages/renewal.rb @@ -0,0 +1,16 @@ +class Form::Setup::Pages::Renewal < ::Form::Page + def initialize(id, hsh, subsection) + super + @id = "renewal" + @header = "" + @description = "" + @questions = questions + @subsection = subsection + end + + def questions + [ + Form::Setup::Questions::Renewal.new(nil, nil, self), + ] + end +end diff --git a/app/models/form/setup/pages/rent_type.rb b/app/models/form/setup/pages/rent_type.rb new file mode 100644 index 000000000..c467efff5 --- /dev/null +++ b/app/models/form/setup/pages/rent_type.rb @@ -0,0 +1,19 @@ +class Form::Setup::Pages::RentType < ::Form::Page + def initialize(id, hsh, subsection) + super + @id = "rent_type" + @header = "" + @description = "" + @questions = questions + @depends_on = [{ "supported_housing_schemes_enabled?" => true }] + @derived = true + @subsection = subsection + end + + def questions + [ + Form::Setup::Questions::RentType.new(nil, nil, self), + Form::Setup::Questions::IrproductOther.new(nil, nil, self), + ] + end +end diff --git a/app/models/form/setup/pages/tenancy_start_date.rb b/app/models/form/setup/pages/tenancy_start_date.rb new file mode 100644 index 000000000..be1f24ca9 --- /dev/null +++ b/app/models/form/setup/pages/tenancy_start_date.rb @@ -0,0 +1,15 @@ +class Form::Setup::Pages::TenancyStartDate < ::Form::Page + def initialize(id, hsh, subsection) + super + @id = "tenancy_start_date" + @description = "" + @questions = questions + @subsection = subsection + end + + def questions + [ + Form::Setup::Questions::TenancyStartDate.new(nil, nil, self), + ] + end +end diff --git a/app/models/form/setup/pages/tenant_code.rb b/app/models/form/setup/pages/tenant_code.rb new file mode 100644 index 000000000..aa2b7e5c9 --- /dev/null +++ b/app/models/form/setup/pages/tenant_code.rb @@ -0,0 +1,16 @@ +class Form::Setup::Pages::TenantCode < ::Form::Page + def initialize(id, hsh, subsection) + super + @id = "tenant_code" + @header = "" + @description = "" + @questions = questions + @subsection = subsection + end + + def questions + [ + Form::Setup::Questions::TenantCode.new(nil, nil, self), + ] + end +end diff --git a/app/models/form/setup/questions/irproduct_other.rb b/app/models/form/setup/questions/irproduct_other.rb new file mode 100644 index 000000000..10c44d1fc --- /dev/null +++ b/app/models/form/setup/questions/irproduct_other.rb @@ -0,0 +1,10 @@ +class Form::Setup::Questions::IrproductOther < ::Form::Question + def initialize(id, hsh, page) + super + @id = "irproduct_other" + @check_answer_label = "Product name" + @header = "Name of rent product" + @type = "text" + @page = page + end +end diff --git a/app/models/form/setup/questions/needs_type.rb b/app/models/form/setup/questions/needs_type.rb new file mode 100644 index 000000000..ba974e152 --- /dev/null +++ b/app/models/form/setup/questions/needs_type.rb @@ -0,0 +1,17 @@ +class Form::Setup::Questions::NeedsType < ::Form::Question + def initialize(id, hsh, page) + super + @id = "needstype" + @check_answer_label = "Needs type" + @header = "What is the needs type?" + @hint_text = "" + @type = "radio" + @answer_options = ANSWER_OPTIONS + @page = page + end + + ANSWER_OPTIONS = { + "1" => { "value" => "General needs" }, + "2" => { "value" => "Supported housing" }, + }.freeze +end diff --git a/app/models/form/setup/questions/property_reference.rb b/app/models/form/setup/questions/property_reference.rb new file mode 100644 index 000000000..c52bf1a16 --- /dev/null +++ b/app/models/form/setup/questions/property_reference.rb @@ -0,0 +1,12 @@ +class Form::Setup::Questions::PropertyReference < ::Form::Question + def initialize(id, hsh, page) + super + @id = "propcode" + @check_answer_label = "Property reference" + @header = "What is the property reference?" + @hint_text = "This is how you usually refer to this property on your own systems." + @type = "text" + @width = 10 + @page = page + end +end diff --git a/app/models/form/setup/questions/renewal.rb b/app/models/form/setup/questions/renewal.rb new file mode 100644 index 000000000..53b68fb68 --- /dev/null +++ b/app/models/form/setup/questions/renewal.rb @@ -0,0 +1,17 @@ +class Form::Setup::Questions::Renewal < ::Form::Question + def initialize(id, hsh, page) + super + @id = "renewal" + @check_answer_label = "Property renewal" + @header = "Is this letting a renewal?" + @hint_text = "" + @type = "radio" + @answer_options = ANSWER_OPTIONS + @page = page + end + + ANSWER_OPTIONS = { + "1" => { "value" => "Yes" }, + "0" => { "value" => "No" }, + }.freeze +end diff --git a/app/models/form/setup/questions/rent_type.rb b/app/models/form/setup/questions/rent_type.rb new file mode 100644 index 000000000..c69b1a100 --- /dev/null +++ b/app/models/form/setup/questions/rent_type.rb @@ -0,0 +1,22 @@ +class Form::Setup::Questions::RentType < ::Form::Question + def initialize(id, hsh, page) + super + @id = "rent_type" + @check_answer_label = "Rent type" + @header = "What is the rent type?" + @hint_text = "" + @type = "radio" + @answer_options = ANSWER_OPTIONS + @conditional_for = { "irproduct_other" => [5] } + @page = page + end + + ANSWER_OPTIONS = { + "1" => { "value" => "Affordable Rent" }, + "2" => { "value" => "London Affordable Rent" }, + "4" => { "value" => "London Living Rent" }, + "3" => { "value" => "Rent to Buy" }, + "0" => { "value" => "Social Rent" }, + "5" => { "value" => "Other intermediate rent product" }, + }.freeze +end diff --git a/app/models/form/setup/questions/tenancy_start_date.rb b/app/models/form/setup/questions/tenancy_start_date.rb new file mode 100644 index 000000000..8e05771f7 --- /dev/null +++ b/app/models/form/setup/questions/tenancy_start_date.rb @@ -0,0 +1,10 @@ +class Form::Setup::Questions::TenancyStartDate < ::Form::Question + def initialize(id, hsh, page) + super + @id = "startdate" + @check_answer_label = "Tenancy start date" + @header = "What is the tenancy start date?" + @type = "date" + @page = page + end +end diff --git a/app/models/form/setup/questions/tenant_code.rb b/app/models/form/setup/questions/tenant_code.rb new file mode 100644 index 000000000..26d94458e --- /dev/null +++ b/app/models/form/setup/questions/tenant_code.rb @@ -0,0 +1,12 @@ +class Form::Setup::Questions::TenantCode < ::Form::Question + def initialize(id, hsh, page) + super + @id = "tenant_code" + @check_answer_label = "Tenant code" + @header = "What is the tenant code?" + @hint_text = "This is how you usually refer to this tenancy on your own systems." + @type = "text" + @width = 10 + @page = page + end +end diff --git a/app/models/form/setup/sections/setup.rb b/app/models/form/setup/sections/setup.rb new file mode 100644 index 000000000..9e41eb2bb --- /dev/null +++ b/app/models/form/setup/sections/setup.rb @@ -0,0 +1,10 @@ +class Form::Sections::Setup < ::Form::Section + def initialize(id, hsh, form) + super + @id = "setup" + @label = "Before you start" + @description = "" + @form = form + @subsections = [Form::Setup::Subsections::Setup.new(nil, nil, self)] + end +end diff --git a/app/models/form/setup/subsections/setup.rb b/app/models/form/setup/subsections/setup.rb new file mode 100644 index 000000000..a1f60efa4 --- /dev/null +++ b/app/models/form/setup/subsections/setup.rb @@ -0,0 +1,20 @@ +class Form::Subsections::Setup < ::Form::Subsection + def initialize(id, hsh, section) + super + @id = "setup" + @label = "Set up this lettings log" + @pages = [pages] + @section = section + end + + def pages + [ + Form::Setup::Pages::NeedsType.new(nil, nil, self), + Form::Setup::Pages::Renewal.new(nil, nil, self), + Form::Setup::Pages::TenancyStartDate.new(nil, nil, self), + Form::Setup::Pages::RentType.new(nil, nil, self), + Form::Setup::Pages::TenantCode.new(nil, nil, self), + Form::Setup::Pages::PropertyReference.new(nil, nil, self), + ] + end +end diff --git a/app/models/form/subsection.rb b/app/models/form/subsection.rb index 20b65ad9f..463f0ef9f 100644 --- a/app/models/form/subsection.rb +++ b/app/models/form/subsection.rb @@ -3,10 +3,12 @@ class Form::Subsection def initialize(id, hsh, section) @id = id - @label = hsh["label"] - @depends_on = hsh["depends_on"] - @pages = hsh["pages"].map { |s_id, p| Form::Page.new(s_id, p, self) } @section = section + if hsh + @label = hsh["label"] + @depends_on = hsh["depends_on"] + @pages = hsh["pages"].map { |s_id, p| Form::Page.new(s_id, p, self) } + end end delegate :form, to: :section diff --git a/app/models/form_handler.rb b/app/models/form_handler.rb index 5ae3c9059..13efcb9ca 100644 --- a/app/models/form_handler.rb +++ b/app/models/form_handler.rb @@ -21,18 +21,12 @@ private directories.each do |directory| Dir.glob("#{directory}/*.json").each do |form_path| form_name = File.basename(form_path, ".json") - forms[form_name] = Form.new(form_path, form_name, setup_path) + forms[form_name] = Form.new(form_path, form_name) end end forms end - def setup_path - return "spec/fixtures/forms/setup/log_setup.json" if Rails.env.test? - - "config/forms/setup/log_setup.json" - end - def directories Rails.env.test? ? ["spec/fixtures/forms"] : ["config/forms"] end diff --git a/config/forms/setup/log_setup.json b/config/forms/setup/log_setup.json index 7cb805646..e69de29bb 100644 --- a/config/forms/setup/log_setup.json +++ b/config/forms/setup/log_setup.json @@ -1,138 +0,0 @@ -{ - "form_type": "setup", - "sections": { - "setup": { - "label": "Before you start", - "subsections": { - "setup": { - "label": "Set up this lettings log", - "pages": { - "needs_type": { - "header": "", - "description": "", - "questions": { - "needstype": { - "check_answer_label": "Needs type", - "header": "What is the needs type?", - "hint_text": "", - "type": "radio", - "answer_options": { - "1": { - "value": "General needs" - }, - "2": { - "value": "Supported housing" - } - } - } - }, - "derived": true, - "depends_on": [ - { - "supported_housing_schemes_enabled?" : true - } - ] - }, - "renewal": { - "header": "", - "description": "", - "questions": { - "renewal": { - "check_answer_label": "Property renewal", - "header": "Is this letting a renewal?", - "hint_text": "A renewal is a letting to the same tenant in the same property.", - "type": "radio", - "answer_options": { - "1": { - "value": "Yes" - }, - "0": { - "value": "No" - } - } - } - } - }, - "tenancy_start_date": { - "header": "", - "description": "", - "questions": { - "startdate": { - "check_answer_label": "Tenancy start date", - "header": "What is the tenancy start date?", - "type": "date" - } - } - }, - "rent_type": { - "header": "", - "description": "", - "questions": { - "rent_type": { - "check_answer_label": "Rent type", - "header": "What is the rent type?", - "hint_text": "", - "type": "radio", - "answer_options": { - "1": { - "value": "Affordable Rent" - }, - "2": { - "value": "London Affordable Rent" - }, - "4": { - "value": "London Living Rent" - }, - "3": { - "value": "Rent to Buy" - }, - "0": { - "value": "Social Rent" - }, - "5": { - "value": "Other intermediate rent product" - } - }, - "conditional_for": { - "irproduct_other": [5] - } - }, - "irproduct_other": { - "check_answer_label": "Product name", - "header": "Name of rent product", - "type": "text" - } - } - }, - "tenancycode": { - "header": "", - "description": "", - "questions": { - "tenancycode": { - "check_answer_label": "Tenant code", - "header": "What is the tenant code?", - "hint_text": "This is how you usually refer to this tenancy on your own systems.", - "type": "text", - "width": 10 - } - } - }, - "property_reference": { - "header": "", - "description": "", - "questions": { - "propcode": { - "check_answer_label": "Property reference", - "header": "What is the property reference?", - "hint_text": "This is how you usually refer to this property on your own systems.", - "type": "text", - "width": 10 - } - } - } - } - } - } - } - } -} diff --git a/spec/features/form/check_answers_page_spec.rb b/spec/features/form/check_answers_page_spec.rb index d4e556517..00766636c 100644 --- a/spec/features/form/check_answers_page_spec.rb +++ b/spec/features/form/check_answers_page_spec.rb @@ -194,6 +194,7 @@ RSpec.describe "Form Check Answers Page" do :in_progress, owning_organisation: user.organisation, managing_organisation: user.organisation, + needstype: 1, tenancycode: nil, age1: nil, layear: 2, @@ -226,7 +227,7 @@ RSpec.describe "Form Check Answers Page" do it "they can click a button to cycle around to the next incomplete section" do visit("/logs/#{cycle_sections_case_log.id}/declaration/check-answers") click_link("Save and go to next incomplete section") - expect(page).to have_current_path("/logs/#{cycle_sections_case_log.id}/tenancycode") + expect(page).to have_current_path("/logs/#{cycle_sections_case_log.id}/tenant-code-test") end end end diff --git a/spec/features/form/form_navigation_spec.rb b/spec/features/form/form_navigation_spec.rb index 14195d7fa..1dbdaef25 100644 --- a/spec/features/form/form_navigation_spec.rb +++ b/spec/features/form/form_navigation_spec.rb @@ -16,7 +16,7 @@ RSpec.describe "Form Navigation" do let(:id) { case_log.id } let(:question_answers) do { - tenancycode: { type: "text", answer: "BZ737", path: "tenancycode" }, + tenancycode: { type: "text", answer: "BZ737", path: "tenant-code-test" }, age1: { type: "numeric", answer: 25, path: "person-1-age" }, sex1: { type: "radio", answer: "Female", path: "person-1-gender" }, ecstat1: { type: "radio", answer: 3, path: "person-1-working-situation" }, @@ -55,13 +55,13 @@ RSpec.describe "Form Navigation" do describe "Back link directs correctly", js: true do it "go back to tasklist page from tenant code" do visit("/logs/#{id}") - visit("/logs/#{id}/tenancycode") + visit("/logs/#{id}/tenant-code-test") click_link(text: "Back") expect(page).to have_content("Log #{id}") end it "go back to tenant code page from tenant age page", js: true do - visit("/logs/#{id}/tenancycode") + visit("/logs/#{id}/tenant-code-test") click_button("Save and continue") visit("/logs/#{id}/person-1-age") click_link(text: "Back") diff --git a/spec/fixtures/forms/2021_2022.json b/spec/fixtures/forms/2021_2022.json index fdd45b52e..97e150b4f 100644 --- a/spec/fixtures/forms/2021_2022.json +++ b/spec/fixtures/forms/2021_2022.json @@ -10,7 +10,7 @@ "household_characteristics": { "label": "Household characteristics", "pages": { - "tenancycode": { + "tenant_code_test": { "questions": { "tenancycode": { "check_answer_label": "Tenant code", @@ -27,7 +27,7 @@ { "housingneeds_a": null } - ] }, + ]}, "person_1_age": { "questions": { "age1": { @@ -39,7 +39,15 @@ "step": 1, "width": 2 } - } + }, + "depends_on": [ + { + "housingneeds_a": 1 + }, + { + "housingneeds_a": null + } + ] }, "person_1_gender": { "questions": { diff --git a/spec/fixtures/forms/2022_2023.json b/spec/fixtures/forms/2022_2023.json index 364e48d71..a1b017d30 100644 --- a/spec/fixtures/forms/2022_2023.json +++ b/spec/fixtures/forms/2022_2023.json @@ -9,7 +9,7 @@ "household_characteristics": { "label": "Household characteristics", "pages": { - "tenancycode": { + "tenant_code_test": { "questions": { "tenancycode": { "check_answer_label": "Tenant code", diff --git a/spec/fixtures/forms/setup/log_setup.json b/spec/fixtures/forms/setup/log_setup.json deleted file mode 100644 index 1ff713dd0..000000000 --- a/spec/fixtures/forms/setup/log_setup.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "form_type": "setup", - "sections": { - "setup": { - "label": "Before you start", - "subsections": { - "setup": { - "label": "Set up this lettings log", - "pages": { - "renewal": { - "header": "", - "description": "", - "questions": { - "renewal": { - "check_answer_label": "Property renewal", - "header": "Is this a renewal to the same tenant in the same property?", - "hint_text": "", - "type": "radio", - "answer_options": { - "1": "Yes", - "0": "No" - } - } - } - }, - "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" - } - } - }, - "about_this_letting": { - "header": "Tell us about this letting", - "description": "", - "questions": { - "rent_type": { - "check_answer_label": "Rent type", - "header": "What is the rent type?", - "hint_text": "", - "type": "radio", - "answer_options": { - "0": "Social rent", - "1": "Affordable rent", - "2": "London Affordable rent", - "3": "Rent to buy", - "4": "London living rent", - "5": "Other intermediate rent product" - }, - "conditional_for": { - "intermediate_rent_product_name": [5] - } - }, - "intermediate_rent_product_name": { - "check_answer_label": "Product name", - "header": "What is intermediate rent product name?", - "type": "text" - } - } - } - } - } - } - } - } -} diff --git a/spec/helpers/tasklist_helper_spec.rb b/spec/helpers/tasklist_helper_spec.rb index a11f778f7..2478f4cf7 100644 --- a/spec/helpers/tasklist_helper_spec.rb +++ b/spec/helpers/tasklist_helper_spec.rb @@ -6,18 +6,18 @@ RSpec.describe TasklistHelper do describe "get next incomplete section" do it "returns the first subsection name if it is not completed" do - expect(get_next_incomplete_section(case_log).id).to eq("household_characteristics") + expect(get_next_incomplete_section(case_log).id).to eq("setup") end it "returns the first subsection name if it is partially completed" do case_log["tenancycode"] = 123 - expect(get_next_incomplete_section(case_log).id).to eq("household_characteristics") + expect(get_next_incomplete_section(case_log).id).to eq("setup") end end 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(empty_case_log)).to eq(10) end it "returns 0 sections for completed sections if no sections are completed" do @@ -25,11 +25,11 @@ 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(empty_case_log, :not_started)).to eq(9) end it "returns the number of sections in progress" do - expect(get_subsections_count(case_log, :in_progress)).to eq(3) + expect(get_subsections_count(case_log, :in_progress)).to eq(4) end it "returns 0 for invalid state" do @@ -48,9 +48,9 @@ RSpec.describe TasklistHelper do expect(next_page_or_check_answers(subsection, empty_case_log)).to match(/tenancycode/) end - it "when first question being not routed to returns the second question link" do + it "when first question being not routed to returns the next routed question link" do empty_case_log.housingneeds_a = "No" - expect(next_page_or_check_answers(subsection, empty_case_log)).to match(/person-1-age/) + expect(next_page_or_check_answers(subsection, empty_case_log)).to match(/person-1-gender/) end end diff --git a/spec/models/case_log_spec.rb b/spec/models/case_log_spec.rb index 0b80f4ae3..77452b3bb 100644 --- a/spec/models/case_log_spec.rb +++ b/spec/models/case_log_spec.rb @@ -1700,10 +1700,10 @@ RSpec.describe CaseLog do end context "when the question type does not have answer options" do - let(:case_log) { FactoryBot.create(:case_log, :in_progress, housingneeds_a: 1, tenancycode: "test") } + let(:case_log) { FactoryBot.create(:case_log, :in_progress, housingneeds_a: 1, age1: 19) } it "clears the answer" do - expect { case_log.update!(housingneeds_a: 0) }.to change(case_log, :tenancycode).from("test").to(nil) + expect { case_log.update!(housingneeds_a: 0) }.to change(case_log, :age1).from(19).to(nil) end end diff --git a/spec/models/form/setup/pages/needs_type_spec.rb b/spec/models/form/setup/pages/needs_type_spec.rb new file mode 100644 index 000000000..ae1106129 --- /dev/null +++ b/spec/models/form/setup/pages/needs_type_spec.rb @@ -0,0 +1,37 @@ +require "rails_helper" + +RSpec.describe Form::Setup::Pages::NeedsType, type: :model do + subject(:page) { described_class.new(page_id, page_definition, subsection) } + + let(:page_id) { nil } + let(:page_definition) { nil } + let(:subsection) { instance_double(Form::Subsection) } + + it "has correct subsection" do + expect(page.subsection).to eq(subsection) + end + + it "has correct questions" do + expect(page.questions.map(&:id)).to eq(%w[needstype]) + end + + it "has the correct id" do + expect(page.id).to eq("needs_type") + end + + it "has the correct header" do + expect(page.header).to eq("") + end + + it "has the correct description" do + expect(page.description).to eq("") + end + + it "has the correct depends_on" do + expect(page.depends_on).to eq([{ "supported_housing_schemes_enabled?" => true }]) + end + + it "has the correct derived" do + expect(page.derived).to be true + end +end diff --git a/spec/models/form/setup/pages/property_reference_spec.rb b/spec/models/form/setup/pages/property_reference_spec.rb new file mode 100644 index 000000000..f347f7a55 --- /dev/null +++ b/spec/models/form/setup/pages/property_reference_spec.rb @@ -0,0 +1,37 @@ +require "rails_helper" + +RSpec.describe Form::Setup::Pages::PropertyReference, type: :model do + subject(:page) { described_class.new(page_id, page_definition, subsection) } + + let(:page_id) { nil } + let(:page_definition) { nil } + let(:subsection) { instance_double(Form::Subsection) } + + it "has correct subsection" do + expect(page.subsection).to eq(subsection) + end + + it "has correct questions" do + expect(page.questions.map(&:id)).to eq(%w[propcode]) + end + + it "has the correct id" do + expect(page.id).to eq("property_reference") + end + + it "has the correct header" do + expect(page.header).to eq("") + end + + it "has the correct description" do + expect(page.description).to eq("") + end + + it "has the correct depends_on" do + expect(page.depends_on).to be nil + end + + it "has the correct derived" do + expect(page.derived).to be nil + end +end diff --git a/spec/models/form/setup/pages/renewal_spec.rb b/spec/models/form/setup/pages/renewal_spec.rb new file mode 100644 index 000000000..86de88f0c --- /dev/null +++ b/spec/models/form/setup/pages/renewal_spec.rb @@ -0,0 +1,37 @@ +require "rails_helper" + +RSpec.describe Form::Setup::Pages::Renewal, type: :model do + subject(:page) { described_class.new(page_id, page_definition, subsection) } + + let(:page_id) { nil } + let(:page_definition) { nil } + let(:subsection) { instance_double(Form::Subsection) } + + it "has correct subsection" do + expect(page.subsection).to eq(subsection) + end + + it "has correct questions" do + expect(page.questions.map(&:id)).to eq(%w[renewal]) + end + + it "has the correct id" do + expect(page.id).to eq("renewal") + end + + it "has the correct header" do + expect(page.header).to eq("") + end + + it "has the correct description" do + expect(page.description).to eq("") + end + + it "has the correct depends_on" do + expect(page.depends_on).to be nil + end + + it "has the correct derived" do + expect(page.derived).to be nil + end +end diff --git a/spec/models/form/setup/pages/rent_type_spec.rb b/spec/models/form/setup/pages/rent_type_spec.rb new file mode 100644 index 000000000..f3604c7ac --- /dev/null +++ b/spec/models/form/setup/pages/rent_type_spec.rb @@ -0,0 +1,37 @@ +require "rails_helper" + +RSpec.describe Form::Setup::Pages::RentType, type: :model do + subject(:page) { described_class.new(page_id, page_definition, subsection) } + + let(:page_id) { nil } + let(:page_definition) { nil } + let(:subsection) { instance_double(Form::Subsection) } + + it "has correct subsection" do + expect(page.subsection).to eq(subsection) + end + + it "has correct questions" do + expect(page.questions.map(&:id)).to eq(%w[rent_type irproduct_other]) + end + + it "has the correct id" do + expect(page.id).to eq("rent_type") + end + + it "has the correct header" do + expect(page.header).to eq("") + end + + it "has the correct description" do + expect(page.description).to eq("") + end + + it "has the correct depends_on" do + expect(page.depends_on).to eq([{ "supported_housing_schemes_enabled?" => true }]) + end + + it "has the correct derived" do + expect(page.derived).to be true + end +end diff --git a/spec/models/form/setup/pages/tenancy_start_date_spec.rb b/spec/models/form/setup/pages/tenancy_start_date_spec.rb new file mode 100644 index 000000000..b4ebd2c36 --- /dev/null +++ b/spec/models/form/setup/pages/tenancy_start_date_spec.rb @@ -0,0 +1,37 @@ +require "rails_helper" + +RSpec.describe Form::Setup::Pages::TenancyStartDate, type: :model do + subject(:page) { described_class.new(page_id, page_definition, subsection) } + + let(:page_id) { nil } + let(:page_definition) { nil } + let(:subsection) { instance_double(Form::Subsection) } + + it "has correct subsection" do + expect(page.subsection).to eq(subsection) + end + + it "has correct questions" do + expect(page.questions.map(&:id)).to eq(%w[startdate]) + end + + it "has the correct id" do + expect(page.id).to eq("tenancy_start_date") + end + + it "has the correct header" do + expect(page.header).to be nil + end + + it "has the correct description" do + expect(page.description).to eq("") + end + + it "has the correct depends_on" do + expect(page.depends_on).to be nil + end + + it "has the correct derived" do + expect(page.derived).to be nil + end +end diff --git a/spec/models/form/setup/pages/tenant_code_spec.rb b/spec/models/form/setup/pages/tenant_code_spec.rb new file mode 100644 index 000000000..d544a4cec --- /dev/null +++ b/spec/models/form/setup/pages/tenant_code_spec.rb @@ -0,0 +1,37 @@ +require "rails_helper" + +RSpec.describe Form::Setup::Pages::TenantCode, type: :model do + subject(:page) { described_class.new(page_id, page_definition, subsection) } + + let(:page_id) { nil } + let(:page_definition) { nil } + let(:subsection) { instance_double(Form::Subsection) } + + it "has correct subsection" do + expect(page.subsection).to eq(subsection) + end + + it "has correct questions" do + expect(page.questions.map(&:id)).to eq(%w[tenant_code]) + end + + it "has the correct id" do + expect(page.id).to eq("tenant_code") + end + + it "has the correct header" do + expect(page.header).to eq("") + end + + it "has the correct description" do + expect(page.description).to eq("") + end + + it "has the correct depends_on" do + expect(page.depends_on).to be nil + end + + it "has the correct derived" do + expect(page.derived).to be nil + end +end diff --git a/spec/models/form/setup/questions/irproduct_other_spec.rb b/spec/models/form/setup/questions/irproduct_other_spec.rb new file mode 100644 index 000000000..4001ebfe3 --- /dev/null +++ b/spec/models/form/setup/questions/irproduct_other_spec.rb @@ -0,0 +1,29 @@ +require "rails_helper" + +RSpec.describe Form::Setup::Questions::IrproductOther, type: :model do + subject(:question) { described_class.new(question_id, question_definition, page) } + + let(:question_id) { nil } + let(:question_definition) { nil } + let(:page) { instance_double(Form::Page) } + + it "has correct page" do + expect(question.page).to eq(page) + end + + it "has the correct id" do + expect(question.id).to eq("irproduct_other") + end + + it "has the correct header" do + expect(question.header).to eq("Name of rent product") + end + + it "has the correct check_answer_label" do + expect(question.check_answer_label).to eq("Product name") + end + + it "has the correct type" do + expect(question.type).to eq("text") + end +end diff --git a/spec/models/form/setup/questions/needs_type_spec.rb b/spec/models/form/setup/questions/needs_type_spec.rb new file mode 100644 index 000000000..feca18481 --- /dev/null +++ b/spec/models/form/setup/questions/needs_type_spec.rb @@ -0,0 +1,36 @@ +require "rails_helper" + +RSpec.describe Form::Setup::Questions::NeedsType, type: :model do + subject(:question) { described_class.new(question_id, question_definition, page) } + + let(:question_id) { nil } + let(:question_definition) { nil } + let(:page) { instance_double(Form::Page) } + + it "has correct page" do + expect(question.page).to eq(page) + end + + it "has the correct id" do + expect(question.id).to eq("needstype") + end + + it "has the correct header" do + expect(question.header).to eq("What is the needs type?") + end + + it "has the correct check_answer_label" do + expect(question.check_answer_label).to eq("Needs type") + end + + it "has the correct type" do + expect(question.type).to eq("radio") + end + + it "has the correct answer_options" do + expect(question.answer_options).to eq({ + "1" => { "value" => "General needs" }, + "2" => { "value" => "Supported housing" }, + }) + end +end diff --git a/spec/models/form/setup/questions/property_reference_spec.rb b/spec/models/form/setup/questions/property_reference_spec.rb new file mode 100644 index 000000000..2cdcb9e2b --- /dev/null +++ b/spec/models/form/setup/questions/property_reference_spec.rb @@ -0,0 +1,37 @@ +require "rails_helper" + +RSpec.describe Form::Setup::Questions::PropertyReference, type: :model do + subject(:question) { described_class.new(question_id, question_definition, page) } + + let(:question_id) { nil } + let(:question_definition) { nil } + let(:page) { instance_double(Form::Page) } + + it "has correct page" do + expect(question.page).to eq(page) + end + + it "has the correct id" do + expect(question.id).to eq("propcode") + end + + it "has the correct header" do + expect(question.header).to eq("What is the property reference?") + end + + it "has the correct check_answer_label" do + expect(question.check_answer_label).to eq("Property reference") + end + + it "has the correct type" do + expect(question.type).to eq("text") + end + + it "has the correct hint_text" do + expect(question.hint_text).to eq("This is how you usually refer to this property on your own systems.") + end + + it "has the correct width" do + expect(question.width).to eq(10) + end +end diff --git a/spec/models/form/setup/questions/renewal_spec.rb b/spec/models/form/setup/questions/renewal_spec.rb new file mode 100644 index 000000000..565d6c768 --- /dev/null +++ b/spec/models/form/setup/questions/renewal_spec.rb @@ -0,0 +1,40 @@ +require "rails_helper" + +RSpec.describe Form::Setup::Questions::Renewal, type: :model do + subject(:question) { described_class.new(question_id, question_definition, page) } + + let(:question_id) { nil } + let(:question_definition) { nil } + let(:page) { instance_double(Form::Page) } + + it "has correct page" do + expect(question.page).to eq(page) + end + + it "has the correct id" do + expect(question.id).to eq("renewal") + end + + it "has the correct header" do + expect(question.header).to eq("Is this letting a renewal?") + end + + it "has the correct check_answer_label" do + expect(question.check_answer_label).to eq("Property renewal") + end + + it "has the correct type" do + expect(question.type).to eq("radio") + end + + it "has the correct hint_text" do + expect(question.hint_text).to eq("") + end + + it "has the correct answer_options" do + expect(question.answer_options).to eq({ + "1" => { "value" => "Yes" }, + "0" => { "value" => "No" }, + }) + end +end diff --git a/spec/models/form/setup/questions/rent_type_spec.rb b/spec/models/form/setup/questions/rent_type_spec.rb new file mode 100644 index 000000000..73dedeb40 --- /dev/null +++ b/spec/models/form/setup/questions/rent_type_spec.rb @@ -0,0 +1,48 @@ +require "rails_helper" + +RSpec.describe Form::Setup::Questions::RentType, type: :model do + subject(:question) { described_class.new(question_id, question_definition, page) } + + let(:question_id) { nil } + let(:question_definition) { nil } + let(:page) { instance_double(Form::Page) } + + it "has correct page" do + expect(question.page).to eq(page) + end + + it "has the correct id" do + expect(question.id).to eq("rent_type") + end + + it "has the correct header" do + expect(question.header).to eq("What is the rent type?") + end + + it "has the correct check_answer_label" do + expect(question.check_answer_label).to eq("Rent type") + end + + it "has the correct type" do + expect(question.type).to eq("radio") + end + + it "has the correct hint_text" do + expect(question.hint_text).to eq("") + end + + it "has the correct conditional_for" do + expect(question.conditional_for).to eq({ "irproduct_other" => [5] }) + end + + it "has the correct answer_options" do + expect(question.answer_options).to eq({ + "1" => { "value" => "Affordable Rent" }, + "2" => { "value" => "London Affordable Rent" }, + "4" => { "value" => "London Living Rent" }, + "3" => { "value" => "Rent to Buy" }, + "0" => { "value" => "Social Rent" }, + "5" => { "value" => "Other intermediate rent product" }, + }) + end +end diff --git a/spec/models/form/setup/questions/tenancy_start_date_spec.rb b/spec/models/form/setup/questions/tenancy_start_date_spec.rb new file mode 100644 index 000000000..c1c861edb --- /dev/null +++ b/spec/models/form/setup/questions/tenancy_start_date_spec.rb @@ -0,0 +1,29 @@ +require "rails_helper" + +RSpec.describe Form::Setup::Questions::TenancyStartDate, type: :model do + subject(:question) { described_class.new(question_id, question_definition, page) } + + let(:question_id) { nil } + let(:question_definition) { nil } + let(:page) { instance_double(Form::Page) } + + it "has correct page" do + expect(question.page).to eq(page) + end + + it "has the correct id" do + expect(question.id).to eq("startdate") + end + + it "has the correct header" do + expect(question.header).to eq("What is the tenancy start date?") + end + + it "has the correct check_answer_label" do + expect(question.check_answer_label).to eq("Tenancy start date") + end + + it "has the correct type" do + expect(question.type).to eq("date") + end +end diff --git a/spec/models/form/setup/questions/tenant_code_spec.rb b/spec/models/form/setup/questions/tenant_code_spec.rb new file mode 100644 index 000000000..3e9538cae --- /dev/null +++ b/spec/models/form/setup/questions/tenant_code_spec.rb @@ -0,0 +1,37 @@ +require "rails_helper" + +RSpec.describe Form::Setup::Questions::TenantCode, type: :model do + subject(:question) { described_class.new(question_id, question_definition, page) } + + let(:question_id) { nil } + let(:question_definition) { nil } + let(:page) { instance_double(Form::Page) } + + it "has correct page" do + expect(question.page).to eq(page) + end + + it "has the correct id" do + expect(question.id).to eq("tenant_code") + end + + it "has the correct header" do + expect(question.header).to eq("What is the tenant code?") + end + + it "has the correct check_answer_label" do + expect(question.check_answer_label).to eq("Tenant code") + end + + it "has the correct type" do + expect(question.type).to eq("text") + end + + it "has the correct hint_text" do + expect(question.hint_text).to eq("This is how you usually refer to this tenancy on your own systems.") + end + + it "has the correct width" do + expect(question.width).to eq(10) + end +end diff --git a/spec/models/form/setup/sections/setup_spec.rb b/spec/models/form/setup/sections/setup_spec.rb new file mode 100644 index 000000000..39843e1ec --- /dev/null +++ b/spec/models/form/setup/sections/setup_spec.rb @@ -0,0 +1,29 @@ +require "rails_helper" + +RSpec.describe Form::Setup::Sections::Setup, type: :model do + subject(:setup) { described_class.new(section_id, section_definition, form) } + + let(:section_id) { nil } + let(:section_definition) { nil } + let(:form) { instance_double(Form) } + + it "has correct form" do + expect(setup.form).to eq(form) + end + + it "has correct subsections" do + expect(setup.subsections.map(&:id)).to eq(%w[setup]) + end + + it "has the correct id" do + expect(setup.id).to eq("setup") + end + + it "has the correct label" do + expect(setup.label).to eq("Before you start") + end + + it "has the correct description" do + expect(setup.description).to eq("") + end +end diff --git a/spec/models/form/setup/subsections/setup_spec.rb b/spec/models/form/setup/subsections/setup_spec.rb new file mode 100644 index 000000000..51cf20e19 --- /dev/null +++ b/spec/models/form/setup/subsections/setup_spec.rb @@ -0,0 +1,25 @@ +require "rails_helper" + +RSpec.describe Form::Setup::Subsections::Setup, type: :model do + subject(:setup) { described_class.new(subsection_id, subsection_definition, section) } + + let(:subsection_id) { nil } + let(:subsection_definition) { nil } + let(:section) { instance_double(Form::Setup::Sections::Setup) } + + it "has correct section" do + expect(setup.section).to eq(section) + end + + it "has correct pages" do + expect(setup.pages.map(&:id)).to eq(%w[needs_type renewal tenancy_start_date rent_type tenant_code property_reference]) + end + + it "has the correct id" do + expect(setup.id).to eq("setup") + end + + it "has the correct label" do + expect(setup.label).to eq("Set up this lettings log") + end +end diff --git a/spec/models/form/subsection_spec.rb b/spec/models/form/subsection_spec.rb index 34b46a282..804292f6c 100644 --- a/spec/models/form/subsection_spec.rb +++ b/spec/models/form/subsection_spec.rb @@ -25,7 +25,7 @@ RSpec.describe Form::Subsection, type: :model do end it "has pages" do - expected_pages = %w[tenancycode person_1_age person_1_gender person_1_working_situation household_number_of_members person_2_working_situation propcode] + expected_pages = %w[tenant_code_test person_1_age person_1_gender person_1_working_situation household_number_of_members person_2_working_situation propcode] expect(subsection.pages.map(&:id)).to eq(expected_pages) end diff --git a/spec/models/form_handler_spec.rb b/spec/models/form_handler_spec.rb index 8f729e553..d84d8751d 100644 --- a/spec/models/form_handler_spec.rb +++ b/spec/models/form_handler_spec.rb @@ -17,7 +17,7 @@ RSpec.describe FormHandler do form_handler = described_class.instance form = form_handler.get_form(test_form_name) expect(form).to be_a(Form) - expect(form.pages.count).to eq(37) + expect(form.pages.count).to eq(40) end end @@ -32,7 +32,7 @@ RSpec.describe FormHandler do it "loads the form once at boot time" do form_handler = described_class.instance - expect(Form).not_to receive(:new).with(:any, test_form_name, :any) + expect(Form).not_to receive(:new).with(:any, test_form_name) expect(form_handler.get_form(test_form_name)).to be_a(Form) end end diff --git a/spec/models/form_spec.rb b/spec/models/form_spec.rb index be3e4ff63..ffcb68f86 100644 --- a/spec/models/form_spec.rb +++ b/spec/models/form_spec.rb @@ -134,6 +134,7 @@ RSpec.describe Form, type: :model do case_log.relat2 = "P" case_log.sex2 = "F" case_log.ecstat2 = 1 + case_log.needstype = 1 end it "returns the first page of the next incomplete subsection if the subsection is not in progress" do diff --git a/spec/models/rent_period_spec.rb b/spec/models/rent_period_spec.rb index 3c5bc2597..55252977a 100644 --- a/spec/models/rent_period_spec.rb +++ b/spec/models/rent_period_spec.rb @@ -2,8 +2,7 @@ require "rails_helper" RSpec.describe RentPeriod, type: :model do describe "rent period mapping" do - let(:setup_path) { "spec/fixtures/forms/setup/log_setup.json" } - let(:form) { Form.new("spec/fixtures/forms/2021_2022.json", "2021_2022", setup_path) } + let(:form) { Form.new("spec/fixtures/forms/2021_2022.json", "2021_2022") } before do allow(FormHandler.instance).to receive(:current_form).and_return(form) diff --git a/spec/requests/case_logs_controller_spec.rb b/spec/requests/case_logs_controller_spec.rb index 6a51d5d74..f9bbeffd9 100644 --- a/spec/requests/case_logs_controller_spec.rb +++ b/spec/requests/case_logs_controller_spec.rb @@ -624,7 +624,7 @@ RSpec.describe CaseLogsController, type: :request do it "displays a section status for a case log" do assert_select ".govuk-tag", text: /Not started/, count: 7 - assert_select ".govuk-tag", text: /In progress/, count: 1 + assert_select ".govuk-tag", text: /In progress/, count: 2 assert_select ".govuk-tag", text: /Completed/, count: 0 assert_select ".govuk-tag", text: /Cannot start yet/, count: 1 end diff --git a/spec/requests/form_controller_spec.rb b/spec/requests/form_controller_spec.rb index fded09217..287d5d349 100644 --- a/spec/requests/form_controller_spec.rb +++ b/spec/requests/form_controller_spec.rb @@ -80,9 +80,9 @@ RSpec.describe FormController, type: :request do let(:case_log_year_2) { FactoryBot.create(:case_log, :about_completed, startdate: Time.zone.local(2022, 5, 1), owning_organisation: organisation) } it "displays the correct question details for each case log based on form year" do - get "/logs/#{case_log_year_1.id}/tenancycode", headers: headers, params: {} + get "/logs/#{case_log_year_1.id}/tenant-code-test", headers: headers, params: {} expect(response.body).to include("What is the tenant code?") - get "/logs/#{case_log_year_2.id}/tenancycode", headers: headers, params: {} + get "/logs/#{case_log_year_2.id}/tenant-code-test", headers: headers, params: {} expect(response.body).to match("Different question header text for this year - 2023") end end diff --git a/spec/services/imports/case_logs_field_import_service_spec.rb b/spec/services/imports/case_logs_field_import_service_spec.rb index a8e84cff9..d3776cb98 100644 --- a/spec/services/imports/case_logs_field_import_service_spec.rb +++ b/spec/services/imports/case_logs_field_import_service_spec.rb @@ -6,8 +6,7 @@ RSpec.describe Imports::CaseLogsFieldImportService do let(:storage_service) { instance_double(StorageService) } let(:logger) { instance_double(ActiveSupport::Logger) } - let(:real_setup_path) { "config/forms/setup/log_setup.json" } - let(:real_2021_2022_form) { Form.new("config/forms/2021_2022.json", "2021_2022", real_setup_path) } + let(:real_2021_2022_form) { Form.new("config/forms/2021_2022.json", "2021_2022") } let(:fixture_directory) { "spec/fixtures/softwire_imports/case_logs" } let(:case_log_id) { "0ead17cb-1668-442d-898c-0d52879ff592" } diff --git a/spec/services/imports/case_logs_import_service_spec.rb b/spec/services/imports/case_logs_import_service_spec.rb index fda123b09..dfe4ceb1b 100644 --- a/spec/services/imports/case_logs_import_service_spec.rb +++ b/spec/services/imports/case_logs_import_service_spec.rb @@ -6,9 +6,8 @@ RSpec.describe Imports::CaseLogsImportService do let(:storage_service) { instance_double(StorageService) } let(:logger) { instance_double(ActiveSupport::Logger) } - let(:real_setup_path) { "config/forms/setup/log_setup.json" } - let(:real_2021_2022_form) { Form.new("config/forms/2021_2022.json", "2021_2022", real_setup_path) } - let(:real_2022_2023_form) { Form.new("config/forms/2022_2023.json", "2022_2023", real_setup_path) } + let(:real_2021_2022_form) { Form.new("config/forms/2021_2022.json", "2021_2022") } + let(:real_2022_2023_form) { Form.new("config/forms/2022_2023.json", "2022_2023") } let(:fixture_directory) { "spec/fixtures/softwire_imports/case_logs" } def open_file(directory, filename) diff --git a/yarn.lock b/yarn.lock index 3e4858f7c..8b6ea28c3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1489,7 +1489,7 @@ braces@^3.0.2, braces@~3.0.2: dependencies: fill-range "^7.0.1" -browserslist@^4.14.5, browserslist@^4.20.2, browserslist@^4.20.3: +browserslist@^4.14.5, browserslist@^4.20.2, browserslist@^4.20.4: version "4.20.4" resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.20.4.tgz#98096c9042af689ee1e0271333dbc564b8ce4477" integrity sha512-ok1d+1WpnU24XYN7oC3QWgTyMhY/avPJ/r9T00xxvUOIparA/gc+UPUMaod3i+G6s+nI2nUb9xZ5k794uIwShw== @@ -2402,12 +2402,7 @@ globjoin@^0.1.4: resolved "https://registry.yarnpkg.com/globjoin/-/globjoin-0.1.4.tgz#2f4494ac8919e3767c5cbb691e9f463324285d43" integrity sha512-xYfnw62CKG8nLkZBfWbhWwDw02CHty86jfPcc2cr3ZfeuK9ysoVPPEUxf21bAD/rWAgk52SuBrLJlefNy8mvFg== -govuk-frontend@4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/govuk-frontend/-/govuk-frontend-4.0.1.tgz#bceff58ecb399272cba32bd2b357fe16198e3249" - integrity sha512-X+B88mqYHoxAz0ID87Uxo3oHqdKBRnNHd3Cz8+u8nvQUAsrEzROFLK+t7sAu7e+fKqCCrJyIgx6Cmr6dIGnohQ== - -govuk-frontend@^4.0.1: +govuk-frontend@4.0.1, govuk-frontend@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/govuk-frontend/-/govuk-frontend-4.0.1.tgz#bceff58ecb399272cba32bd2b357fe16198e3249" integrity sha512-X+B88mqYHoxAz0ID87Uxo3oHqdKBRnNHd3Cz8+u8nvQUAsrEzROFLK+t7sAu7e+fKqCCrJyIgx6Cmr6dIGnohQ==