diff --git a/app/controllers/engagement/cases_controller.rb b/app/controllers/engagement/cases_controller.rb index 56a5383bf..7583e180b 100644 --- a/app/controllers/engagement/cases_controller.rb +++ b/app/controllers/engagement/cases_controller.rb @@ -72,6 +72,8 @@ def form_params :email, :phone_number, :extension_number, + :discovery_method, + :discovery_method_other_text, :category_id, :query_id, :other_category, diff --git a/app/controllers/support/cases/previews_controller.rb b/app/controllers/support/cases/previews_controller.rb index aefa69fb6..a38f8c9d4 100644 --- a/app/controllers/support/cases/previews_controller.rb +++ b/app/controllers/support/cases/previews_controller.rb @@ -28,6 +28,8 @@ def form_params :email, :phone_number, :extension_number, + :discovery_method, + :discovery_method_other_text, :category_id, :query_id, :other_category, diff --git a/app/controllers/support/cases_controller.rb b/app/controllers/support/cases_controller.rb index 916a4a223..4421cf441 100644 --- a/app/controllers/support/cases_controller.rb +++ b/app/controllers/support/cases_controller.rb @@ -104,6 +104,8 @@ def form_params :email, :phone_number, :extension_number, + :discovery_method, + :discovery_method_other_text, :category_id, :query_id, :estimated_procurement_completion_date, diff --git a/app/forms/support/create_case_form.rb b/app/forms/support/create_case_form.rb index 63d74d134..395ebecc0 100644 --- a/app/forms/support/create_case_form.rb +++ b/app/forms/support/create_case_form.rb @@ -17,6 +17,8 @@ class CreateCaseForm option :email, optional: true option :phone_number, optional: true option :extension_number, optional: true + option :discovery_method, optional: true + option :discovery_method_other_text, optional: true option :source, optional: true option :creation_source, optional: true option :procurement_amount, ->(value) { value&.gsub(/[£,]/, "") }, optional: true diff --git a/app/forms/support/create_case_form_schema.rb b/app/forms/support/create_case_form_schema.rb index bcb165f0d..d2bb822fd 100644 --- a/app/forms/support/create_case_form_schema.rb +++ b/app/forms/support/create_case_form_schema.rb @@ -11,6 +11,10 @@ class CreateCaseFormSchema < ::Support::Schema required(:last_name).value(:string) required(:email).value(:string) required(:source).value(:string) + + required(:discovery_method).value(:integer) + required(:discovery_method_other_text).value(:str?) + optional(:organisation_id).value(:string) optional(:organisation_type).value(:string) optional(:organisation_name).value(:string) @@ -60,6 +64,15 @@ class CreateCaseFormSchema < ::Support::Schema key(:source).failure(:missing) if value.blank? end + rule(:discovery_method) do + key.failure(:invalid) if + value < (Support::Case.discovery_methods.values.min) || value > (Support::Case.discovery_methods.values.max) + end + + rule(:discovery_method_other_text) do + key(:discovery_method_other_text).failure(:missing) if value.blank? && values[:discovery_method].eql?(Support::Case.discovery_methods.keys.index("other")) + end + rule(:procurement_amount) do validator = Support::Forms::ValidateProcurementAmount.new(value) key(:procurement_amount).failure(:invalid) if validator.invalid_number? diff --git a/app/models/support/case.rb b/app/models/support/case.rb index bc871c153..3b42fa6b5 100644 --- a/app/models/support/case.rb +++ b/app/models/support/case.rb @@ -81,6 +81,18 @@ class Case < ApplicationRecord # faf - find a framework enum source: { digital: 0, nw_hub: 1, sw_hub: 2, incoming_email: 3, faf: 4, engagement_and_outreach: 5, schools_commercial_team: 6, engagement_and_outreach_cms: 7 } + # Discovery Method + # + # used_before - I've used this service before + # meeting_or_event - Meeting or event + # newsletter - Newsletter + # recommendation - Recommendation + # search_engine - Search engine, such as Google + # social_media - Social media, such as Twitter + # website - Website, such as GOV.UK + # other - Other + enum discovery_method: { used_before: 0, meeting_or_event: 1, newsletter: 2, recommendation: 3, search_engine: 4, social_media: 5, website: 6, other: 7 } + # Creation Source # # default - created by a member of the ProcOps team diff --git a/app/services/support/create_case.rb b/app/services/support/create_case.rb index 3444e1ddd..af163e078 100644 --- a/app/services/support/create_case.rb +++ b/app/services/support/create_case.rb @@ -21,6 +21,8 @@ def call email: @attrs[:email], phone_number: @attrs[:phone_number], extension_number: @attrs[:extension_number], + discovery_method: @attrs[:discovery_method], + discovery_method_other_text: @attrs[:discovery_method_other_text], request_text: @attrs[:request_text], action_required: @attrs.fetch(:action_required, false), procurement_amount: @attrs[:procurement_amount], diff --git a/app/views/engagement/cases/forms/_create_case_form.html.erb b/app/views/engagement/cases/forms/_create_case_form.html.erb index 72b74588e..dc4b582f3 100644 --- a/app/views/engagement/cases/forms/_create_case_form.html.erb +++ b/app/views/engagement/cases/forms/_create_case_form.html.erb @@ -33,6 +33,8 @@ <%= form.govuk_phone_field :phone_number, label: { text: I18n.t("support.case_hub_migration.label.phone_number", optional: I18n.t("support.generic.form.optional")) } %> <%= form.govuk_phone_field :extension_number, label: { text: I18n.t("support.case_hub_migration.label.extension_number", optional: I18n.t("support.generic.form.optional")) } %> + <%= render "support/cases/discovery_method/discovery_method", form: form %> + <%= render "support/cases/request_details/form_fields", form: form, show_request_text: false %> <%= form.govuk_text_field :procurement_amount, width: 5, diff --git a/app/views/engagement/cases/previews/new.html.erb b/app/views/engagement/cases/previews/new.html.erb index 56d0da2b9..0e3721544 100644 --- a/app/views/engagement/cases/previews/new.html.erb +++ b/app/views/engagement/cases/previews/new.html.erb @@ -117,6 +117,26 @@ + +

+ <%= I18n.t("support.case.label.discovery_method.legend") %> +

+ +
+
+
+ <%= I18n.t("support.case.label.discovery_method.field") %> +
+
+ <%= I18n.t("support.case.label.discovery_method.#{Support::Case::discovery_methods.keys[@form.discovery_method]}") %> + <%= if @form.discovery_method == Support::Case::discovery_methods[:other] && !@form.discovery_method_other_text.empty? then "- #{@form.discovery_method_other_text}" end %> +
+
+ <%= form.button I18n.t("generic.button.change_answer"), class: "govuk-link", value: "change" %> +
+
+
+

<%= I18n.t("support.case_hub_migration.edit.section.case") %> @@ -163,21 +183,6 @@ <% end %> -

- <%= I18n.t("support.case_hub_migration.edit.section.source") %> -

- -
-
-
- <%= I18n.t("support.case_hub_migration.label.case_source") %> -
-
- <%= I18n.t("support.case.label.source.#{@form.source}") %> -
-
-
-

<%= I18n.t("support.case_hub_migration.edit.section.request_text") %>

diff --git a/app/views/support/cases/discovery_method/_discovery_method.html.erb b/app/views/support/cases/discovery_method/_discovery_method.html.erb new file mode 100644 index 000000000..72eb8f16b --- /dev/null +++ b/app/views/support/cases/discovery_method/_discovery_method.html.erb @@ -0,0 +1,17 @@ +<%= form.govuk_radio_buttons_fieldset :discovery_method, class: "discovery-method-radios", legend: { size: 'm', text: I18n.t("support.case.label.discovery_method.legend") } do %> + + <%= form.govuk_radio_button :discovery_method, '0', label: { text: I18n.t("support.case.label.discovery_method.used_before") }, link_errors: true %> + <%= form.govuk_radio_button :discovery_method, '1', label: { text: I18n.t("support.case.label.discovery_method.meeting_or_event") } %> + <%= form.govuk_radio_button :discovery_method, '2', label: { text: I18n.t("support.case.label.discovery_method.newsletter") } %> + <%= form.govuk_radio_button :discovery_method, '3', label: { text: I18n.t("support.case.label.discovery_method.recommendation") } %> + <%= form.govuk_radio_button :discovery_method, '4', label: { text: I18n.t("support.case.label.discovery_method.search_engine") } %> + <%= form.govuk_radio_button :discovery_method, '5', label: { text: I18n.t("support.case.label.discovery_method.social_media") } %> + <%= form.govuk_radio_button :discovery_method, '6', label: { text: I18n.t("support.case.label.discovery_method.website") } %> + <%= form.govuk_radio_button :discovery_method, '7', label: { text: I18n.t("support.case.label.discovery_method.other") } do %> + <%= form.govuk_text_field :discovery_method_other_text, + id: "discovery_method_other_text", + label: { text: I18n.t("support.case.label.discovery_method.other_text_field") }, + link_errors: true + %> + <% end %> +<% end %> diff --git a/app/views/support/cases/forms/_create_case_form.html.erb b/app/views/support/cases/forms/_create_case_form.html.erb index d4e763245..5f6adfd6b 100644 --- a/app/views/support/cases/forms/_create_case_form.html.erb +++ b/app/views/support/cases/forms/_create_case_form.html.erb @@ -42,6 +42,8 @@ label: { text: I18n.t("support.case_hub_migration.label.extension_number", optional: I18n.t("support.generic.form.optional")) } %> + <%= render "support/cases/discovery_method/discovery_method", form: form %> + <%= render "support/cases/request_details/form_fields", form: form, show_request_text: false %> <%= form.govuk_text_field :procurement_amount, width: 5, @@ -55,8 +57,6 @@ <%= form.govuk_select(:source, [ ["Please select", ""], - [I18n.t("support.case.label.source.nw_hub"), "nw_hub"], - [I18n.t("support.case.label.source.sw_hub"), "sw_hub"], [I18n.t("support.case.label.source.engagement_and_outreach"), "engagement_and_outreach"], [I18n.t("support.case.label.source.schools_commercial_team"), "schools_commercial_team"] ], diff --git a/app/views/support/cases/previews/new.html.erb b/app/views/support/cases/previews/new.html.erb index 65eab561a..f0fe24071 100644 --- a/app/views/support/cases/previews/new.html.erb +++ b/app/views/support/cases/previews/new.html.erb @@ -118,6 +118,44 @@ + +

+ <%= I18n.t("support.case.label.discovery_method.legend") %> +

+ +
+
+
+ <%= I18n.t("support.case.label.discovery_method.field") %> +
+
+ <%= I18n.t("support.case.label.discovery_method.#{Support::Case::discovery_methods.keys[@form.discovery_method]}") %> + <%= if @form.discovery_method == Support::Case::discovery_methods[:other] && !@form.discovery_method_other_text.empty? then "- #{@form.discovery_method_other_text}" end %> +
+
+ <%= form.button I18n.t("generic.button.change_answer"), class: "govuk-link", value: "change" %> +
+
+
+ +

+ <%= I18n.t("support.case_hub_migration.edit.section.source") %> +

+ +
+
+
+ <%= I18n.t("support.case_hub_migration.label.case_source") %> +
+
+ <%= I18n.t("support.case.label.source.#{@form.source}") %> +
+
+ <%= form.button I18n.t("generic.button.change_answer"), class: "govuk-link", value: "change" %> +
+
+
+

<%= I18n.t("support.case_hub_migration.edit.section.case") %> @@ -163,25 +201,7 @@ <% end %> - -

- <%= I18n.t("support.case_hub_migration.edit.section.source") %> -

- -
-
-
- <%= I18n.t("support.case_hub_migration.label.case_source") %> -
-
- <%= I18n.t("support.case.label.source.#{@form.source}") %> -
-
- <%= form.button I18n.t("generic.button.change_answer"), class: "govuk-link", value: "change" %> -
-
-
- +

<%= I18n.t("support.case_hub_migration.edit.section.request_text") %>

diff --git a/app/views/support/cases/show/_case_details.html.erb b/app/views/support/cases/show/_case_details.html.erb index d7bf6074e..a61c26b4e 100644 --- a/app/views/support/cases/show/_case_details.html.erb +++ b/app/views/support/cases/show/_case_details.html.erb @@ -57,6 +57,21 @@
+
+
+ <%= I18n.t("support.case.label.discovery_method.field") %> +
+
+ <% if current_case.discovery_method.present? %> + <%= I18n.t("support.case.label.discovery_method.#{current_case.discovery_method}") %> + <%= if current_case.other? && !current_case.discovery_method_other_text.empty? then "- #{current_case.discovery_method_other_text}" end %> + <% else %> + <%= "Unknown" %> + <% end %> +
+
+
+
<%= I18n.t("support.case.label.source.header") %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 457f011c6..1854c33d5 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -955,6 +955,19 @@ en: schools_commercial_team: Schools Commercial Team (SCT) sw_hub: South West (SW) Hub unspecified: "-" + discovery_method: + legend: Case origin + field: Origin + please_select: Please select + other_text_field: Please specify origin + used_before: Used this service before + meeting_or_event: Meeting or event + newsletter: Newsletter + recommendation: Recommendation + search_engine: Search engine, such as Google + social_media: Social media, such as Twitter + website: Website, such as GOV.UK + other: Other special_requirements: Accessibility stage: Stage state: diff --git a/config/locales/validation/support/en.yml b/config/locales/validation/support/en.yml index 672892e8f..aa239b586 100644 --- a/config/locales/validation/support/en.yml +++ b/config/locales/validation/support/en.yml @@ -117,6 +117,8 @@ en: last_name: "" # Omitted email: "" # Omitted phone_number: Phone number + discovery_method: Case origin # Omitted + discovery_method_other_text: "" # Omitted estimated_procurement_completion_date: Estimated procurement date organisation_id: "" # Omitted organisation_name: "" # Omitted @@ -148,6 +150,12 @@ en: # value in schema set to 13 as includes the + in +44 max_size?: "can not have more than 12 digits" + discovery_method: + missing: Select how you heard about this service + invalid: unknown selection + discovery_method_other_text: + missing: Explain how you heard about this service + estimated_procurement_completion_date: format?: must follow the format of DD/MM/YYYY category_id: diff --git a/db/migrate/20230906141522_add_discovery_method_to_case.rb b/db/migrate/20230906141522_add_discovery_method_to_case.rb new file mode 100644 index 000000000..2cf1343cb --- /dev/null +++ b/db/migrate/20230906141522_add_discovery_method_to_case.rb @@ -0,0 +1,8 @@ +class AddDiscoveryMethodToCase < ActiveRecord::Migration[7.0] + def change + change_table :support_cases, bulk: true do |t| + t.integer :discovery_method + t.string :discovery_method_other_text + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 357797a2a..e2fdf998a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -12,7 +12,6 @@ ActiveRecord::Schema[7.0].define(version: 2023_09_19_092926) do # These are extensions that must be enabled in order to support this database - enable_extension "citext" enable_extension "pg_trgm" enable_extension "pgcrypto" enable_extension "plpgsql" @@ -84,8 +83,8 @@ t.datetime "updated_at", null: false t.boolean "accessibility_research_opt_in" t.string "accessibility_research_email" - t.datetime "survey_sent_at", precision: nil - t.datetime "survey_completed_at", precision: nil + t.datetime "survey_sent_at" + t.datetime "survey_completed_at" t.index ["case_id"], name: "index_all_cases_survey_responses_on_case_id" end @@ -159,8 +158,8 @@ t.integer "status" t.string "user_ip" t.datetime "survey_started_at" - t.datetime "survey_sent_at", precision: nil - t.datetime "survey_completed_at", precision: nil + t.datetime "survey_sent_at" + t.datetime "survey_completed_at" t.index ["case_id"], name: "index_exit_survey_responses_on_case_id" end @@ -307,8 +306,8 @@ t.string "title" t.text "body" t.string "slug" - t.datetime "created_at", precision: nil, default: -> { "CURRENT_TIMESTAMP" }, null: false - t.datetime "updated_at", precision: nil, default: -> { "CURRENT_TIMESTAMP" }, null: false + t.datetime "created_at", default: -> { "CURRENT_TIMESTAMP" }, null: false + t.datetime "updated_at", default: -> { "CURRENT_TIMESTAMP" }, null: false t.string "contentful_id" t.text "sidebar" t.string "breadcrumbs", default: [], array: true @@ -481,6 +480,8 @@ t.boolean "with_school", default: false, null: false t.date "next_key_date" t.string "next_key_date_description" + t.integer "discovery_method" + t.string "discovery_method_other_text" t.index ["category_id"], name: "index_support_cases_on_category_id" t.index ["existing_contract_id"], name: "index_support_cases_on_existing_contract_id" t.index ["new_contract_id"], name: "index_support_cases_on_new_contract_id" @@ -725,7 +726,7 @@ t.string "ukprn" t.string "telephone_number" t.jsonb "local_authority" - t.datetime "opened_date", precision: nil + t.datetime "opened_date" t.string "number" t.string "rsc_region" t.string "trust_name" @@ -907,6 +908,48 @@ add_foreign_key "user_journeys", "framework_requests" add_foreign_key "user_journeys", "support_cases", column: "case_id" + create_view "support_establishment_searches", sql_definition: <<-SQL + SELECT organisations.id, + organisations.name, + (organisations.address ->> 'postcode'::text) AS postcode, + organisations.urn, + organisations.ukprn, + etypes.name AS establishment_type, + 'Support::Organisation'::text AS source + FROM (support_organisations organisations + JOIN support_establishment_types etypes ON ((etypes.id = organisations.establishment_type_id))) + WHERE (organisations.status <> 2) + UNION ALL + SELECT egroups.id, + egroups.name, + (egroups.address ->> 'postcode'::text) AS postcode, + NULL::character varying AS urn, + egroups.ukprn, + egtypes.name AS establishment_type, + 'Support::EstablishmentGroup'::text AS source + FROM (support_establishment_groups egroups + JOIN support_establishment_group_types egtypes ON ((egtypes.id = egroups.establishment_group_type_id))) + WHERE (egroups.status <> 2); + SQL + create_view "support_case_searches", sql_definition: <<-SQL + SELECT sc.id AS case_id, + sc.ref AS case_ref, + sc.created_at, + sc.updated_at, + sc.state AS case_state, + sc.email, + ses.name AS organisation_name, + ses.urn AS organisation_urn, + ses.ukprn AS organisation_ukprn, + (((sa.first_name)::text || ' '::text) || (sa.last_name)::text) AS agent_name, + sa.first_name AS agent_first_name, + sa.last_name AS agent_last_name, + cat.title AS category_title + FROM (((support_cases sc + LEFT JOIN support_agents sa ON ((sa.id = sc.agent_id))) + LEFT JOIN support_establishment_searches ses ON (((sc.organisation_id = ses.id) AND ((sc.organisation_type)::text = ses.source)))) + LEFT JOIN support_categories cat ON ((sc.category_id = cat.id))); + SQL create_view "support_case_data", sql_definition: <<-SQL SELECT sc.id AS case_id, sc.ref AS case_ref, @@ -1009,48 +1052,6 @@ FROM support_interactions si_1 WHERE (si_1.event_type = 8)) sir ON ((si.case_id = sir.case_id))); SQL - create_view "support_establishment_searches", sql_definition: <<-SQL - SELECT organisations.id, - organisations.name, - (organisations.address ->> 'postcode'::text) AS postcode, - organisations.urn, - organisations.ukprn, - etypes.name AS establishment_type, - 'Support::Organisation'::text AS source - FROM (support_organisations organisations - JOIN support_establishment_types etypes ON ((etypes.id = organisations.establishment_type_id))) - WHERE (organisations.status <> 2) - UNION ALL - SELECT egroups.id, - egroups.name, - (egroups.address ->> 'postcode'::text) AS postcode, - NULL::character varying AS urn, - egroups.ukprn, - egtypes.name AS establishment_type, - 'Support::EstablishmentGroup'::text AS source - FROM (support_establishment_groups egroups - JOIN support_establishment_group_types egtypes ON ((egtypes.id = egroups.establishment_group_type_id))) - WHERE (egroups.status <> 2); - SQL - create_view "support_case_searches", sql_definition: <<-SQL - SELECT sc.id AS case_id, - sc.ref AS case_ref, - sc.created_at, - sc.updated_at, - sc.state AS case_state, - sc.email, - ses.name AS organisation_name, - ses.urn AS organisation_urn, - ses.ukprn AS organisation_ukprn, - (((sa.first_name)::text || ' '::text) || (sa.last_name)::text) AS agent_name, - sa.first_name AS agent_first_name, - sa.last_name AS agent_last_name, - cat.title AS category_title - FROM (((support_cases sc - LEFT JOIN support_agents sa ON ((sa.id = sc.agent_id))) - LEFT JOIN support_establishment_searches ses ON (((sc.organisation_id = ses.id) AND ((sc.organisation_type)::text = ses.source)))) - LEFT JOIN support_categories cat ON ((sc.category_id = cat.id))); - SQL create_view "support_message_threads", sql_definition: <<-SQL SELECT DISTINCT ON (se.outlook_conversation_id, se.case_id) se.outlook_conversation_id AS conversation_id, se.case_id, diff --git a/spec/features/engagement/create_case_spec.rb b/spec/features/engagement/create_case_spec.rb index 57e581572..10e12054f 100644 --- a/spec/features/engagement/create_case_spec.rb +++ b/spec/features/engagement/create_case_spec.rb @@ -99,6 +99,7 @@ def valid_form_data_without_organisation fill_in "create_case_form[last_name]", with: "last_name" fill_in "create_case_form[email]", with: "test@example.com" fill_in "create_case_form[phone_number]", with: "0778974653" + choose "Newsletter" # case origin choose "Procurement" # request type select "Other (General)", from: "select_request_details_category_id" find("#request_details_other_category_text").set("Other Category Details") diff --git a/spec/features/support/case_summary_spec.rb b/spec/features/support/case_summary_spec.rb index 7a489e350..ae3fa22b4 100644 --- a/spec/features/support/case_summary_spec.rb +++ b/spec/features/support/case_summary_spec.rb @@ -9,7 +9,7 @@ context "when value and support level have been set to nil" do let(:support_case) { create(:support_case, :with_fixed_category, :opened, value: nil, support_level: nil) } - it "shows hypens" do + it "shows hyphens" do within("div#case-details") do expect(all("dt.govuk-summary-list__key")[0]).to have_text "Sub-category" expect(all("dd.govuk-summary-list__value")[0]).to have_text "Fixed Category" @@ -17,14 +17,16 @@ expect(all("dd.govuk-summary-list__value")[1]).to have_text "Not specified" expect(all("dt.govuk-summary-list__key")[2]).to have_text "Case value" expect(all("dd.govuk-summary-list__value")[2]).to have_text "Not specified" - expect(all("dt.govuk-summary-list__key")[3]).to have_text "Source" - expect(all("dd.govuk-summary-list__value")[3]).to have_text "-" + expect(all("dt.govuk-summary-list__key")[3]).to have_text "Origin" + expect(all("dd.govuk-summary-list__value")[3]).to have_text "Unknown" + expect(all("dt.govuk-summary-list__key")[4]).to have_text "Source" + expect(all("dd.govuk-summary-list__value")[4]).to have_text "-" end end end context "when value and support levels have been populated" do - let(:support_case) { create(:support_case, :with_fixed_category, :opened, value: 123.32, support_level: "L2", source: :incoming_email) } + let(:support_case) { create(:support_case, :with_fixed_category, :opened, value: 123.32, support_level: "L2", source: :incoming_email, discovery_method: :newsletter) } it "shows fields with details" do within("div#case-details") do @@ -34,8 +36,10 @@ expect(all("dd.govuk-summary-list__value")[1]).to have_text "2 - Specific advice" expect(all("dt.govuk-summary-list__key")[2]).to have_text "Case value" expect(all("dd.govuk-summary-list__value")[2]).to have_text "£123.32" - expect(all("dt.govuk-summary-list__key")[3]).to have_text "Source" - expect(all("dd.govuk-summary-list__value")[3]).to have_text "Email" + expect(all("dt.govuk-summary-list__key")[3]).to have_text "Origin" + expect(all("dd.govuk-summary-list__value")[3]).to have_text "Newsletter" + expect(all("dt.govuk-summary-list__key")[4]).to have_text "Source" + expect(all("dd.govuk-summary-list__value")[4]).to have_text "Email" end end end diff --git a/spec/features/support/case_tabs_spec.rb b/spec/features/support/case_tabs_spec.rb index 96a3e9c6f..c324d2cdd 100644 --- a/spec/features/support/case_tabs_spec.rb +++ b/spec/features/support/case_tabs_spec.rb @@ -43,9 +43,10 @@ expect(all(".govuk-summary-list__row")[0]).to have_text "Sub-category" expect(all(".govuk-summary-list__row")[1]).to have_text "Case level" expect(all(".govuk-summary-list__row")[2]).to have_text "Case value" - expect(all(".govuk-summary-list__row")[3]).to have_text "Source" - expect(all(".govuk-summary-list__row")[4]).to have_text "Description of query" - expect(all(".govuk-summary-list__row")[5]).to have_text "Next key date and description" + expect(all(".govuk-summary-list__row")[3]).to have_text "Origin" + expect(all(".govuk-summary-list__row")[4]).to have_text "Source" + expect(all(".govuk-summary-list__row")[5]).to have_text "Description of query" + expect(all(".govuk-summary-list__row")[6]).to have_text "Next key date and description" end end diff --git a/spec/features/support/create_case_spec.rb b/spec/features/support/create_case_spec.rb index d6529bb6d..a91dea6e5 100644 --- a/spec/features/support/create_case_spec.rb +++ b/spec/features/support/create_case_spec.rb @@ -84,10 +84,11 @@ def valid_form_data_without_organisation fill_in "create_case_form[last_name]", with: "last_name" fill_in "create_case_form[email]", with: "test@example.com" fill_in "create_case_form[phone_number]", with: "0778974653" + choose "Newsletter" # case origin choose "Procurement" # request type select "Other (General)", from: "select_request_details_category_id" find("#request_details_other_category_text").set("Other Category Details") - select "North West (NW) Hub", from: "create_case_form[source]" + select "Schools Commercial Team (SCT)", from: "create_case_form[source]" fill_in "create_case_form[request_text]", with: "This is a request" fill_in "create_case_form[procurement_amount]", with: "45.22" end diff --git a/spec/models/support/case_spec.rb b/spec/models/support/case_spec.rb index 7f85a232e..f77d59644 100644 --- a/spec/models/support/case_spec.rb +++ b/spec/models/support/case_spec.rb @@ -59,7 +59,7 @@ describe "#to_csv" do it "includes headers" do expect(described_class.to_csv).to eql( - "id,ref,category_id,request_text,support_level,status,state,created_at,updated_at,agent_id,first_name,last_name,email,phone_number,source,organisation_id,existing_contract_id,new_contract_id,procurement_id,savings_status,savings_estimate_method,savings_actual_method,savings_estimate,savings_actual,action_required,organisation_type,value,closure_reason,extension_number,other_category,other_query,procurement_amount,confidence_level,special_requirements,query_id,exit_survey_sent,detected_category_id,creation_source,user_selected_category,created_by_id,procurement_stage_id,initial_request_text,with_school,next_key_date,next_key_date_description\n", + "id,ref,category_id,request_text,support_level,status,state,created_at,updated_at,agent_id,first_name,last_name,email,phone_number,source,organisation_id,existing_contract_id,new_contract_id,procurement_id,savings_status,savings_estimate_method,savings_actual_method,savings_estimate,savings_actual,action_required,organisation_type,value,closure_reason,extension_number,other_category,other_query,procurement_amount,confidence_level,special_requirements,query_id,exit_survey_sent,detected_category_id,creation_source,user_selected_category,created_by_id,procurement_stage_id,initial_request_text,with_school,next_key_date,next_key_date_description,discovery_method,discovery_method_other_text\n", ) end end