<% if @worldpay_form.errors.any? %>
diff --git a/app/views/waste_carriers_engine/your_tier_forms/new.html.erb b/app/views/waste_carriers_engine/your_tier_forms/new.html.erb
index 9ebc043e2..f6455b8de 100644
--- a/app/views/waste_carriers_engine/your_tier_forms/new.html.erb
+++ b/app/views/waste_carriers_engine/your_tier_forms/new.html.erb
@@ -1,5 +1,5 @@
<% content_for :title, t(".heading.#{@transient_registration.tier}").html_safe %>
-<%= render("waste_carriers_engine/shared/back", back_path: back_your_tier_forms_path(@your_tier_form.token)) %>
+<%= render("waste_carriers_engine/shared/back", token: @your_tier_form.token) %>
From a7724ece82f2a39eb7773f57c5d73b9a014db34d Mon Sep 17 00:00:00 2001
From: PaulDoyle-DEFRA <97455399+PaulDoyle-DEFRA@users.noreply.github.com>
Date: Wed, 1 Jun 2022 14:24:11 +0100
Subject: [PATCH 07/10] Add go_back route and remove bespoke form-specific back
routes
---
config/routes.rb | 264 +++++++----------------------------------------
1 file changed, 36 insertions(+), 228 deletions(-)
diff --git a/config/routes.rb b/config/routes.rb
index 38b6d099f..4097913d8 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -17,12 +17,7 @@
resources :renew_registration_forms,
only: %i[new create],
path: "renew-registration",
- path_names: { new: "" } do
- get "back",
- to: "renew_registration_forms#go_back",
- as: "back",
- on: :collection
- end
+ path_names: { new: "" }
resources :your_tier_forms,
only: %i[new create],
@@ -37,12 +32,7 @@
resources :check_your_tier_forms,
only: %i[new create],
path: "check-your-tier",
- path_names: { new: "" } do
- get "back",
- to: "check_your_tier_forms#go_back",
- as: "back",
- on: :collection
- end
+ path_names: { new: "" }
resources :registration_received_pending_payment_forms,
only: :new,
@@ -84,12 +74,7 @@
resources :copy_cards_bank_transfer_forms,
only: %i[new create],
path: "order-copy-cards-bank-transfer",
- path_names: { new: "" } do
- get "back",
- to: "copy_cards_bank_transfer_forms#go_back",
- as: "back",
- on: :collection
- end
+ path_names: { new: "" }
resources :copy_cards_order_completed_forms,
only: %i[new create],
@@ -183,12 +168,7 @@
resources :edit_bank_transfer_forms,
only: %i[new create],
path: "edit-bank-transfer",
- path_names: { new: "" } do
- get "back",
- to: "edit_bank_transfer_forms#go_back",
- as: "back",
- on: :collection
- end
+ path_names: { new: "" }
resources :edit_complete_forms,
only: %i[new create],
@@ -198,12 +178,7 @@
resources :confirm_edit_cancelled_forms,
only: %i[new create],
path: "confirm-edit-cancelled",
- path_names: { new: "" } do
- get "back",
- to: "confirm_edit_cancelled_forms#go_back",
- as: "back",
- on: :collection
- end
+ path_names: { new: "" }
resources :edit_cancelled_forms,
only: %i[new create],
@@ -219,162 +194,82 @@
resources :location_forms,
only: %i[new create],
path: "location",
- path_names: { new: "" } do
- get "back",
- to: "location_forms#go_back",
- as: "back",
- on: :collection
- end
+ path_names: { new: "" }
resources :register_in_northern_ireland_forms,
only: %i[new create],
path: "register-in-northern-ireland",
- path_names: { new: "" } do
- get "back",
- to: "register_in_northern_ireland_forms#go_back",
- as: "back",
- on: :collection
- end
+ path_names: { new: "" }
resources :register_in_scotland_forms,
only: %i[new create],
path: "register-in-scotland",
- path_names: { new: "" } do
- get "back",
- to: "register_in_scotland_forms#go_back",
- as: "back",
- on: :collection
- end
+ path_names: { new: "" }
resources :register_in_wales_forms,
only: %i[new create],
path: "register-in-wales",
- path_names: { new: "" } do
- get "back",
- to: "register_in_wales_forms#go_back",
- as: "back",
- on: :collection
- end
+ path_names: { new: "" }
resources :business_type_forms,
only: %i[new create],
path: "business-type",
- path_names: { new: "" } do
- get "back",
- to: "business_type_forms#go_back",
- as: "back",
- on: :collection
- end
+ path_names: { new: "" }
resources :other_businesses_forms,
only: %i[new create],
path: "other-businesses",
- path_names: { new: "" } do
- get "back",
- to: "other_businesses_forms#go_back",
- as: "back",
- on: :collection
- end
+ path_names: { new: "" }
resources :service_provided_forms,
only: %i[new create],
path: "service-provided",
- path_names: { new: "" } do
- get "back",
- to: "service_provided_forms#go_back",
- as: "back",
- on: :collection
- end
+ path_names: { new: "" }
resources :construction_demolition_forms,
only: %i[new create],
path: "construction-demolition",
- path_names: { new: "" } do
- get "back",
- to: "construction_demolition_forms#go_back",
- as: "back",
- on: :collection
- end
+ path_names: { new: "" }
resources :waste_types_forms,
only: %i[new create],
path: "waste-types",
- path_names: { new: "" } do
- get "back",
- to: "waste_types_forms#go_back",
- as: "back",
- on: :collection
- end
+ path_names: { new: "" }
resources :cbd_type_forms,
only: %i[new create],
path: "cbd-type",
- path_names: { new: "" } do
- get "back",
- to: "cbd_type_forms#go_back",
- as: "back",
- on: :collection
- end
+ path_names: { new: "" }
resources :renewal_information_forms,
only: %i[new create],
path: "renewal-information",
- path_names: { new: "" } do
- get "back",
- to: "renewal_information_forms#go_back",
- as: "back",
- on: :collection
- end
+ path_names: { new: "" }
resources :registration_number_forms,
only: %i[new create],
path: "registration-number",
- path_names: { new: "" } do
- get "back",
- to: "registration_number_forms#go_back",
- as: "back",
- on: :collection
- end
+ path_names: { new: "" }
resources :check_registered_company_name_forms,
only: %i[new create],
path: "check-registered-company-name",
- path_names: { new: "" } do
- get "back",
- to: "check_registered_company_name_forms#go_back",
- as: "back",
- on: :collection
- end
+ path_names: { new: "" }
resources :incorrect_company_forms,
only: %i[new create],
path: "incorrect-company",
- path_names: { new: "" } do
- get "back",
- to: "incorrect_company_forms#go_back",
- as: "back",
- on: :collection
- end
+ path_names: { new: "" }
resources :company_name_forms,
only: %i[new create],
path: "company-name",
- path_names: { new: "" } do
- get "back",
- to: "company_name_forms#go_back",
- as: "back",
- on: :collection
- end
+ path_names: { new: "" }
resources :company_postcode_forms,
only: %i[new create],
path: "company-postcode",
path_names: { new: "" } do
- get "back",
- to: "company_postcode_forms#go_back",
- as: "back",
- on: :collection
-
get "skip_to_manual_address",
to: "company_postcode_forms#skip_to_manual_address",
as: "skip_to_manual_address",
@@ -385,11 +280,6 @@
only: %i[new create],
path: "company-address",
path_names: { new: "" } do
- get "back",
- to: "company_address_forms#go_back",
- as: "back",
- on: :collection
-
get "skip_to_manual_address",
to: "company_address_forms#skip_to_manual_address",
as: "skip_to_manual_address",
@@ -399,22 +289,12 @@
resources :company_address_manual_forms,
only: %i[new create],
path: "company-address-manual",
- path_names: { new: "" } do
- get "back",
- to: "company_address_manual_forms#go_back",
- as: "back",
- on: :collection
- end
+ path_names: { new: "" }
resources :main_people_forms,
only: %i[new create],
path: "main-people",
path_names: { new: "" } do
- get "back",
- to: "main_people_forms#go_back",
- as: "back",
- on: :collection
-
delete "delete_person/:id",
to: "main_people_forms#delete_person",
as: "delete_person",
@@ -424,22 +304,12 @@
resources :declare_convictions_forms,
only: %i[new create],
path: "declare-convictions",
- path_names: { new: "" } do
- get "back",
- to: "declare_convictions_forms#go_back",
- as: "back",
- on: :collection
- end
+ path_names: { new: "" }
resources :conviction_details_forms,
only: %i[new create],
path: "conviction-details",
path_names: { new: "" } do
- get "back",
- to: "conviction_details_forms#go_back",
- as: "back",
- on: :collection
-
delete "delete_person/:id",
to: "conviction_details_forms#delete_person",
as: "delete_person",
@@ -449,42 +319,22 @@
resources :contact_name_forms,
only: %i[new create],
path: "contact-name",
- path_names: { new: "" } do
- get "back",
- to: "contact_name_forms#go_back",
- as: "back",
- on: :collection
- end
+ path_names: { new: "" }
resources :contact_phone_forms,
only: %i[new create],
path: "contact-phone",
- path_names: { new: "" } do
- get "back",
- to: "contact_phone_forms#go_back",
- as: "back",
- on: :collection
- end
+ path_names: { new: "" }
resources :contact_email_forms,
only: %i[new create],
path: "contact-email",
- path_names: { new: "" } do
- get "back",
- to: "contact_email_forms#go_back",
- as: "back",
- on: :collection
- end
+ path_names: { new: "" }
resources :contact_postcode_forms,
only: %i[new create],
path: "contact-postcode",
path_names: { new: "" } do
- get "back",
- to: "contact_postcode_forms#go_back",
- as: "back",
- on: :collection
-
get "skip_to_manual_address",
to: "contact_postcode_forms#skip_to_manual_address",
as: "skip_to_manual_address",
@@ -495,11 +345,6 @@
only: %i[new create],
path: "contact-address",
path_names: { new: "" } do
- get "back",
- to: "contact_address_forms#go_back",
- as: "back",
- on: :collection
-
get "skip_to_manual_address",
to: "contact_address_forms#skip_to_manual_address",
as: "skip_to_manual_address",
@@ -509,62 +354,32 @@
resources :contact_address_manual_forms,
only: %i[new create],
path: "contact-address-manual",
- path_names: { new: "" } do
- get "back",
- to: "contact_address_manual_forms#go_back",
- as: "back",
- on: :collection
- end
+ path_names: { new: "" }
resources :contact_address_reuse_forms,
only: %i[new create],
path: "contact-address-reuse",
- path_names: { new: "" } do
- get "back",
- to: "contact_address_reuse_forms#go_back",
- as: "back",
- on: :collection
- end
+ path_names: { new: "" }
resources :check_your_answers_forms,
only: %i[new create],
path: "check-your-answers",
- path_names: { new: "" } do
- get "back",
- to: "check_your_answers_forms#go_back",
- as: "back",
- on: :collection
- end
+ path_names: { new: "" }
resources :declaration_forms,
only: %i[new create],
path: "declaration",
- path_names: { new: "" } do
- get "back",
- to: "declaration_forms#go_back",
- as: "back",
- on: :collection
- end
+ path_names: { new: "" }
resources :cards_forms,
only: %i[new create],
path: "cards",
- path_names: { new: "" } do
- get "back",
- to: "cards_forms#go_back",
- as: "back",
- on: :collection
- end
+ path_names: { new: "" }
resources :payment_summary_forms,
only: %i[new create],
path: "payment-summary",
- path_names: { new: "" } do
- get "back",
- to: "payment_summary_forms#go_back",
- as: "back",
- on: :collection
- end
+ path_names: { new: "" }
resources :worldpay_forms,
only: %i[new create],
@@ -599,12 +414,7 @@
resources :confirm_bank_transfer_forms,
only: %i[new create],
path: "confirm-bank-transfer",
- path_names: { new: "" } do
- get "back",
- to: "confirm_bank_transfer_forms#go_back",
- as: "back",
- on: :collection
- end
+ path_names: { new: "" }
resources :renewal_complete_forms,
only: %i[new create],
@@ -629,12 +439,10 @@
resources :cannot_renew_type_change_forms,
only: %i[new create],
path: "cannot-renew-type-change",
- path_names: { new: "" } do
- get "back",
- to: "cannot_renew_type_change_forms#go_back",
- as: "back",
- on: :collection
- end
+ path_names: { new: "" }
+
+ get "/back", to: "forms#go_back", as: "go_back_forms"
+
end
mount DefraRubyEmail::Engine => "/email"
From b809f57f2037a575dbb934fd1143be78d5f9cc32 Mon Sep 17 00:00:00 2001
From: PaulDoyle-DEFRA <97455399+PaulDoyle-DEFRA@users.noreply.github.com>
Date: Wed, 1 Jun 2022 14:24:45 +0100
Subject: [PATCH 08/10] New form back-navigation request specs
---
.../transient_registrations_spec.rb | 61 +++++++++++++++++++
1 file changed, 61 insertions(+)
diff --git a/spec/requests/waste_carriers_engine/transient_registrations_spec.rb b/spec/requests/waste_carriers_engine/transient_registrations_spec.rb
index 80bc1f010..ea6a98dec 100644
--- a/spec/requests/waste_carriers_engine/transient_registrations_spec.rb
+++ b/spec/requests/waste_carriers_engine/transient_registrations_spec.rb
@@ -38,5 +38,66 @@ module WasteCarriersEngine
end
end
end
+
+ describe "GET go_back_forms_path" do
+ context "when a valid transient registration exists" do
+ let(:tier) { WasteCarriersEngine::Registration::UPPER_TIER }
+ let(:workflow_state) { "company_name_form" }
+ let(:workflow_history) { %w[some_form check_registered_company_name_form] }
+ let(:transient_registration) do
+ create(:renewing_registration,
+ :has_required_data,
+ workflow_state: workflow_state,
+ workflow_history: workflow_history)
+ end
+
+ it "returns a 302 response" do
+ get go_back_forms_path(transient_registration[:token])
+
+ expect(response).to have_http_status(302)
+ end
+
+ it "redirects to the previous form in the workflow_history" do
+ get go_back_forms_path(transient_registration[:token])
+
+ expect(response).to redirect_to(new_check_registered_company_name_form_path(transient_registration[:token]))
+ end
+
+ context "when the transient registration has a partially invalid workflow history" do
+ let(:workflow_history) { %w[check_registered_company_name_form not_a_valid_state] }
+
+ it "redirects to the form for the most recent valid state" do
+ get go_back_forms_path(transient_registration[:token])
+
+ expect(response).to redirect_to(new_check_registered_company_name_form_path(transient_registration[:token]))
+ end
+ end
+
+ context "when the transient registration has a fully invalid workflow history" do
+ let(:workflow_history) do
+ [
+ "",
+ "not_a_valid_state"
+ ]
+ end
+
+ it "redirects to the default form" do
+ get go_back_forms_path(transient_registration[:token])
+
+ expect(response).to redirect_to(new_start_form_path(token: transient_registration[:token]))
+ end
+ end
+
+ context "when the transient registration has no workflow history" do
+ let(:workflow_history) { [] }
+
+ it "redirects to the default form" do
+ get go_back_forms_path(transient_registration[:token])
+
+ expect(response).to redirect_to(new_start_form_path(token: transient_registration[:token]))
+ end
+ end
+ end
+ end
end
end
From 847e04a5ad7497bb6c2d8b10869e04d84f50955c Mon Sep 17 00:00:00 2001
From: PaulDoyle-DEFRA <97455399+PaulDoyle-DEFRA@users.noreply.github.com>
Date: Wed, 1 Jun 2022 14:25:28 +0100
Subject: [PATCH 09/10] Drop hard-wired unit tests for form back-navigation
---
.../ceased_or_revoked_confirm_form_spec.rb | 4 -
.../cbd_type_form_spec.rb | 4 -
.../company_address_manual_form_spec.rb | 1 -
.../company_name_form_spec.rb | 4 -
.../company_postcode_form_spec.rb | 1 -
.../confirm_edit_cancelled_form_spec.rb | 4 -
.../contact_address_manual_form_spec.rb | 1 -
.../contact_email_form_spec.rb | 4 -
.../contact_name_form_spec.rb | 4 -
.../contact_phone_form_spec.rb | 4 -
.../contact_postcode_form_spec.rb | 1 -
.../declaration_form_spec.rb | 4 -
.../edit_bank_transfer_form_spec.rb | 4 -
.../edit_payment_summary_form_spec.rb | 4 -
.../main_people_form_spec.rb | 4 -
.../worldpay_form_spec.rb | 4 -
.../business_type_form_spec.rb | 28 -----
.../cards_form_spec.rb | 4 -
.../cbd_type_form_spec.rb | 10 --
...check_registered_company_name_form_spec.rb | 4 -
.../check_your_answers_form_spec.rb | 11 --
.../check_your_tier_form_spec.rb | 12 --
.../company_address_manual_form_spec.rb | 2 -
.../company_name_form_spec.rb | 26 -----
.../company_postcode_form_spec.rb | 1 -
.../confirm_bank_transfer_form_spec.rb | 4 -
.../construction_demolition_form_spec.rb | 10 --
.../contact_address_manual_form_spec.rb | 1 -
.../contact_email_form_spec.rb | 4 -
.../contact_name_form_spec.rb | 23 ----
.../contact_phone_form_spec.rb | 4 -
.../contact_postcode_form_spec.rb | 1 -
.../conviction_details_form_spec.rb | 4 -
.../declaration_form_spec.rb | 4 -
.../declare_convictions_form_spec.rb | 11 --
.../location_form_spec.rb | 4 -
.../main_people_form_spec.rb | 14 ---
.../other_businesses_form_spec.rb | 4 -
.../payment_summary_form_spec.rb | 4 -
.../register_in_northern_ireland_form_spec.rb | 4 -
.../register_in_scotland_form_spec.rb | 4 -
.../register_in_wales_form_spec.rb | 4 -
.../registration_number_form_spec.rb | 4 -
.../renew_registration_form_spec.rb | 17 ---
.../service_provided_form_spec.rb | 4 -
.../waste_types_form_spec.rb | 4 -
.../worldpay_form_spec.rb | 4 -
.../your_tier_form_spec.rb | 40 -------
.../copy_cards_bank_transfer_form_spec.rb | 4 -
.../copy_cards_payment_form_spec.rb | 4 -
.../wordpay_form_spec.rb | 4 -
.../business_type_form_spec.rb | 16 ---
.../cannot_renew_type_change_form_spec.rb | 4 -
.../cards_form_spec.rb | 4 -
.../cbd_type_form_spec.rb | 14 ---
...check_registered_company_name_form_spec.rb | 4 -
.../check_your_answers_form_spec.rb | 4 -
.../company_address_manual_form_spec.rb | 2 -
.../company_name_form_spec.rb | 51 --------
.../company_postcode_form_spec.rb | 1 -
.../confirm_bank_transfer_form_spec.rb | 4 -
.../contact_address_manual_form_spec.rb | 1 -
.../contact_email_form_spec.rb | 4 -
.../contact_name_form_spec.rb | 14 ---
.../contact_phone_form_spec.rb | 4 -
.../contact_postcode_form_spec.rb | 1 -
.../conviction_details_form_spec.rb | 4 -
.../declaration_form_spec.rb | 4 -
.../declare_convictions_form_spec.rb | 11 --
.../incorrect_company_form_spec.rb | 19 ---
.../location_form_spec.rb | 4 -
.../main_people_form_spec.rb | 14 ---
.../payment_summary_form_spec.rb | 4 -
.../register_in_northern_ireland_form_spec.rb | 4 -
.../register_in_scotland_form_spec.rb | 4 -
.../register_in_wales_form_spec.rb | 4 -
.../renewal_information_form_spec.rb | 4 -
.../renewal_start_form_spec.rb | 6 -
.../worldpay_form_spec.rb | 4 -
.../business_type_forms_spec.rb | 45 --------
.../cannot_renew_type_change_forms_spec.rb | 45 --------
.../waste_carriers_engine/cards_forms_spec.rb | 45 --------
.../cbd_type_forms_spec.rb | 98 ----------------
...heck_registered_company_name_forms_spec.rb | 41 -------
.../check_your_answers_forms_spec.rb | 45 --------
.../check_your_tier_forms_spec.rb | 36 ------
.../company_address_forms_spec.rb | 47 --------
.../company_address_manual_forms_spec.rb | 60 ----------
.../company_name_forms_spec.rb | 109 ------------------
.../company_postcode_forms_spec.rb | 50 --------
.../confirm_bank_transfer_forms_spec.rb | 47 --------
.../confirm_edit_cancelled_forms_spec.rb | 39 -------
.../construction_demolition_forms_spec.rb | 60 ----------
.../contact_address_forms_spec.rb | 47 --------
.../contact_address_manual_forms_spec.rb | 54 ---------
.../contact_address_reuse_forms_spec.rb | 22 ----
.../contact_email_forms_spec.rb | 45 --------
.../contact_name_forms_spec.rb | 45 --------
.../contact_phone_forms_spec.rb | 45 --------
.../contact_postcode_forms_spec.rb | 45 --------
.../conviction_details_forms_spec.rb | 45 --------
.../copy_cards_bank_transfer_forms_spec.rb | 39 -------
.../declaration_forms_spec.rb | 45 --------
.../declare_convictions_forms_spec.rb | 45 --------
.../edit_bank_transfer_forms_spec.rb | 39 -------
.../incorrect_company_forms_spec.rb | 27 -----
.../location_forms_spec.rb | 45 --------
.../main_people_forms_spec.rb | 60 ----------
.../other_businesses_forms_spec.rb | 45 --------
.../payment_summary_forms_spec.rb | 45 --------
...register_in_northern_ireland_forms_spec.rb | 45 --------
.../register_in_scotland_forms_spec.rb | 45 --------
.../register_in_wales_forms_spec.rb | 45 --------
.../registration_number_forms_spec.rb | 45 --------
.../renew_registration_forms_spec.rb | 41 -------
.../renewal_information_forms_spec.rb | 45 --------
.../service_provided_forms_spec.rb | 45 --------
.../waste_types_forms_spec.rb | 45 --------
.../worldpay_forms_spec.rb | 3 +-
119 files changed, 2 insertions(+), 2415 deletions(-)
delete mode 100644 spec/models/waste_carriers_engine/new_registration_workflow/renew_registration_form_spec.rb
delete mode 100644 spec/models/waste_carriers_engine/renewing_registration_workflow/incorrect_company_form_spec.rb
diff --git a/spec/models/waste_carriers_engine/ceased_or_revoked_registration_workflow/ceased_or_revoked_confirm_form_spec.rb b/spec/models/waste_carriers_engine/ceased_or_revoked_registration_workflow/ceased_or_revoked_confirm_form_spec.rb
index b31a686d1..0085b5bdd 100644
--- a/spec/models/waste_carriers_engine/ceased_or_revoked_registration_workflow/ceased_or_revoked_confirm_form_spec.rb
+++ b/spec/models/waste_carriers_engine/ceased_or_revoked_registration_workflow/ceased_or_revoked_confirm_form_spec.rb
@@ -11,10 +11,6 @@ module WasteCarriersEngine
context "on next" do
include_examples "has next transition", next_state: "ceased_or_revoked_completed_form"
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "cease_or_revoke_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/edit_registration_workflow/cbd_type_form_spec.rb b/spec/models/waste_carriers_engine/edit_registration_workflow/cbd_type_form_spec.rb
index 5ae902a7b..f2e5464b5 100644
--- a/spec/models/waste_carriers_engine/edit_registration_workflow/cbd_type_form_spec.rb
+++ b/spec/models/waste_carriers_engine/edit_registration_workflow/cbd_type_form_spec.rb
@@ -11,10 +11,6 @@ module WasteCarriersEngine
context "on next" do
include_examples "has next transition", next_state: "edit_form"
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "edit_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/edit_registration_workflow/company_address_manual_form_spec.rb b/spec/models/waste_carriers_engine/edit_registration_workflow/company_address_manual_form_spec.rb
index fd1280960..dd32f22f6 100644
--- a/spec/models/waste_carriers_engine/edit_registration_workflow/company_address_manual_form_spec.rb
+++ b/spec/models/waste_carriers_engine/edit_registration_workflow/company_address_manual_form_spec.rb
@@ -6,7 +6,6 @@ module WasteCarriersEngine
RSpec.describe EditRegistration, type: :model do
describe "#workflow_state" do
it_behaves_like "a manual address transition",
- previous_state_if_overseas: :edit_form,
next_state: :edit_form,
address_type: "company",
factory: :edit_registration
diff --git a/spec/models/waste_carriers_engine/edit_registration_workflow/company_name_form_spec.rb b/spec/models/waste_carriers_engine/edit_registration_workflow/company_name_form_spec.rb
index a0ba7bc1f..c8af4755d 100644
--- a/spec/models/waste_carriers_engine/edit_registration_workflow/company_name_form_spec.rb
+++ b/spec/models/waste_carriers_engine/edit_registration_workflow/company_name_form_spec.rb
@@ -11,10 +11,6 @@ module WasteCarriersEngine
context "on next" do
include_examples "has next transition", next_state: "edit_form"
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "edit_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/edit_registration_workflow/company_postcode_form_spec.rb b/spec/models/waste_carriers_engine/edit_registration_workflow/company_postcode_form_spec.rb
index d03dea248..e436beed2 100644
--- a/spec/models/waste_carriers_engine/edit_registration_workflow/company_postcode_form_spec.rb
+++ b/spec/models/waste_carriers_engine/edit_registration_workflow/company_postcode_form_spec.rb
@@ -6,7 +6,6 @@ module WasteCarriersEngine
RSpec.describe EditRegistration, type: :model do
describe "#workflow_state" do
it_behaves_like "a postcode transition",
- previous_state: :edit_form,
address_type: "company",
factory: :edit_registration
end
diff --git a/spec/models/waste_carriers_engine/edit_registration_workflow/confirm_edit_cancelled_form_spec.rb b/spec/models/waste_carriers_engine/edit_registration_workflow/confirm_edit_cancelled_form_spec.rb
index a845bca84..2032dfe3c 100644
--- a/spec/models/waste_carriers_engine/edit_registration_workflow/confirm_edit_cancelled_form_spec.rb
+++ b/spec/models/waste_carriers_engine/edit_registration_workflow/confirm_edit_cancelled_form_spec.rb
@@ -11,10 +11,6 @@ module WasteCarriersEngine
context "on next" do
include_examples "has next transition", next_state: "edit_cancelled_form"
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "edit_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/edit_registration_workflow/contact_address_manual_form_spec.rb b/spec/models/waste_carriers_engine/edit_registration_workflow/contact_address_manual_form_spec.rb
index 618902b15..a562f00f2 100644
--- a/spec/models/waste_carriers_engine/edit_registration_workflow/contact_address_manual_form_spec.rb
+++ b/spec/models/waste_carriers_engine/edit_registration_workflow/contact_address_manual_form_spec.rb
@@ -6,7 +6,6 @@ module WasteCarriersEngine
RSpec.describe EditRegistration, type: :model do
describe "#workflow_state" do
it_behaves_like "a manual address transition",
- previous_state_if_overseas: :edit_form,
next_state: :edit_form,
address_type: "contact",
factory: :edit_registration
diff --git a/spec/models/waste_carriers_engine/edit_registration_workflow/contact_email_form_spec.rb b/spec/models/waste_carriers_engine/edit_registration_workflow/contact_email_form_spec.rb
index 95fbd1252..7dfcfd955 100644
--- a/spec/models/waste_carriers_engine/edit_registration_workflow/contact_email_form_spec.rb
+++ b/spec/models/waste_carriers_engine/edit_registration_workflow/contact_email_form_spec.rb
@@ -11,10 +11,6 @@ module WasteCarriersEngine
context "on next" do
include_examples "has next transition", next_state: "edit_form"
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "edit_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/edit_registration_workflow/contact_name_form_spec.rb b/spec/models/waste_carriers_engine/edit_registration_workflow/contact_name_form_spec.rb
index 9f31da472..1c1fd4571 100644
--- a/spec/models/waste_carriers_engine/edit_registration_workflow/contact_name_form_spec.rb
+++ b/spec/models/waste_carriers_engine/edit_registration_workflow/contact_name_form_spec.rb
@@ -11,10 +11,6 @@ module WasteCarriersEngine
context "on next" do
include_examples "has next transition", next_state: "edit_form"
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "edit_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/edit_registration_workflow/contact_phone_form_spec.rb b/spec/models/waste_carriers_engine/edit_registration_workflow/contact_phone_form_spec.rb
index c29364151..babb3731e 100644
--- a/spec/models/waste_carriers_engine/edit_registration_workflow/contact_phone_form_spec.rb
+++ b/spec/models/waste_carriers_engine/edit_registration_workflow/contact_phone_form_spec.rb
@@ -11,10 +11,6 @@ module WasteCarriersEngine
context "on next" do
include_examples "has next transition", next_state: "edit_form"
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "edit_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/edit_registration_workflow/contact_postcode_form_spec.rb b/spec/models/waste_carriers_engine/edit_registration_workflow/contact_postcode_form_spec.rb
index 139e8946f..22b88d25d 100644
--- a/spec/models/waste_carriers_engine/edit_registration_workflow/contact_postcode_form_spec.rb
+++ b/spec/models/waste_carriers_engine/edit_registration_workflow/contact_postcode_form_spec.rb
@@ -6,7 +6,6 @@ module WasteCarriersEngine
RSpec.describe EditRegistration, type: :model do
describe "#workflow_state" do
it_behaves_like "a postcode transition",
- previous_state: :edit_form,
address_type: "contact",
factory: :edit_registration
end
diff --git a/spec/models/waste_carriers_engine/edit_registration_workflow/declaration_form_spec.rb b/spec/models/waste_carriers_engine/edit_registration_workflow/declaration_form_spec.rb
index 484f0c715..50752331e 100644
--- a/spec/models/waste_carriers_engine/edit_registration_workflow/declaration_form_spec.rb
+++ b/spec/models/waste_carriers_engine/edit_registration_workflow/declaration_form_spec.rb
@@ -17,10 +17,6 @@ module WasteCarriersEngine
include_examples "has next transition", next_state: "edit_payment_summary_form"
end
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "edit_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/edit_registration_workflow/edit_bank_transfer_form_spec.rb b/spec/models/waste_carriers_engine/edit_registration_workflow/edit_bank_transfer_form_spec.rb
index 2fd9ac9fb..2e1c62bcc 100644
--- a/spec/models/waste_carriers_engine/edit_registration_workflow/edit_bank_transfer_form_spec.rb
+++ b/spec/models/waste_carriers_engine/edit_registration_workflow/edit_bank_transfer_form_spec.rb
@@ -11,10 +11,6 @@ module WasteCarriersEngine
context "on next" do
include_examples "has next transition", next_state: "edit_complete_form"
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "edit_payment_summary_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/edit_registration_workflow/edit_payment_summary_form_spec.rb b/spec/models/waste_carriers_engine/edit_registration_workflow/edit_payment_summary_form_spec.rb
index 75ae157b0..0e8a22121 100644
--- a/spec/models/waste_carriers_engine/edit_registration_workflow/edit_payment_summary_form_spec.rb
+++ b/spec/models/waste_carriers_engine/edit_registration_workflow/edit_payment_summary_form_spec.rb
@@ -17,10 +17,6 @@ module WasteCarriersEngine
include_examples "has next transition", next_state: "edit_bank_transfer_form"
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "declaration_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/edit_registration_workflow/main_people_form_spec.rb b/spec/models/waste_carriers_engine/edit_registration_workflow/main_people_form_spec.rb
index 5de06313e..4d8936c7f 100644
--- a/spec/models/waste_carriers_engine/edit_registration_workflow/main_people_form_spec.rb
+++ b/spec/models/waste_carriers_engine/edit_registration_workflow/main_people_form_spec.rb
@@ -11,10 +11,6 @@ module WasteCarriersEngine
context "on next" do
include_examples "has next transition", next_state: "edit_form"
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "edit_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/edit_registration_workflow/worldpay_form_spec.rb b/spec/models/waste_carriers_engine/edit_registration_workflow/worldpay_form_spec.rb
index 15249f63a..f7b14cfbc 100644
--- a/spec/models/waste_carriers_engine/edit_registration_workflow/worldpay_form_spec.rb
+++ b/spec/models/waste_carriers_engine/edit_registration_workflow/worldpay_form_spec.rb
@@ -11,10 +11,6 @@ module WasteCarriersEngine
context "on next" do
include_examples "has next transition", next_state: "edit_complete_form"
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "edit_payment_summary_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/new_registration_workflow/business_type_form_spec.rb b/spec/models/waste_carriers_engine/new_registration_workflow/business_type_form_spec.rb
index 297c50654..4e2f31f75 100644
--- a/spec/models/waste_carriers_engine/new_registration_workflow/business_type_form_spec.rb
+++ b/spec/models/waste_carriers_engine/new_registration_workflow/business_type_form_spec.rb
@@ -21,34 +21,6 @@ module WasteCarriersEngine
include_examples "has next transition", next_state: "check_your_tier_form"
end
-
- context "on back" do
- subject { build(:new_registration, workflow_state: "business_type_form", location: location) }
-
- context "when the location is northern_ireland" do
- let(:location) { "northern_ireland" }
-
- include_examples "has back transition", previous_state: "register_in_northern_ireland_form"
- end
-
- context "when the location is scotland" do
- let(:location) { "scotland" }
-
- include_examples "has back transition", previous_state: "register_in_scotland_form"
- end
-
- context "when the location is wales" do
- let(:location) { "wales" }
-
- include_examples "has back transition", previous_state: "register_in_wales_form"
- end
-
- context "when the location is in england" do
- let(:location) { "england" }
-
- include_examples "has back transition", previous_state: "location_form"
- end
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/new_registration_workflow/cards_form_spec.rb b/spec/models/waste_carriers_engine/new_registration_workflow/cards_form_spec.rb
index 9cdd19c7d..eef98b57c 100644
--- a/spec/models/waste_carriers_engine/new_registration_workflow/cards_form_spec.rb
+++ b/spec/models/waste_carriers_engine/new_registration_workflow/cards_form_spec.rb
@@ -11,10 +11,6 @@ module WasteCarriersEngine
context "on next" do
include_examples "has next transition", next_state: "payment_summary_form"
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "declaration_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/new_registration_workflow/cbd_type_form_spec.rb b/spec/models/waste_carriers_engine/new_registration_workflow/cbd_type_form_spec.rb
index 7783878ff..e23a4ab2b 100644
--- a/spec/models/waste_carriers_engine/new_registration_workflow/cbd_type_form_spec.rb
+++ b/spec/models/waste_carriers_engine/new_registration_workflow/cbd_type_form_spec.rb
@@ -17,16 +17,6 @@ module WasteCarriersEngine
include_examples "has next transition", next_state: "main_people_form"
end
-
- context "on back" do
- context "when the answer to check your tier is upper" do
- subject { build(:new_registration, workflow_state: "cbd_type_form", temp_check_your_tier: "upper") }
-
- include_examples "has back transition", previous_state: "check_your_tier_form"
- end
-
- include_examples "has back transition", previous_state: "your_tier_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/new_registration_workflow/check_registered_company_name_form_spec.rb b/spec/models/waste_carriers_engine/new_registration_workflow/check_registered_company_name_form_spec.rb
index eea08ab72..eaccb5194 100644
--- a/spec/models/waste_carriers_engine/new_registration_workflow/check_registered_company_name_form_spec.rb
+++ b/spec/models/waste_carriers_engine/new_registration_workflow/check_registered_company_name_form_spec.rb
@@ -21,10 +21,6 @@ module WasteCarriersEngine
include_examples "has next transition", next_state: "incorrect_company_form"
end
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "registration_number_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/new_registration_workflow/check_your_answers_form_spec.rb b/spec/models/waste_carriers_engine/new_registration_workflow/check_your_answers_form_spec.rb
index d82e087fb..dc4cedc8a 100644
--- a/spec/models/waste_carriers_engine/new_registration_workflow/check_your_answers_form_spec.rb
+++ b/spec/models/waste_carriers_engine/new_registration_workflow/check_your_answers_form_spec.rb
@@ -11,17 +11,6 @@ module WasteCarriersEngine
context "on next" do
include_examples "has next transition", next_state: "declaration_form"
end
-
- context "on back" do
- context "when the contact address was manually entered" do
- let(:contact_address) { build(:address, :contact, :manual_uk) }
- subject { build(:new_registration, workflow_state: "check_your_answers_form", contact_address: contact_address) }
-
- include_examples "has back transition", previous_state: "contact_address_manual_form"
- end
-
- include_examples "has back transition", previous_state: "contact_address_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/new_registration_workflow/check_your_tier_form_spec.rb b/spec/models/waste_carriers_engine/new_registration_workflow/check_your_tier_form_spec.rb
index 6b104f090..6aefcb4f9 100644
--- a/spec/models/waste_carriers_engine/new_registration_workflow/check_your_tier_form_spec.rb
+++ b/spec/models/waste_carriers_engine/new_registration_workflow/check_your_tier_form_spec.rb
@@ -35,18 +35,6 @@ module WasteCarriersEngine
end
end
end
-
- context "on back" do
- context "if the company is based overseas" do
- subject { build(:new_registration, workflow_state: "check_your_tier_form", location: "overseas") }
-
- include_examples "has back transition", previous_state: "location_form"
- end
-
- subject { build(:new_registration, workflow_state: "check_your_tier_form") }
-
- include_examples "has back transition", previous_state: "business_type_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/new_registration_workflow/company_address_manual_form_spec.rb b/spec/models/waste_carriers_engine/new_registration_workflow/company_address_manual_form_spec.rb
index 0c9097b02..a81d43a2d 100644
--- a/spec/models/waste_carriers_engine/new_registration_workflow/company_address_manual_form_spec.rb
+++ b/spec/models/waste_carriers_engine/new_registration_workflow/company_address_manual_form_spec.rb
@@ -9,7 +9,6 @@ module WasteCarriersEngine
let(:tier) { WasteCarriersEngine::Registration::UPPER_TIER }
it_behaves_like "a manual address transition",
- previous_state_if_overseas: :company_name_form,
next_state: :declare_convictions_form,
address_type: "company",
factory: :new_registration
@@ -19,7 +18,6 @@ module WasteCarriersEngine
let(:tier) { WasteCarriersEngine::Registration::LOWER_TIER }
it_behaves_like "a manual address transition",
- previous_state_if_overseas: :company_name_form,
next_state: :contact_name_form,
address_type: "company",
factory: :new_registration
diff --git a/spec/models/waste_carriers_engine/new_registration_workflow/company_name_form_spec.rb b/spec/models/waste_carriers_engine/new_registration_workflow/company_name_form_spec.rb
index dfb75fe90..e4ad62907 100644
--- a/spec/models/waste_carriers_engine/new_registration_workflow/company_name_form_spec.rb
+++ b/spec/models/waste_carriers_engine/new_registration_workflow/company_name_form_spec.rb
@@ -17,32 +17,6 @@ module WasteCarriersEngine
include_examples "has next transition", next_state: "company_postcode_form"
end
-
- context "on back" do
- context "when the business does not require a registration number and the registration is upper tier" do
- subject { build(:new_registration, :upper, workflow_state: "company_name_form", location: "overseas") }
-
- include_examples "has back transition", previous_state: "main_people_form"
- end
-
- context "when the registration is lower tier" do
- subject { build(:new_registration, :lower, workflow_state: "company_name_form") }
-
- context "when the check your tier answer is lower" do
- subject { build(:new_registration, :lower, workflow_state: "company_name_form", temp_check_your_tier: "lower") }
-
- include_examples "has back transition", previous_state: "check_your_tier_form"
- end
-
- include_examples "has back transition", previous_state: "your_tier_form"
- end
-
- context "When the registration requires a company number" do
- subject { build(:new_registration, workflow_state: "company_name_form", business_type: "limitedCompany") }
-
- include_examples "has back transition", previous_state: "check_registered_company_name_form"
- end
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/new_registration_workflow/company_postcode_form_spec.rb b/spec/models/waste_carriers_engine/new_registration_workflow/company_postcode_form_spec.rb
index 537c65507..7a90d1ec3 100644
--- a/spec/models/waste_carriers_engine/new_registration_workflow/company_postcode_form_spec.rb
+++ b/spec/models/waste_carriers_engine/new_registration_workflow/company_postcode_form_spec.rb
@@ -7,7 +7,6 @@ module WasteCarriersEngine
describe "#workflow_state" do
it_behaves_like "a postcode transition",
- previous_state: :company_name_form,
address_type: "company",
factory: :new_registration
diff --git a/spec/models/waste_carriers_engine/new_registration_workflow/confirm_bank_transfer_form_spec.rb b/spec/models/waste_carriers_engine/new_registration_workflow/confirm_bank_transfer_form_spec.rb
index d8800409f..bcab81775 100644
--- a/spec/models/waste_carriers_engine/new_registration_workflow/confirm_bank_transfer_form_spec.rb
+++ b/spec/models/waste_carriers_engine/new_registration_workflow/confirm_bank_transfer_form_spec.rb
@@ -17,10 +17,6 @@ module WasteCarriersEngine
expect { subject.next! }.to change { subject.metaData.route }.to("test_route")
end
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "payment_summary_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/new_registration_workflow/construction_demolition_form_spec.rb b/spec/models/waste_carriers_engine/new_registration_workflow/construction_demolition_form_spec.rb
index 41524367d..bd76b9782 100644
--- a/spec/models/waste_carriers_engine/new_registration_workflow/construction_demolition_form_spec.rb
+++ b/spec/models/waste_carriers_engine/new_registration_workflow/construction_demolition_form_spec.rb
@@ -35,16 +35,6 @@ module WasteCarriersEngine
end
end
end
-
- context "on back" do
- context "when the company only carries its own waste" do
- subject { build(:new_registration, workflow_state: "construction_demolition_form", other_businesses: "no") }
-
- include_examples "has back transition", previous_state: "other_businesses_form"
- end
-
- include_examples "has back transition", previous_state: "service_provided_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/new_registration_workflow/contact_address_manual_form_spec.rb b/spec/models/waste_carriers_engine/new_registration_workflow/contact_address_manual_form_spec.rb
index bde73eef6..7a800da40 100644
--- a/spec/models/waste_carriers_engine/new_registration_workflow/contact_address_manual_form_spec.rb
+++ b/spec/models/waste_carriers_engine/new_registration_workflow/contact_address_manual_form_spec.rb
@@ -6,7 +6,6 @@ module WasteCarriersEngine
RSpec.describe NewRegistration do
describe "#workflow_state" do
it_behaves_like "a manual address transition",
- previous_state_if_overseas: :contact_address_reuse_form,
next_state: :check_your_answers_form,
address_type: "contact",
factory: :new_registration
diff --git a/spec/models/waste_carriers_engine/new_registration_workflow/contact_email_form_spec.rb b/spec/models/waste_carriers_engine/new_registration_workflow/contact_email_form_spec.rb
index abcd073f7..9db871d17 100644
--- a/spec/models/waste_carriers_engine/new_registration_workflow/contact_email_form_spec.rb
+++ b/spec/models/waste_carriers_engine/new_registration_workflow/contact_email_form_spec.rb
@@ -11,10 +11,6 @@ module WasteCarriersEngine
context "on next" do
include_examples "has next transition", next_state: "contact_address_reuse_form"
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "contact_phone_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/new_registration_workflow/contact_name_form_spec.rb b/spec/models/waste_carriers_engine/new_registration_workflow/contact_name_form_spec.rb
index 726a6a900..15098e63c 100644
--- a/spec/models/waste_carriers_engine/new_registration_workflow/contact_name_form_spec.rb
+++ b/spec/models/waste_carriers_engine/new_registration_workflow/contact_name_form_spec.rb
@@ -11,29 +11,6 @@ module WasteCarriersEngine
context "on next" do
include_examples "has next transition", next_state: "contact_phone_form"
end
-
- context "on back" do
- context "When the user has convictions to declare" do
- subject { build(:new_registration, workflow_state: "contact_name_form", declared_convictions: "yes") }
-
- include_examples "has back transition", previous_state: "conviction_details_form"
- end
-
- context "When the registration is a lower tier" do
- subject { build(:new_registration, :lower, workflow_state: "contact_name_form") }
-
- context "when the registered address was manually entered" do
- let(:registered_address) { build(:address, :registered, :manual_foreign) }
- subject { build(:new_registration, :lower, workflow_state: "contact_name_form", registered_address: registered_address) }
-
- include_examples "has back transition", previous_state: "company_address_manual_form"
- end
-
- include_examples "has back transition", previous_state: "company_address_form"
- end
-
- include_examples "has back transition", previous_state: "declare_convictions_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/new_registration_workflow/contact_phone_form_spec.rb b/spec/models/waste_carriers_engine/new_registration_workflow/contact_phone_form_spec.rb
index a4aa5260a..238f2f66e 100644
--- a/spec/models/waste_carriers_engine/new_registration_workflow/contact_phone_form_spec.rb
+++ b/spec/models/waste_carriers_engine/new_registration_workflow/contact_phone_form_spec.rb
@@ -11,10 +11,6 @@ module WasteCarriersEngine
context "on next" do
include_examples "has next transition", next_state: "contact_email_form"
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "contact_name_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/new_registration_workflow/contact_postcode_form_spec.rb b/spec/models/waste_carriers_engine/new_registration_workflow/contact_postcode_form_spec.rb
index f104b57fc..6b07a934d 100644
--- a/spec/models/waste_carriers_engine/new_registration_workflow/contact_postcode_form_spec.rb
+++ b/spec/models/waste_carriers_engine/new_registration_workflow/contact_postcode_form_spec.rb
@@ -5,7 +5,6 @@
module WasteCarriersEngine
RSpec.describe NewRegistration do
it_behaves_like "a postcode transition",
- previous_state: :contact_address_reuse_form,
address_type: "contact",
factory: :new_registration
end
diff --git a/spec/models/waste_carriers_engine/new_registration_workflow/conviction_details_form_spec.rb b/spec/models/waste_carriers_engine/new_registration_workflow/conviction_details_form_spec.rb
index bf1cc31b3..c1839c9cf 100644
--- a/spec/models/waste_carriers_engine/new_registration_workflow/conviction_details_form_spec.rb
+++ b/spec/models/waste_carriers_engine/new_registration_workflow/conviction_details_form_spec.rb
@@ -11,10 +11,6 @@ module WasteCarriersEngine
context "on next" do
include_examples "has next transition", next_state: "contact_name_form"
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "declare_convictions_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/new_registration_workflow/declaration_form_spec.rb b/spec/models/waste_carriers_engine/new_registration_workflow/declaration_form_spec.rb
index bd5e88ad5..e127b432e 100644
--- a/spec/models/waste_carriers_engine/new_registration_workflow/declaration_form_spec.rb
+++ b/spec/models/waste_carriers_engine/new_registration_workflow/declaration_form_spec.rb
@@ -17,10 +17,6 @@ module WasteCarriersEngine
include_examples "has next transition", next_state: "cards_form"
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "check_your_answers_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/new_registration_workflow/declare_convictions_form_spec.rb b/spec/models/waste_carriers_engine/new_registration_workflow/declare_convictions_form_spec.rb
index 76c92895c..073457cd0 100644
--- a/spec/models/waste_carriers_engine/new_registration_workflow/declare_convictions_form_spec.rb
+++ b/spec/models/waste_carriers_engine/new_registration_workflow/declare_convictions_form_spec.rb
@@ -17,17 +17,6 @@ module WasteCarriersEngine
include_examples "has next transition", next_state: "contact_name_form"
end
-
- context "on back" do
- context "when the registered address was manually entered" do
- let(:registered_address) { build(:address, :registered, :manual_foreign) }
- subject { build(:new_registration, workflow_state: "declare_convictions_form", registered_address: registered_address) }
-
- include_examples "has back transition", previous_state: "company_address_manual_form"
- end
-
- include_examples "has back transition", previous_state: "company_address_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/new_registration_workflow/location_form_spec.rb b/spec/models/waste_carriers_engine/new_registration_workflow/location_form_spec.rb
index 8fa566d20..bb52234c6 100644
--- a/spec/models/waste_carriers_engine/new_registration_workflow/location_form_spec.rb
+++ b/spec/models/waste_carriers_engine/new_registration_workflow/location_form_spec.rb
@@ -41,10 +41,6 @@ module WasteCarriersEngine
include_examples "has next transition", next_state: "business_type_form"
end
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "start_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/new_registration_workflow/main_people_form_spec.rb b/spec/models/waste_carriers_engine/new_registration_workflow/main_people_form_spec.rb
index 6191b9ae8..4fb4ebb35 100644
--- a/spec/models/waste_carriers_engine/new_registration_workflow/main_people_form_spec.rb
+++ b/spec/models/waste_carriers_engine/new_registration_workflow/main_people_form_spec.rb
@@ -12,20 +12,6 @@ module WasteCarriersEngine
context "on next" do
include_examples "has next transition", next_state: "company_name_form"
end
-
- context "on back" do
- context "when the business type is limited company" do
- let(:business_type) { "limitedCompany" }
-
- include_examples "has back transition", previous_state: "check_registered_company_name_form"
- end
-
- context "when the business type is sole trader" do
- let(:business_type) { "soleTrader" }
-
- include_examples "has back transition", previous_state: "cbd_type_form"
- end
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/new_registration_workflow/other_businesses_form_spec.rb b/spec/models/waste_carriers_engine/new_registration_workflow/other_businesses_form_spec.rb
index ed9de4084..271560f20 100644
--- a/spec/models/waste_carriers_engine/new_registration_workflow/other_businesses_form_spec.rb
+++ b/spec/models/waste_carriers_engine/new_registration_workflow/other_businesses_form_spec.rb
@@ -19,10 +19,6 @@ module WasteCarriersEngine
include_examples "has next transition", next_state: "service_provided_form"
end
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "check_your_tier_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/new_registration_workflow/payment_summary_form_spec.rb b/spec/models/waste_carriers_engine/new_registration_workflow/payment_summary_form_spec.rb
index db081309a..c5c4eec28 100644
--- a/spec/models/waste_carriers_engine/new_registration_workflow/payment_summary_form_spec.rb
+++ b/spec/models/waste_carriers_engine/new_registration_workflow/payment_summary_form_spec.rb
@@ -17,10 +17,6 @@ module WasteCarriersEngine
include_examples "has next transition", next_state: "confirm_bank_transfer_form"
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "cards_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/new_registration_workflow/register_in_northern_ireland_form_spec.rb b/spec/models/waste_carriers_engine/new_registration_workflow/register_in_northern_ireland_form_spec.rb
index d91ccdc56..911d405da 100644
--- a/spec/models/waste_carriers_engine/new_registration_workflow/register_in_northern_ireland_form_spec.rb
+++ b/spec/models/waste_carriers_engine/new_registration_workflow/register_in_northern_ireland_form_spec.rb
@@ -11,10 +11,6 @@ module WasteCarriersEngine
context "on next" do
include_examples "has next transition", next_state: "business_type_form"
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "location_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/new_registration_workflow/register_in_scotland_form_spec.rb b/spec/models/waste_carriers_engine/new_registration_workflow/register_in_scotland_form_spec.rb
index e20d15684..1aa05f1e0 100644
--- a/spec/models/waste_carriers_engine/new_registration_workflow/register_in_scotland_form_spec.rb
+++ b/spec/models/waste_carriers_engine/new_registration_workflow/register_in_scotland_form_spec.rb
@@ -11,10 +11,6 @@ module WasteCarriersEngine
context "on next" do
include_examples "has next transition", next_state: "business_type_form"
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "location_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/new_registration_workflow/register_in_wales_form_spec.rb b/spec/models/waste_carriers_engine/new_registration_workflow/register_in_wales_form_spec.rb
index bc125189b..7da7fcb11 100644
--- a/spec/models/waste_carriers_engine/new_registration_workflow/register_in_wales_form_spec.rb
+++ b/spec/models/waste_carriers_engine/new_registration_workflow/register_in_wales_form_spec.rb
@@ -11,10 +11,6 @@ module WasteCarriersEngine
context "on next" do
include_examples "has next transition", next_state: "business_type_form"
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "location_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/new_registration_workflow/registration_number_form_spec.rb b/spec/models/waste_carriers_engine/new_registration_workflow/registration_number_form_spec.rb
index 6934507fc..f7768289f 100644
--- a/spec/models/waste_carriers_engine/new_registration_workflow/registration_number_form_spec.rb
+++ b/spec/models/waste_carriers_engine/new_registration_workflow/registration_number_form_spec.rb
@@ -11,10 +11,6 @@ module WasteCarriersEngine
context "on next" do
include_examples "has next transition", next_state: "check_registered_company_name_form"
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "cbd_type_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/new_registration_workflow/renew_registration_form_spec.rb b/spec/models/waste_carriers_engine/new_registration_workflow/renew_registration_form_spec.rb
deleted file mode 100644
index f45dd7ddd..000000000
--- a/spec/models/waste_carriers_engine/new_registration_workflow/renew_registration_form_spec.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-require "rails_helper"
-
-module WasteCarriersEngine
- RSpec.describe NewRegistration do
- subject { build(:new_registration, workflow_state: "renew_registration_form") }
-
- describe "#workflow_state" do
- context ":renew_registration_form state transitions" do
- context "on back" do
- include_examples "has back transition", previous_state: "start_form"
- end
- end
- end
- end
-end
diff --git a/spec/models/waste_carriers_engine/new_registration_workflow/service_provided_form_spec.rb b/spec/models/waste_carriers_engine/new_registration_workflow/service_provided_form_spec.rb
index 9ff6db4a5..edb608cd4 100644
--- a/spec/models/waste_carriers_engine/new_registration_workflow/service_provided_form_spec.rb
+++ b/spec/models/waste_carriers_engine/new_registration_workflow/service_provided_form_spec.rb
@@ -19,10 +19,6 @@ module WasteCarriersEngine
include_examples "has next transition", next_state: "construction_demolition_form"
end
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "other_businesses_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/new_registration_workflow/waste_types_form_spec.rb b/spec/models/waste_carriers_engine/new_registration_workflow/waste_types_form_spec.rb
index 85a4bb173..05ec8ab66 100644
--- a/spec/models/waste_carriers_engine/new_registration_workflow/waste_types_form_spec.rb
+++ b/spec/models/waste_carriers_engine/new_registration_workflow/waste_types_form_spec.rb
@@ -35,10 +35,6 @@ module WasteCarriersEngine
end
end
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "service_provided_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/new_registration_workflow/worldpay_form_spec.rb b/spec/models/waste_carriers_engine/new_registration_workflow/worldpay_form_spec.rb
index 6d6f3c849..59e27f018 100644
--- a/spec/models/waste_carriers_engine/new_registration_workflow/worldpay_form_spec.rb
+++ b/spec/models/waste_carriers_engine/new_registration_workflow/worldpay_form_spec.rb
@@ -23,10 +23,6 @@ module WasteCarriersEngine
include_examples "has next transition", next_state: "registration_received_pending_worldpay_payment_form"
end
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "payment_summary_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/new_registration_workflow/your_tier_form_spec.rb b/spec/models/waste_carriers_engine/new_registration_workflow/your_tier_form_spec.rb
index 3cbd115c5..906d9b142 100644
--- a/spec/models/waste_carriers_engine/new_registration_workflow/your_tier_form_spec.rb
+++ b/spec/models/waste_carriers_engine/new_registration_workflow/your_tier_form_spec.rb
@@ -21,46 +21,6 @@ module WasteCarriersEngine
include_examples "has next transition", next_state: "cbd_type_form"
end
end
-
- context "on back" do
- context "when the check your tier answer is not unknown" do
- subject { build(:new_registration, workflow_state: "your_tier_form", temp_check_your_tier: "lower") }
-
- include_examples "has back transition", previous_state: "check_your_tier_form"
- end
-
- context "when the registration is lower tier" do
- subject { build(:new_registration, :lower, workflow_state: "your_tier_form", temp_check_your_tier: "unknown") }
-
- context "when the waste is the main service" do
- subject { build(:new_registration, :lower, workflow_state: "your_tier_form", is_main_service: "yes", temp_check_your_tier: "unknown") }
-
- include_examples "has back transition", previous_state: "waste_types_form"
- end
-
- context "when the company only carries own waste" do
- subject { build(:new_registration, :lower, workflow_state: "your_tier_form", other_businesses: "no", temp_check_your_tier: "unknown") }
-
- include_examples "has back transition", previous_state: "construction_demolition_form"
- end
-
- include_examples "has back transition", previous_state: "construction_demolition_form"
- end
-
- context "when the company deals with more than amf waste" do
- subject { build(:new_registration, workflow_state: "your_tier_form", only_amf: "no", temp_check_your_tier: "unknown") }
-
- include_examples "has back transition", previous_state: "waste_types_form"
- end
-
- context "when the registration's company is a charity" do
- subject { build(:new_registration, workflow_state: "your_tier_form", business_type: "charity", temp_check_your_tier: "unknown") }
-
- include_examples "has back transition", previous_state: "business_type_form"
- end
-
- include_examples "has back transition", previous_state: "construction_demolition_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/order_copy_cards_registration_workflow_state/copy_cards_bank_transfer_form_spec.rb b/spec/models/waste_carriers_engine/order_copy_cards_registration_workflow_state/copy_cards_bank_transfer_form_spec.rb
index e1af2c86c..9166a2852 100644
--- a/spec/models/waste_carriers_engine/order_copy_cards_registration_workflow_state/copy_cards_bank_transfer_form_spec.rb
+++ b/spec/models/waste_carriers_engine/order_copy_cards_registration_workflow_state/copy_cards_bank_transfer_form_spec.rb
@@ -11,10 +11,6 @@ module WasteCarriersEngine
context "on next" do
include_examples "has next transition", next_state: "copy_cards_order_completed_form"
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "copy_cards_payment_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/order_copy_cards_registration_workflow_state/copy_cards_payment_form_spec.rb b/spec/models/waste_carriers_engine/order_copy_cards_registration_workflow_state/copy_cards_payment_form_spec.rb
index 5938d2538..b87b2e7e5 100644
--- a/spec/models/waste_carriers_engine/order_copy_cards_registration_workflow_state/copy_cards_payment_form_spec.rb
+++ b/spec/models/waste_carriers_engine/order_copy_cards_registration_workflow_state/copy_cards_payment_form_spec.rb
@@ -21,10 +21,6 @@ module WasteCarriersEngine
include_examples "has next transition", next_state: "copy_cards_bank_transfer_form"
end
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "copy_cards_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/order_copy_cards_registration_workflow_state/wordpay_form_spec.rb b/spec/models/waste_carriers_engine/order_copy_cards_registration_workflow_state/wordpay_form_spec.rb
index 8680e7f42..65d79ee4e 100644
--- a/spec/models/waste_carriers_engine/order_copy_cards_registration_workflow_state/wordpay_form_spec.rb
+++ b/spec/models/waste_carriers_engine/order_copy_cards_registration_workflow_state/wordpay_form_spec.rb
@@ -11,10 +11,6 @@ module WasteCarriersEngine
context "on next" do
include_examples "has next transition", next_state: "copy_cards_order_completed_form"
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "copy_cards_payment_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/renewing_registration_workflow/business_type_form_spec.rb b/spec/models/waste_carriers_engine/renewing_registration_workflow/business_type_form_spec.rb
index 740ab3775..4f95d7799 100644
--- a/spec/models/waste_carriers_engine/renewing_registration_workflow/business_type_form_spec.rb
+++ b/spec/models/waste_carriers_engine/renewing_registration_workflow/business_type_form_spec.rb
@@ -45,22 +45,6 @@ module WasteCarriersEngine
end
end
end
-
- context "on back" do
- {
- # Permutation table of location and the state that should result
- "england" => :location_form,
- "northern_ireland" => :register_in_northern_ireland_form,
- "scotland" => :register_in_scotland_form,
- "wales" => :register_in_wales_form
- }.each do |location, expected_previous_state|
- context "when the location is #{location}" do
- before { subject.location = location }
-
- include_examples "has back transition", previous_state: expected_previous_state
- end
- end
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/renewing_registration_workflow/cannot_renew_type_change_form_spec.rb b/spec/models/waste_carriers_engine/renewing_registration_workflow/cannot_renew_type_change_form_spec.rb
index d79e18730..607ac3bc0 100644
--- a/spec/models/waste_carriers_engine/renewing_registration_workflow/cannot_renew_type_change_form_spec.rb
+++ b/spec/models/waste_carriers_engine/renewing_registration_workflow/cannot_renew_type_change_form_spec.rb
@@ -17,10 +17,6 @@ module WasteCarriersEngine
expect(subject).to_not allow_event :next
end
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "business_type_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/renewing_registration_workflow/cards_form_spec.rb b/spec/models/waste_carriers_engine/renewing_registration_workflow/cards_form_spec.rb
index 431748c90..940e0ee15 100644
--- a/spec/models/waste_carriers_engine/renewing_registration_workflow/cards_form_spec.rb
+++ b/spec/models/waste_carriers_engine/renewing_registration_workflow/cards_form_spec.rb
@@ -15,10 +15,6 @@ module WasteCarriersEngine
context "on next" do
include_examples "has next transition", next_state: "payment_summary_form"
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "declaration_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/renewing_registration_workflow/cbd_type_form_spec.rb b/spec/models/waste_carriers_engine/renewing_registration_workflow/cbd_type_form_spec.rb
index 47defc4fc..939d586a9 100644
--- a/spec/models/waste_carriers_engine/renewing_registration_workflow/cbd_type_form_spec.rb
+++ b/spec/models/waste_carriers_engine/renewing_registration_workflow/cbd_type_form_spec.rb
@@ -15,20 +15,6 @@ module WasteCarriersEngine
context "on next" do
include_examples "has next transition", next_state: "renewal_information_form"
end
-
- context "on back" do
- context "when the registration is not overseas" do
- before { subject.location = "england" }
-
- include_examples "has back transition", previous_state: "business_type_form"
- end
-
- context "when the registration is overseas" do
- before { subject.location = "overseas" }
-
- include_examples "has back transition", previous_state: "location_form"
- end
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/renewing_registration_workflow/check_registered_company_name_form_spec.rb b/spec/models/waste_carriers_engine/renewing_registration_workflow/check_registered_company_name_form_spec.rb
index 7668523ad..6268ab512 100644
--- a/spec/models/waste_carriers_engine/renewing_registration_workflow/check_registered_company_name_form_spec.rb
+++ b/spec/models/waste_carriers_engine/renewing_registration_workflow/check_registered_company_name_form_spec.rb
@@ -21,10 +21,6 @@ module WasteCarriersEngine
include_examples "has next transition", next_state: "incorrect_company_form"
end
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "renewal_information_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/renewing_registration_workflow/check_your_answers_form_spec.rb b/spec/models/waste_carriers_engine/renewing_registration_workflow/check_your_answers_form_spec.rb
index 2e082b888..e91c5b9db 100644
--- a/spec/models/waste_carriers_engine/renewing_registration_workflow/check_your_answers_form_spec.rb
+++ b/spec/models/waste_carriers_engine/renewing_registration_workflow/check_your_answers_form_spec.rb
@@ -15,10 +15,6 @@ module WasteCarriersEngine
context "on next" do
include_examples "has next transition", next_state: "declaration_form"
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "contact_address_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/renewing_registration_workflow/company_address_manual_form_spec.rb b/spec/models/waste_carriers_engine/renewing_registration_workflow/company_address_manual_form_spec.rb
index 372a36434..8ef27f218 100644
--- a/spec/models/waste_carriers_engine/renewing_registration_workflow/company_address_manual_form_spec.rb
+++ b/spec/models/waste_carriers_engine/renewing_registration_workflow/company_address_manual_form_spec.rb
@@ -9,7 +9,6 @@ module WasteCarriersEngine
let(:tier) { WasteCarriersEngine::Registration::UPPER_TIER }
it_behaves_like "a manual address transition",
- previous_state_if_overseas: :company_name_form,
next_state: :declare_convictions_form,
address_type: "company",
factory: :renewing_registration
@@ -19,7 +18,6 @@ module WasteCarriersEngine
let(:tier) { WasteCarriersEngine::Registration::LOWER_TIER }
it_behaves_like "a manual address transition",
- previous_state_if_overseas: :company_name_form,
next_state: :contact_name_form,
address_type: "company",
factory: :renewing_registration
diff --git a/spec/models/waste_carriers_engine/renewing_registration_workflow/company_name_form_spec.rb b/spec/models/waste_carriers_engine/renewing_registration_workflow/company_name_form_spec.rb
index b4756a246..af8e93df0 100644
--- a/spec/models/waste_carriers_engine/renewing_registration_workflow/company_name_form_spec.rb
+++ b/spec/models/waste_carriers_engine/renewing_registration_workflow/company_name_form_spec.rb
@@ -27,57 +27,6 @@ module WasteCarriersEngine
include_examples "has next transition", next_state: "company_address_manual_form"
end
end
-
- context "on back" do
-
- shared_examples "main_people_form or renewal_information_form depending on tier" do
- context "when the registraton is upper tier" do
- let(:tier) { WasteCarriersEngine::Registration::UPPER_TIER }
- include_examples "has back transition", previous_state: "main_people_form"
- end
-
- context "when the registration is lower tier" do
- let(:tier) { WasteCarriersEngine::Registration::LOWER_TIER }
- include_examples "has back transition", previous_state: "renewal_information_form"
- end
- end
-
- context "when the business type is partnership" do
- let(:business_type) { "partnership" }
-
- it_behaves_like "main_people_form or renewal_information_form depending on tier"
- end
-
- context "when the business type is soleTrader" do
- let(:business_type) { "soleTrader" }
-
- it_behaves_like "main_people_form or renewal_information_form depending on tier"
- end
-
- context "when the business type is localAuthority" do
- let(:business_type) { "localAuthority" }
-
- it_behaves_like "main_people_form or renewal_information_form depending on tier"
- end
-
- context "when the location is overseas" do
- let(:location) { "overseas" }
-
- it_behaves_like "main_people_form or renewal_information_form depending on tier"
- end
-
- context "when the business type is limitedCompany" do
- let(:business_type) { "limitedCompany" }
-
- include_examples "has back transition", previous_state: "check_registered_company_name_form"
- end
-
- context "when the business type is limitedLiabilityPartnership" do
- let(:business_type) { "limitedLiabilityPartnership" }
-
- include_examples "has back transition", previous_state: "check_registered_company_name_form"
- end
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/renewing_registration_workflow/company_postcode_form_spec.rb b/spec/models/waste_carriers_engine/renewing_registration_workflow/company_postcode_form_spec.rb
index bb801e2fe..f351f9081 100644
--- a/spec/models/waste_carriers_engine/renewing_registration_workflow/company_postcode_form_spec.rb
+++ b/spec/models/waste_carriers_engine/renewing_registration_workflow/company_postcode_form_spec.rb
@@ -7,7 +7,6 @@ module WasteCarriersEngine
describe "#workflow_state" do
it_behaves_like "a postcode transition",
- previous_state: :company_name_form,
address_type: "company",
factory: :renewing_registration
diff --git a/spec/models/waste_carriers_engine/renewing_registration_workflow/confirm_bank_transfer_form_spec.rb b/spec/models/waste_carriers_engine/renewing_registration_workflow/confirm_bank_transfer_form_spec.rb
index 05572f6ab..e6eecf937 100644
--- a/spec/models/waste_carriers_engine/renewing_registration_workflow/confirm_bank_transfer_form_spec.rb
+++ b/spec/models/waste_carriers_engine/renewing_registration_workflow/confirm_bank_transfer_form_spec.rb
@@ -25,10 +25,6 @@ module WasteCarriersEngine
subject.next!
end
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "payment_summary_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/renewing_registration_workflow/contact_address_manual_form_spec.rb b/spec/models/waste_carriers_engine/renewing_registration_workflow/contact_address_manual_form_spec.rb
index 145fc705b..eca80d930 100644
--- a/spec/models/waste_carriers_engine/renewing_registration_workflow/contact_address_manual_form_spec.rb
+++ b/spec/models/waste_carriers_engine/renewing_registration_workflow/contact_address_manual_form_spec.rb
@@ -6,7 +6,6 @@ module WasteCarriersEngine
RSpec.describe RenewingRegistration do
describe "#workflow_state" do
it_behaves_like "a manual address transition",
- previous_state_if_overseas: :contact_email_form,
next_state: :check_your_answers_form,
address_type: "contact",
factory: :renewing_registration
diff --git a/spec/models/waste_carriers_engine/renewing_registration_workflow/contact_email_form_spec.rb b/spec/models/waste_carriers_engine/renewing_registration_workflow/contact_email_form_spec.rb
index f3d94991b..fc798134a 100644
--- a/spec/models/waste_carriers_engine/renewing_registration_workflow/contact_email_form_spec.rb
+++ b/spec/models/waste_carriers_engine/renewing_registration_workflow/contact_email_form_spec.rb
@@ -15,10 +15,6 @@ module WasteCarriersEngine
context "on next" do
include_examples "has next transition", next_state: "contact_postcode_form"
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "contact_phone_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/renewing_registration_workflow/contact_name_form_spec.rb b/spec/models/waste_carriers_engine/renewing_registration_workflow/contact_name_form_spec.rb
index 02d7e7101..845e410c0 100644
--- a/spec/models/waste_carriers_engine/renewing_registration_workflow/contact_name_form_spec.rb
+++ b/spec/models/waste_carriers_engine/renewing_registration_workflow/contact_name_form_spec.rb
@@ -17,20 +17,6 @@ module WasteCarriersEngine
context "on next" do
include_examples "has next transition", next_state: "contact_phone_form"
end
-
- context "on back" do
- context "when declared_convictions is no" do
- let(:declared_convictions) { "no" }
-
- include_examples "has back transition", previous_state: "declare_convictions_form"
- end
-
- context "when declared_convictions is yes" do
- let(:declared_convictions) { "yes" }
-
- include_examples "has back transition", previous_state: "conviction_details_form"
- end
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/renewing_registration_workflow/contact_phone_form_spec.rb b/spec/models/waste_carriers_engine/renewing_registration_workflow/contact_phone_form_spec.rb
index 527794b19..154c91dd2 100644
--- a/spec/models/waste_carriers_engine/renewing_registration_workflow/contact_phone_form_spec.rb
+++ b/spec/models/waste_carriers_engine/renewing_registration_workflow/contact_phone_form_spec.rb
@@ -15,10 +15,6 @@ module WasteCarriersEngine
context "on next" do
include_examples "has next transition", next_state: "contact_email_form"
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "contact_name_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/renewing_registration_workflow/contact_postcode_form_spec.rb b/spec/models/waste_carriers_engine/renewing_registration_workflow/contact_postcode_form_spec.rb
index 6a86f5be6..de766ad80 100644
--- a/spec/models/waste_carriers_engine/renewing_registration_workflow/contact_postcode_form_spec.rb
+++ b/spec/models/waste_carriers_engine/renewing_registration_workflow/contact_postcode_form_spec.rb
@@ -6,7 +6,6 @@ module WasteCarriersEngine
RSpec.describe RenewingRegistration do
describe "#workflow_state" do
it_behaves_like "a postcode transition",
- previous_state: :contact_email_form,
address_type: "contact",
factory: :renewing_registration
end
diff --git a/spec/models/waste_carriers_engine/renewing_registration_workflow/conviction_details_form_spec.rb b/spec/models/waste_carriers_engine/renewing_registration_workflow/conviction_details_form_spec.rb
index f0929eecb..6fd726e28 100644
--- a/spec/models/waste_carriers_engine/renewing_registration_workflow/conviction_details_form_spec.rb
+++ b/spec/models/waste_carriers_engine/renewing_registration_workflow/conviction_details_form_spec.rb
@@ -15,10 +15,6 @@ module WasteCarriersEngine
context "on next" do
include_examples "has next transition", next_state: "contact_name_form"
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "declare_convictions_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/renewing_registration_workflow/declaration_form_spec.rb b/spec/models/waste_carriers_engine/renewing_registration_workflow/declaration_form_spec.rb
index ad65e846a..501433832 100644
--- a/spec/models/waste_carriers_engine/renewing_registration_workflow/declaration_form_spec.rb
+++ b/spec/models/waste_carriers_engine/renewing_registration_workflow/declaration_form_spec.rb
@@ -15,10 +15,6 @@ module WasteCarriersEngine
context "on next" do
include_examples "has next transition", next_state: "cards_form"
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "check_your_answers_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/renewing_registration_workflow/declare_convictions_form_spec.rb b/spec/models/waste_carriers_engine/renewing_registration_workflow/declare_convictions_form_spec.rb
index 2733e2839..dd4d01292 100644
--- a/spec/models/waste_carriers_engine/renewing_registration_workflow/declare_convictions_form_spec.rb
+++ b/spec/models/waste_carriers_engine/renewing_registration_workflow/declare_convictions_form_spec.rb
@@ -28,17 +28,6 @@ module WasteCarriersEngine
include_examples "has next transition", next_state: "contact_name_form"
end
end
-
- context "on back" do
- context "when the registered address was manually entered" do
- let(:registered_address) { build(:address, :registered, :manual_foreign) }
- subject { build(:renewing_registration, workflow_state: "declare_convictions_form", registered_address: registered_address) }
-
- include_examples "has back transition", previous_state: "company_address_manual_form"
- end
-
- include_examples "has back transition", previous_state: "company_address_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/renewing_registration_workflow/incorrect_company_form_spec.rb b/spec/models/waste_carriers_engine/renewing_registration_workflow/incorrect_company_form_spec.rb
deleted file mode 100644
index 16c616c67..000000000
--- a/spec/models/waste_carriers_engine/renewing_registration_workflow/incorrect_company_form_spec.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-require "rails_helper"
-
-module WasteCarriersEngine
- RSpec.describe RenewingRegistration, type: :model do
- subject do
- build(:renewing_registration, :has_required_data, workflow_state: "incorrect_company_form")
- end
-
- describe "#workflow_state" do
- context ":incorrect_company_form state transitions" do
- context "on back" do
- include_examples "has back transition", previous_state: "check_registered_company_name_form"
- end
- end
- end
- end
-end
diff --git a/spec/models/waste_carriers_engine/renewing_registration_workflow/location_form_spec.rb b/spec/models/waste_carriers_engine/renewing_registration_workflow/location_form_spec.rb
index fc279bf75..23cd5bcc9 100644
--- a/spec/models/waste_carriers_engine/renewing_registration_workflow/location_form_spec.rb
+++ b/spec/models/waste_carriers_engine/renewing_registration_workflow/location_form_spec.rb
@@ -30,10 +30,6 @@ module WasteCarriersEngine
end
end
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "renewal_start_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/renewing_registration_workflow/main_people_form_spec.rb b/spec/models/waste_carriers_engine/renewing_registration_workflow/main_people_form_spec.rb
index da850048e..e76129aca 100644
--- a/spec/models/waste_carriers_engine/renewing_registration_workflow/main_people_form_spec.rb
+++ b/spec/models/waste_carriers_engine/renewing_registration_workflow/main_people_form_spec.rb
@@ -19,20 +19,6 @@ module WasteCarriersEngine
context "on next" do
include_examples "has next transition", next_state: "company_name_form"
end
-
- context "on back" do
- context "when the business type is limited company" do
- let(:business_type) { "limitedCompany" }
-
- include_examples "has back transition", previous_state: "check_registered_company_name_form"
- end
-
- context "when the business type is sole trader" do
- let(:business_type) { "soleTrader" }
-
- include_examples "has back transition", previous_state: "cbd_type_form"
- end
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/renewing_registration_workflow/payment_summary_form_spec.rb b/spec/models/waste_carriers_engine/renewing_registration_workflow/payment_summary_form_spec.rb
index fef74e62c..b195ff23c 100644
--- a/spec/models/waste_carriers_engine/renewing_registration_workflow/payment_summary_form_spec.rb
+++ b/spec/models/waste_carriers_engine/renewing_registration_workflow/payment_summary_form_spec.rb
@@ -27,10 +27,6 @@ module WasteCarriersEngine
include_examples "has next transition", next_state: "confirm_bank_transfer_form"
end
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "cards_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/renewing_registration_workflow/register_in_northern_ireland_form_spec.rb b/spec/models/waste_carriers_engine/renewing_registration_workflow/register_in_northern_ireland_form_spec.rb
index c3607ba52..20853abcc 100644
--- a/spec/models/waste_carriers_engine/renewing_registration_workflow/register_in_northern_ireland_form_spec.rb
+++ b/spec/models/waste_carriers_engine/renewing_registration_workflow/register_in_northern_ireland_form_spec.rb
@@ -15,10 +15,6 @@ module WasteCarriersEngine
context "on next" do
include_examples "has next transition", next_state: "business_type_form"
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "location_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/renewing_registration_workflow/register_in_scotland_form_spec.rb b/spec/models/waste_carriers_engine/renewing_registration_workflow/register_in_scotland_form_spec.rb
index dffeba043..72ef64a16 100644
--- a/spec/models/waste_carriers_engine/renewing_registration_workflow/register_in_scotland_form_spec.rb
+++ b/spec/models/waste_carriers_engine/renewing_registration_workflow/register_in_scotland_form_spec.rb
@@ -15,10 +15,6 @@ module WasteCarriersEngine
context "on next" do
include_examples "has next transition", next_state: "business_type_form"
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "location_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/renewing_registration_workflow/register_in_wales_form_spec.rb b/spec/models/waste_carriers_engine/renewing_registration_workflow/register_in_wales_form_spec.rb
index c67d732fb..576f699c1 100644
--- a/spec/models/waste_carriers_engine/renewing_registration_workflow/register_in_wales_form_spec.rb
+++ b/spec/models/waste_carriers_engine/renewing_registration_workflow/register_in_wales_form_spec.rb
@@ -15,10 +15,6 @@ module WasteCarriersEngine
context "on next" do
include_examples "has next transition", next_state: "business_type_form"
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "location_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/renewing_registration_workflow/renewal_information_form_spec.rb b/spec/models/waste_carriers_engine/renewing_registration_workflow/renewal_information_form_spec.rb
index 378e4c0a6..b7a2238a0 100644
--- a/spec/models/waste_carriers_engine/renewing_registration_workflow/renewal_information_form_spec.rb
+++ b/spec/models/waste_carriers_engine/renewing_registration_workflow/renewal_information_form_spec.rb
@@ -68,10 +68,6 @@ module WasteCarriersEngine
include_examples "has next transition", next_state: "check_registered_company_name_form"
end
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "cbd_type_form"
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/renewing_registration_workflow/renewal_start_form_spec.rb b/spec/models/waste_carriers_engine/renewing_registration_workflow/renewal_start_form_spec.rb
index 552f36a35..45f64cae3 100644
--- a/spec/models/waste_carriers_engine/renewing_registration_workflow/renewal_start_form_spec.rb
+++ b/spec/models/waste_carriers_engine/renewing_registration_workflow/renewal_start_form_spec.rb
@@ -15,12 +15,6 @@ module WasteCarriersEngine
context "on next" do
include_examples "has next transition", next_state: "location_form"
end
-
- context "on back" do
- it "does not respond to the 'back' event" do
- expect(subject).to_not allow_event :back
- end
- end
end
end
end
diff --git a/spec/models/waste_carriers_engine/renewing_registration_workflow/worldpay_form_spec.rb b/spec/models/waste_carriers_engine/renewing_registration_workflow/worldpay_form_spec.rb
index 4db38a787..6d25efd06 100644
--- a/spec/models/waste_carriers_engine/renewing_registration_workflow/worldpay_form_spec.rb
+++ b/spec/models/waste_carriers_engine/renewing_registration_workflow/worldpay_form_spec.rb
@@ -74,10 +74,6 @@ module WasteCarriersEngine
end
end
end
-
- context "on back" do
- include_examples "has back transition", previous_state: "payment_summary_form"
- end
end
end
end
diff --git a/spec/requests/waste_carriers_engine/business_type_forms_spec.rb b/spec/requests/waste_carriers_engine/business_type_forms_spec.rb
index f7fbfe340..cbfc42c3b 100644
--- a/spec/requests/waste_carriers_engine/business_type_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/business_type_forms_spec.rb
@@ -62,50 +62,5 @@ module WasteCarriersEngine
end
end
end
-
- describe "GET back_business_type_forms_path" do
- context "when a valid user is signed in" do
- let(:user) { create(:user) }
- before(:each) do
- sign_in(user)
- end
-
- context "when a valid transient registration exists" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "business_type_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the location form" do
- get back_business_type_forms_path(transient_registration.token)
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_location_form_path(transient_registration.token))
- end
- end
- end
-
- context "when the transient registration is in the wrong state" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "location_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the correct form for the state" do
- get back_business_type_forms_path(transient_registration.token)
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_location_form_path(transient_registration.token))
- end
- end
- end
- end
- end
end
end
diff --git a/spec/requests/waste_carriers_engine/cannot_renew_type_change_forms_spec.rb b/spec/requests/waste_carriers_engine/cannot_renew_type_change_forms_spec.rb
index 1ec78709d..0c4ec4f20 100644
--- a/spec/requests/waste_carriers_engine/cannot_renew_type_change_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/cannot_renew_type_change_forms_spec.rb
@@ -5,50 +5,5 @@
module WasteCarriersEngine
RSpec.describe "CannotRenewTypeChangeForms", type: :request do
include_examples "GET flexible form", "cannot_renew_type_change_form"
-
- describe "GET back_cannot_renew_type_change_forms_path" do
- context "when a valid user is signed in" do
- let(:user) { create(:user) }
- before(:each) do
- sign_in(user)
- end
-
- context "when a valid transient registration exists" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "cannot_renew_type_change_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the business_type form" do
- get back_cannot_renew_type_change_forms_path(transient_registration.token)
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_business_type_form_path(transient_registration.token))
- end
- end
- end
-
- context "when the transient registration is in the wrong state" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "renewal_start_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the correct form for the state" do
- get back_cannot_renew_type_change_forms_path(transient_registration.token)
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_renewal_start_form_path(transient_registration.token))
- end
- end
- end
- end
- end
end
end
diff --git a/spec/requests/waste_carriers_engine/cards_forms_spec.rb b/spec/requests/waste_carriers_engine/cards_forms_spec.rb
index 98c642b41..79ad0fcf8 100644
--- a/spec/requests/waste_carriers_engine/cards_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/cards_forms_spec.rb
@@ -24,50 +24,5 @@ module WasteCarriersEngine
invalid_params: { temp_cards: 999_999 }
end
end
-
- describe "GET back_cards_forms_path" do
- context "when a valid user is signed in" do
- let(:user) { create(:user) }
- before(:each) do
- sign_in(user)
- end
-
- context "when a valid transient registration exists" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "cards_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the declaration form" do
- get back_cards_forms_path(transient_registration.token)
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_declaration_form_path(transient_registration.token))
- end
- end
- end
-
- context "when the transient registration is in the wrong state" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "renewal_start_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the correct form for the state" do
- get back_cards_forms_path(transient_registration.token)
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_renewal_start_form_path(transient_registration.token))
- end
- end
- end
- end
- end
end
end
diff --git a/spec/requests/waste_carriers_engine/cbd_type_forms_spec.rb b/spec/requests/waste_carriers_engine/cbd_type_forms_spec.rb
index 5d8fdb35b..575b92fa4 100644
--- a/spec/requests/waste_carriers_engine/cbd_type_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/cbd_type_forms_spec.rb
@@ -24,103 +24,5 @@ module WasteCarriersEngine
invalid_params: { registration_type: "foo" }
end
end
-
- describe "GET back_cbd_type_forms_path" do
- context "when a valid user is signed in" do
- let(:user) { create(:user) }
- before(:each) do
- sign_in(user)
- end
-
- context "when the back action is triggered" do
-
- context "for a new registration" do
- context "when a valid transient registration exists" do
- let(:transient_registration) do
- create(:new_registration,
- :has_required_data,
- account_email: user.email,
- temp_check_your_tier: temp_check_your_tier,
- workflow_state: "cbd_type_form")
- end
-
- context "when the answer to check your tier is upper" do
- let(:temp_check_your_tier) { "upper" }
-
- it "returns a 302 response and redirects to the check_your_tier form" do
- get back_cbd_type_forms_path(transient_registration.token)
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_check_your_tier_form_path(transient_registration.token))
- end
- end
-
- context "when the answer to check your tier is not upper" do
- let(:temp_check_your_tier) { "unknown" }
-
- it "returns a 302 response and redirects to the your_tier form" do
- get back_cbd_type_forms_path(transient_registration.token)
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_your_tier_form_path(transient_registration.token))
- end
- end
- end
- end
-
- context "for a renewing registration" do
- context "when a valid transient registration exists" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- location: location,
- workflow_state: "cbd_type_form")
- end
-
- context "when the business is not based overseas" do
- let(:location) { "england" }
-
- it "returns a 302 response and redirects to the business_type form" do
- get back_cbd_type_forms_path(transient_registration.token)
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_business_type_form_path(transient_registration.token))
- end
- end
-
- context "when the business is based overseas" do
- let(:location) { "overseas" }
-
- it "returns a 302 response and redirects to the location_tier form" do
- get back_cbd_type_forms_path(transient_registration.token)
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_location_form_path(transient_registration.token))
- end
- end
- end
- end
- end
-
- context "when the transient registration is in the wrong state" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "renewal_start_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the correct form for the state" do
- get back_cbd_type_forms_path(transient_registration.token)
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_renewal_start_form_path(transient_registration.token))
- end
- end
- end
- end
- end
end
end
diff --git a/spec/requests/waste_carriers_engine/check_registered_company_name_forms_spec.rb b/spec/requests/waste_carriers_engine/check_registered_company_name_forms_spec.rb
index 8f683dcfc..c5b422bc3 100644
--- a/spec/requests/waste_carriers_engine/check_registered_company_name_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/check_registered_company_name_forms_spec.rb
@@ -60,46 +60,5 @@ module WasteCarriersEngine
invalid_params: { temp_use_registered_company_details: "foo", company_no: "09360070" }
end
end
-
- describe "GET back_check_registered_company_name_form_path" do
- context "when a valid user is signed in" do
- let(:user) { create(:user) }
- before(:each) do
- sign_in(user)
- end
-
- context "for a new registration" do
- let(:transient_registration) do
- create(:new_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "check_registered_company_name_form")
- end
-
- it "returns a 302 response and redirects to the registration_number_form" do
- get back_check_registered_company_name_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(registration_number_forms_path(transient_registration[:token]))
- end
- end
-
- context "for a registration renewal" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "check_registered_company_name_form")
- end
-
- it "returns a 302 response and redirects to the renewal_information_form" do
- get back_check_registered_company_name_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(renewal_information_forms_path(transient_registration[:token]))
- end
- end
- end
- end
end
end
diff --git a/spec/requests/waste_carriers_engine/check_your_answers_forms_spec.rb b/spec/requests/waste_carriers_engine/check_your_answers_forms_spec.rb
index d2fbc56ee..ef8a8801c 100644
--- a/spec/requests/waste_carriers_engine/check_your_answers_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/check_your_answers_forms_spec.rb
@@ -11,50 +11,5 @@ module WasteCarriersEngine
include_examples "GET flexible form", "check_your_answers_form"
include_examples "POST without params form", "check_your_answers_form"
-
- describe "GET back_check_your_answers_forms_path" do
- context "when a valid user is signed in" do
- let(:user) { create(:user) }
- before(:each) do
- sign_in(user)
- end
-
- context "when a valid transient registration exists" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "check_your_answers_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the contact_address form" do
- get back_check_your_answers_forms_path(transient_registration.token)
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_contact_address_form_path(transient_registration.token))
- end
- end
- end
-
- context "when the transient registration is in the wrong state" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "renewal_start_form")
- end
-
- context "when the back action is triggered and redirects to the correct form for the state" do
- it "returns a 302 response" do
- get back_check_your_answers_forms_path(transient_registration.token)
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_renewal_start_form_path(transient_registration.token))
- end
- end
- end
- end
- end
end
end
diff --git a/spec/requests/waste_carriers_engine/check_your_tier_forms_spec.rb b/spec/requests/waste_carriers_engine/check_your_tier_forms_spec.rb
index 56682e673..7ae1bbbc3 100644
--- a/spec/requests/waste_carriers_engine/check_your_tier_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/check_your_tier_forms_spec.rb
@@ -46,41 +46,5 @@ module WasteCarriersEngine
valid_params: { temp_check_your_tier: "lower" },
invalid_params: { temp_check_your_tier: "foo" }
end
-
- describe "GET back_check_your_tier_forms_path" do
- context "when a valid transient registration exists" do
- let(:transient_registration) do
- create(:new_registration,
- :has_required_data,
- workflow_state: "check_your_tier_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the business_type form" do
- get back_check_your_tier_forms_path(transient_registration.token)
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_business_type_form_path(transient_registration.token))
- end
- end
- end
-
- context "when the transient registration is in the wrong state" do
- let(:transient_registration) do
- create(:new_registration,
- :has_required_data,
- workflow_state: "location_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the correct form for the state" do
- get back_check_your_tier_forms_path(transient_registration.token)
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_location_form_path(transient_registration.token))
- end
- end
- end
- end
end
end
diff --git a/spec/requests/waste_carriers_engine/company_address_forms_spec.rb b/spec/requests/waste_carriers_engine/company_address_forms_spec.rb
index f50607c5b..9e89652dc 100644
--- a/spec/requests/waste_carriers_engine/company_address_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/company_address_forms_spec.rb
@@ -120,53 +120,6 @@ module WasteCarriersEngine
end
end
- describe "GET back_company_address_forms_path" do
- context "when a valid user is signed in" do
- let(:user) { create(:user) }
- before(:each) do
- sign_in(user)
- end
-
- context "when a valid transient registration exists" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- :has_postcode,
- account_email: user.email,
- workflow_state: "company_address_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the company_postcode form" do
- get back_company_address_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_company_postcode_form_path(transient_registration[:token]))
- end
- end
- end
-
- context "when the transient registration is in the wrong state" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- :has_postcode,
- account_email: user.email,
- workflow_state: "renewal_start_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the correct form for the state" do
- get back_company_address_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_renewal_start_form_path(transient_registration[:token]))
- end
- end
- end
- end
- end
-
describe "GET skip_to_manual_address_company_address_forms_path" do
context "when a valid user is signed in" do
let(:user) { create(:user) }
diff --git a/spec/requests/waste_carriers_engine/company_address_manual_forms_spec.rb b/spec/requests/waste_carriers_engine/company_address_manual_forms_spec.rb
index dfb0e4f70..be08ec51d 100644
--- a/spec/requests/waste_carriers_engine/company_address_manual_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/company_address_manual_forms_spec.rb
@@ -114,65 +114,5 @@ module WasteCarriersEngine
end
end
end
-
- describe "GET back_company_address_manual_forms_path" do
- context "when a valid user is signed in" do
- let(:user) { create(:user) }
- before(:each) do
- sign_in(user)
- end
-
- context "when a valid transient registration exists" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "company_address_manual_form")
- end
-
- context "when the back action is triggered" do
- context "when the location is 'overseas'" do
- before(:each) { transient_registration.update_attributes(location: "overseas") }
-
- it "returns a 302 response and redirects to the company_name form" do
- get back_company_address_manual_forms_path(transient_registration.token)
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_company_name_form_path(transient_registration.token))
- end
- end
-
- context "when the location is not 'overseas'" do
- before(:each) { transient_registration.update_attributes(location: "england") }
-
- it "returns a 302 response and redirects to the company_postcode form" do
- get back_company_address_manual_forms_path(transient_registration.token)
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_company_postcode_form_path(transient_registration.token))
- end
- end
- end
- end
-
- context "when the transient registration is in the wrong state" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "renewal_start_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the correct form for the state" do
- get back_company_address_manual_forms_path(transient_registration.token)
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_renewal_start_form_path(transient_registration.token))
- end
- end
- end
- end
- end
end
end
diff --git a/spec/requests/waste_carriers_engine/company_name_forms_spec.rb b/spec/requests/waste_carriers_engine/company_name_forms_spec.rb
index 9695d97e6..fb93219ee 100644
--- a/spec/requests/waste_carriers_engine/company_name_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/company_name_forms_spec.rb
@@ -24,114 +24,5 @@ module WasteCarriersEngine
invalid_params: { company_name: "" }
end
end
-
- describe "GET back_company_name_forms_path" do
- context "when a valid user is signed in" do
- let(:user) { create(:user) }
- before(:each) do
- sign_in(user)
- end
-
- context "when a valid transient registration exists" do
- let(:tier) { WasteCarriersEngine::Registration::UPPER_TIER }
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- tier: tier,
- workflow_state: "company_name_form")
- end
-
- context "when the back action is triggered" do
-
- shared_examples "redirects to renewal_information or main_people form based on tier" do
- context "when upper tier" do
- let(:tier) { WasteCarriersEngine::Registration::UPPER_TIER }
- it "returns a 302 response and redirects to the main_people form" do
- get back_company_name_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_main_people_form_path(transient_registration[:token]))
- end
- end
-
- context "when lower tier" do
- let(:tier) { WasteCarriersEngine::Registration::LOWER_TIER }
- it "returns a 302 response and redirects to the renewal_information form" do
- get back_company_name_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_renewal_information_form_path(transient_registration[:token]))
- end
- end
- end
-
- context "when the business type is localAuthority" do
- before(:each) { transient_registration.update_attributes(business_type: "localAuthority") }
-
- it_behaves_like "redirects to renewal_information or main_people form based on tier"
- end
-
- context "when the business type is partnership" do
- before(:each) { transient_registration.update_attributes(business_type: "partnership") }
-
- it_behaves_like "redirects to renewal_information or main_people form based on tier"
- end
-
- context "when the business type is soleTrader" do
- before(:each) { transient_registration.update_attributes(business_type: "soleTrader") }
-
- it_behaves_like "redirects to renewal_information or main_people form based on tier"
- end
-
- context "when the location is overseas" do
- before(:each) { transient_registration.update_attributes(location: "overseas") }
-
- it_behaves_like "redirects to renewal_information or main_people form based on tier"
- end
-
- context "when the business type is limitedCompany" do
- before(:each) { transient_registration.update_attributes(business_type: "limitedCompany") }
-
- it "returns a 302 response and redirects to the check_registered_company_name form" do
- get back_company_name_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_check_registered_company_name_form_path(transient_registration[:token]))
- end
- end
-
- context "when the business type is limitedLiabilityPartnership" do
- before(:each) { transient_registration.update_attributes(business_type: "limitedLiabilityPartnership") }
-
- it "returns a 302 response and redirects to the check_registered_company_name form" do
- get back_company_name_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_check_registered_company_name_form_path(transient_registration[:token]))
- end
- end
- end
- end
-
- context "when the transient registration is in the wrong state" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "renewal_start_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the correct form for the state" do
- get back_company_name_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_renewal_start_form_path(transient_registration[:token]))
- end
- end
- end
- end
- end
end
end
diff --git a/spec/requests/waste_carriers_engine/company_postcode_forms_spec.rb b/spec/requests/waste_carriers_engine/company_postcode_forms_spec.rb
index 5d3ac36a3..4ec2976ad 100644
--- a/spec/requests/waste_carriers_engine/company_postcode_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/company_postcode_forms_spec.rb
@@ -83,56 +83,6 @@ module WasteCarriersEngine
end
end
- describe "GET back_company_postcode_forms_path" do
- context "when a valid user is signed in" do
- let(:user) { create(:user) }
- before(:each) do
- sign_in(user)
- end
-
- context "when a valid transient registration exists" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "company_postcode_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response" do
- get back_company_postcode_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- end
- end
-
- it "redirects to the company_name form" do
- get back_company_postcode_forms_path(transient_registration[:token])
-
- expect(response).to redirect_to(new_company_name_form_path(transient_registration[:token]))
- end
- end
-
- context "when the transient registration is in the wrong state" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "renewal_start_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the correct form for the state" do
- get back_company_postcode_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_renewal_start_form_path(transient_registration[:token]))
- end
- end
- end
- end
- end
-
describe "GET skip_to_manual_address_company_postcode_forms_path" do
context "when a valid user is signed in" do
let(:user) { create(:user) }
diff --git a/spec/requests/waste_carriers_engine/confirm_bank_transfer_forms_spec.rb b/spec/requests/waste_carriers_engine/confirm_bank_transfer_forms_spec.rb
index 537459c14..6eb982fde 100644
--- a/spec/requests/waste_carriers_engine/confirm_bank_transfer_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/confirm_bank_transfer_forms_spec.rb
@@ -102,52 +102,5 @@ module WasteCarriersEngine
end
end
end
-
- describe "GET back_confirm_bank_transfer_forms_path" do
- context "when a valid user is signed in" do
- let(:user) { create(:user) }
- before(:each) do
- sign_in(user)
- end
-
- context "when a valid transient registration exists" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- :has_unpaid_balance,
- account_email: user.email,
- workflow_state: "confirm_bank_transfer_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the payment_summary form" do
- get back_confirm_bank_transfer_forms_path(transient_registration.token)
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_payment_summary_form_path(transient_registration.token))
- end
- end
- end
-
- context "when the transient registration is in the wrong state" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- :has_unpaid_balance,
- account_email: user.email,
- workflow_state: "renewal_start_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the correct form for the state" do
- get back_confirm_bank_transfer_forms_path(transient_registration.token)
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_renewal_start_form_path(transient_registration.token))
- end
- end
- end
- end
- end
end
end
diff --git a/spec/requests/waste_carriers_engine/confirm_edit_cancelled_forms_spec.rb b/spec/requests/waste_carriers_engine/confirm_edit_cancelled_forms_spec.rb
index ccd0cc581..c7cde4bb7 100644
--- a/spec/requests/waste_carriers_engine/confirm_edit_cancelled_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/confirm_edit_cancelled_forms_spec.rb
@@ -63,44 +63,5 @@ module WasteCarriersEngine
end
end
end
-
- describe "GET back_confirm_edit_cancelled_forms_path" do
- context "when a valid user is signed in" do
- let(:user) { create(:user) }
- before(:each) do
- sign_in(user)
- end
-
- context "when a valid transient registration exists" do
- let(:transient_registration) do
- create(:edit_registration,
- workflow_state: "confirm_edit_cancelled_form")
- end
-
- context "when the back action is triggered" do
- it "redirects to the edit form" do
- get back_confirm_edit_cancelled_forms_path(transient_registration[:token])
-
- expect(response).to redirect_to(new_edit_form_path(transient_registration[:token]))
- end
- end
- end
-
- context "when the transient registration is in the wrong state" do
- let(:transient_registration) do
- create(:edit_registration,
- workflow_state: "location_form")
- end
-
- context "when the back action is triggered" do
- it "redirects to the correct form for the state" do
- get back_confirm_edit_cancelled_forms_path(transient_registration[:token])
-
- expect(response).to redirect_to(new_location_form_path(transient_registration[:token]))
- end
- end
- end
- end
- end
end
end
diff --git a/spec/requests/waste_carriers_engine/construction_demolition_forms_spec.rb b/spec/requests/waste_carriers_engine/construction_demolition_forms_spec.rb
index 0a82669c8..9ac7f3442 100644
--- a/spec/requests/waste_carriers_engine/construction_demolition_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/construction_demolition_forms_spec.rb
@@ -18,65 +18,5 @@ module WasteCarriersEngine
invalid_params: { construction_waste: "foo" }
end
end
-
- describe "GET back_construction_demolition_forms_path" do
- context "when a valid user is signed in" do
- let(:user) { create(:user) }
- before(:each) do
- sign_in(user)
- end
-
- context "when a valid transient registration exists" do
- let(:transient_registration) do
- create(:new_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "construction_demolition_form")
- end
-
- context "when the back action is triggered" do
- context "when the business does not carry waste for other businesses or households" do
- before(:each) { transient_registration.update_attributes(other_businesses: "no") }
-
- it "returns a 302 response and redirects to the other_businesses form" do
- get back_construction_demolition_forms_path(transient_registration.token)
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_other_businesses_form_path(transient_registration.token))
- end
- end
-
- context "when the business does carry waste for other businesses or households" do
- before(:each) { transient_registration.update_attributes(other_businesses: "yes") }
-
- it "returns a 302 response and redirects to the service_provided form" do
- get back_construction_demolition_forms_path(transient_registration.token)
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_service_provided_form_path(transient_registration.token))
- end
- end
- end
- end
-
- context "when the transient registration is in the wrong state" do
- let(:transient_registration) do
- create(:new_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "renewal_start_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the correct form for the state" do
- get back_construction_demolition_forms_path(transient_registration.token)
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_renewal_start_form_path(transient_registration.token))
- end
- end
- end
- end
- end
end
end
diff --git a/spec/requests/waste_carriers_engine/contact_address_forms_spec.rb b/spec/requests/waste_carriers_engine/contact_address_forms_spec.rb
index 4dbdd16da..c062f4294 100644
--- a/spec/requests/waste_carriers_engine/contact_address_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/contact_address_forms_spec.rb
@@ -87,53 +87,6 @@ module WasteCarriersEngine
end
end
- describe "GET back_contact_address_forms_path" do
- context "when a valid user is signed in" do
- let(:user) { create(:user) }
- before(:each) do
- sign_in(user)
- end
-
- context "when a valid transient registration exists" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- :has_postcode,
- account_email: user.email,
- workflow_state: "contact_address_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the contact_postcode form" do
- get back_contact_address_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_contact_postcode_form_path(transient_registration[:token]))
- end
- end
- end
-
- context "when the transient registration is in the wrong state" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- :has_postcode,
- account_email: user.email,
- workflow_state: "renewal_start_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the correct form for the state" do
- get back_contact_address_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_renewal_start_form_path(transient_registration[:token]))
- end
- end
- end
- end
- end
-
describe "GET skip_to_manual_address_contact_address_forms_path" do
context "when a valid user is signed in" do
let(:user) { create(:user) }
diff --git a/spec/requests/waste_carriers_engine/contact_address_manual_forms_spec.rb b/spec/requests/waste_carriers_engine/contact_address_manual_forms_spec.rb
index 8f8b4b0af..867a1a48b 100644
--- a/spec/requests/waste_carriers_engine/contact_address_manual_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/contact_address_manual_forms_spec.rb
@@ -95,59 +95,5 @@ module WasteCarriersEngine
end
end
end
-
- describe "GET back_contact_address_manual_forms_path" do
- context "when a valid user is signed in" do
- let(:user) { create(:user) }
- before(:each) do
- sign_in(user)
- end
-
- context "when a valid transient registration exists" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "contact_address_manual_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the contact_postcode form" do
- get back_contact_address_manual_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_contact_postcode_form_path(transient_registration[:token]))
- end
-
- context "when the location is 'overseas'" do
- before(:each) { transient_registration.update_attributes(location: "overseas") }
-
- it "redirects to the contact_email form" do
- get back_contact_address_manual_forms_path(transient_registration[:token])
- expect(response).to redirect_to(new_contact_email_form_path(transient_registration[:token]))
- end
- end
- end
- end
-
- context "when the transient registration is in the wrong state" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "renewal_start_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the correct form for the state" do
- get back_contact_address_manual_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_renewal_start_form_path(transient_registration[:token]))
- end
- end
- end
- end
- end
end
end
diff --git a/spec/requests/waste_carriers_engine/contact_address_reuse_forms_spec.rb b/spec/requests/waste_carriers_engine/contact_address_reuse_forms_spec.rb
index 890f6d396..2f82f7a4a 100644
--- a/spec/requests/waste_carriers_engine/contact_address_reuse_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/contact_address_reuse_forms_spec.rb
@@ -56,27 +56,5 @@ module WasteCarriersEngine
end
end
end
-
- describe "GET back_contact_address_reuse_form_path" do
- context "when a valid user is signed in" do
- context "when a valid transient registration exists" do
- let(:transient_registration) do
- create(:new_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "contact_address_reuse_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the contact_email form" do
- get back_contact_address_reuse_forms_path(transient_registration.token)
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_contact_email_form_path(transient_registration.token))
- end
- end
- end
- end
- end
end
end
diff --git a/spec/requests/waste_carriers_engine/contact_email_forms_spec.rb b/spec/requests/waste_carriers_engine/contact_email_forms_spec.rb
index d96142680..2d2be1025 100644
--- a/spec/requests/waste_carriers_engine/contact_email_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/contact_email_forms_spec.rb
@@ -24,50 +24,5 @@ module WasteCarriersEngine
invalid_params: { contact_email: "bar", confirmed_email: "baz" }
end
end
-
- describe "GET back_contact_email_forms_path" do
- context "when a valid user is signed in" do
- let(:user) { create(:user) }
- before(:each) do
- sign_in(user)
- end
-
- context "when a valid transient registration exists" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "contact_email_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the contact_phone form" do
- get back_contact_email_forms_path(transient_registration.token)
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_contact_phone_form_path(transient_registration.token))
- end
- end
- end
-
- context "when the transient registration is in the wrong state" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "renewal_start_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the correct form for the state" do
- get back_contact_email_forms_path(transient_registration.token)
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_renewal_start_form_path(transient_registration.token))
- end
- end
- end
- end
- end
end
end
diff --git a/spec/requests/waste_carriers_engine/contact_name_forms_spec.rb b/spec/requests/waste_carriers_engine/contact_name_forms_spec.rb
index ab2d33a67..55a98ea55 100644
--- a/spec/requests/waste_carriers_engine/contact_name_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/contact_name_forms_spec.rb
@@ -24,50 +24,5 @@ module WasteCarriersEngine
invalid_params: { first_name: "", last_name: "" }
end
end
-
- describe "GET back_contact_name_forms_path" do
- context "when a valid user is signed in" do
- let(:user) { create(:user) }
- before(:each) do
- sign_in(user)
- end
-
- context "when a valid transient registration exists" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "contact_name_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the declare_convictions form" do
- get back_contact_name_forms_path(transient_registration.token)
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_declare_convictions_form_path(transient_registration.token))
- end
- end
- end
-
- context "when the transient registration is in the wrong state" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "renewal_start_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the correct form for the state" do
- get back_contact_name_forms_path(transient_registration.token)
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_renewal_start_form_path(transient_registration.token))
- end
- end
- end
- end
- end
end
end
diff --git a/spec/requests/waste_carriers_engine/contact_phone_forms_spec.rb b/spec/requests/waste_carriers_engine/contact_phone_forms_spec.rb
index 4e0ff78b0..9169d9e24 100644
--- a/spec/requests/waste_carriers_engine/contact_phone_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/contact_phone_forms_spec.rb
@@ -24,50 +24,5 @@ module WasteCarriersEngine
invalid_params: { phone_number: "foo" }
end
end
-
- describe "GET back_contact_phone_forms_path" do
- context "when a valid user is signed in" do
- let(:user) { create(:user) }
- before(:each) do
- sign_in(user)
- end
-
- context "when a valid transient registration exists" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "contact_phone_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the contact_name form" do
- get back_contact_phone_forms_path(transient_registration.token)
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_contact_name_form_path(transient_registration.token))
- end
- end
- end
-
- context "when the transient registration is in the wrong state" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "renewal_start_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the correct form for the state" do
- get back_contact_phone_forms_path(transient_registration.token)
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_renewal_start_form_path(transient_registration.token))
- end
- end
- end
- end
- end
end
end
diff --git a/spec/requests/waste_carriers_engine/contact_postcode_forms_spec.rb b/spec/requests/waste_carriers_engine/contact_postcode_forms_spec.rb
index bb728c4ed..281079f7f 100644
--- a/spec/requests/waste_carriers_engine/contact_postcode_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/contact_postcode_forms_spec.rb
@@ -96,51 +96,6 @@ module WasteCarriersEngine
end
end
- describe "GET back_contact_postcode_forms_path" do
- context "when a valid user is signed in" do
- let(:user) { create(:user) }
- before(:each) do
- sign_in(user)
- end
-
- context "when a valid transient registration exists" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "contact_postcode_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the contact_email form" do
- get back_contact_postcode_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_contact_email_form_path(transient_registration[:token]))
- end
- end
- end
-
- context "when the transient registration is in the wrong state" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "renewal_start_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the correct form for the state" do
- get back_contact_postcode_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_renewal_start_form_path(transient_registration[:token]))
- end
- end
- end
- end
- end
-
describe "GET skip_to_manual_address_contact_postcode_forms_path" do
context "when a valid user is signed in" do
let(:user) { create(:user) }
diff --git a/spec/requests/waste_carriers_engine/conviction_details_forms_spec.rb b/spec/requests/waste_carriers_engine/conviction_details_forms_spec.rb
index 6d3e8f39d..2e7a06be8 100644
--- a/spec/requests/waste_carriers_engine/conviction_details_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/conviction_details_forms_spec.rb
@@ -174,51 +174,6 @@ module WasteCarriersEngine
end
end
- describe "GET back_conviction_details_forms_path" do
- context "when a valid user is signed in" do
- let(:user) { create(:user) }
- before(:each) do
- sign_in(user)
- end
-
- context "when a valid transient registration exists" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "conviction_details_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the declare_convictions form" do
- get back_conviction_details_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_declare_convictions_form_path(transient_registration[:token]))
- end
- end
- end
-
- context "when the transient registration is in the wrong state" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "renewal_start_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the correct form for the state" do
- get back_conviction_details_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_renewal_start_form_path(transient_registration[:token]))
- end
- end
- end
- end
- end
-
describe "DELETE delete_person_conviction_details_forms_path" do
context "when a valid user is signed in" do
let(:user) { create(:user) }
diff --git a/spec/requests/waste_carriers_engine/copy_cards_bank_transfer_forms_spec.rb b/spec/requests/waste_carriers_engine/copy_cards_bank_transfer_forms_spec.rb
index 746b9fc37..08f710cf8 100644
--- a/spec/requests/waste_carriers_engine/copy_cards_bank_transfer_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/copy_cards_bank_transfer_forms_spec.rb
@@ -66,44 +66,5 @@ module WasteCarriersEngine
end
end
end
-
- describe "GET back_copy_cards_bank_transfer_forms_path" do
- context "when a valid user is signed in" do
- let(:user) { create(:user) }
- before(:each) do
- sign_in(user)
- end
-
- context "when a valid transient registration exists" do
- let(:transient_registration) do
- create(:order_copy_cards_registration, workflow_state: :copy_cards_bank_transfer_form)
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the payment_summary form" do
- get back_copy_cards_bank_transfer_forms_path(transient_registration.token)
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_copy_cards_payment_form_path(transient_registration.token))
- end
- end
- end
-
- context "when the transient registration is in the wrong state" do
- let(:transient_registration) do
- create(:order_copy_cards_registration, workflow_state: :copy_cards_bank_transfer_form)
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the correct form for the state" do
- get back_copy_cards_bank_transfer_forms_path(transient_registration.token)
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_copy_cards_payment_form_path(transient_registration.token))
- end
- end
- end
- end
- end
end
end
diff --git a/spec/requests/waste_carriers_engine/declaration_forms_spec.rb b/spec/requests/waste_carriers_engine/declaration_forms_spec.rb
index c3e0d0ea5..ef8e6130a 100644
--- a/spec/requests/waste_carriers_engine/declaration_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/declaration_forms_spec.rb
@@ -56,50 +56,5 @@ module WasteCarriersEngine
end
end
end
-
- describe "GET back_declaration_forms_path" do
- context "when a valid user is signed in" do
- let(:user) { create(:user) }
- before(:each) do
- sign_in(user)
- end
-
- context "when a valid transient registration exists" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "declaration_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the check_your_answers form" do
- get back_declaration_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_check_your_answers_form_path(transient_registration[:token]))
- end
- end
- end
-
- context "when the transient registration is in the wrong state" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "renewal_start_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the correct form for the state" do
- get back_declaration_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_renewal_start_form_path(transient_registration[:token]))
- end
- end
- end
- end
- end
end
end
diff --git a/spec/requests/waste_carriers_engine/declare_convictions_forms_spec.rb b/spec/requests/waste_carriers_engine/declare_convictions_forms_spec.rb
index 7bf9bb60a..97d00d2bc 100644
--- a/spec/requests/waste_carriers_engine/declare_convictions_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/declare_convictions_forms_spec.rb
@@ -24,50 +24,5 @@ module WasteCarriersEngine
invalid_params: { declared_convictions: "foo" }
end
end
-
- describe "GET back_declare_convictions_forms_path" do
- context "when a valid user is signed in" do
- let(:user) { create(:user) }
- before(:each) do
- sign_in(user)
- end
-
- context "when a valid transient registration exists" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "declare_convictions_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the company_address form" do
- get back_declare_convictions_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_company_address_form_path(transient_registration[:token]))
- end
- end
- end
-
- context "when the transient registration is in the wrong state" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "renewal_start_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the correct form for the state" do
- get back_declare_convictions_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_renewal_start_form_path(transient_registration[:token]))
- end
- end
- end
- end
- end
end
end
diff --git a/spec/requests/waste_carriers_engine/edit_bank_transfer_forms_spec.rb b/spec/requests/waste_carriers_engine/edit_bank_transfer_forms_spec.rb
index e44274ed2..b389f6a3a 100644
--- a/spec/requests/waste_carriers_engine/edit_bank_transfer_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/edit_bank_transfer_forms_spec.rb
@@ -66,44 +66,5 @@ module WasteCarriersEngine
end
end
end
-
- describe "GET back_edit_bank_transfer_forms_path" do
- context "when a valid user is signed in" do
- let(:user) { create(:user) }
- before(:each) do
- sign_in(user)
- end
-
- context "when a valid transient registration exists" do
- let(:transient_registration) do
- create(:edit_registration, workflow_state: :edit_bank_transfer_form)
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the payment_summary form" do
- get back_edit_bank_transfer_forms_path(transient_registration.token)
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_edit_payment_summary_form_path(transient_registration.token))
- end
- end
- end
-
- context "when the transient registration is in the wrong state" do
- let(:transient_registration) do
- create(:edit_registration, workflow_state: :location_form)
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the correct form for the state" do
- get back_edit_bank_transfer_forms_path(transient_registration.token)
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_location_form_path(transient_registration.token))
- end
- end
- end
- end
- end
end
end
diff --git a/spec/requests/waste_carriers_engine/incorrect_company_forms_spec.rb b/spec/requests/waste_carriers_engine/incorrect_company_forms_spec.rb
index fecb0cbd8..da5697f14 100644
--- a/spec/requests/waste_carriers_engine/incorrect_company_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/incorrect_company_forms_spec.rb
@@ -18,32 +18,5 @@ module WasteCarriersEngine
expect(response).to redirect_to(new_registration_number_form_path(transient_registration.token))
end
end
-
- describe "GET back_incorrect_company_form_path" do
- context "when a valid user is signed in" do
- let(:user) { create(:user) }
- before(:each) do
- sign_in(user)
- end
-
- context "when a valid transient registration exists" do
- let(:transient_registration) do
- create(:new_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "incorrect_company_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the check_registered_company_name" do
- get back_incorrect_company_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(check_registered_company_name_forms_path(transient_registration[:token]))
- end
- end
- end
- end
- end
end
end
diff --git a/spec/requests/waste_carriers_engine/location_forms_spec.rb b/spec/requests/waste_carriers_engine/location_forms_spec.rb
index 44d943e63..35e3fd28d 100644
--- a/spec/requests/waste_carriers_engine/location_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/location_forms_spec.rb
@@ -50,50 +50,5 @@ module WasteCarriersEngine
end
end
end
-
- describe "GET back_location_forms_path" do
- context "when a valid user is signed in" do
- let(:user) { create(:user) }
- before(:each) do
- sign_in(user)
- end
-
- context "when a valid transient registration exists" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "location_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the renewal_start form" do
- get back_location_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_renewal_start_form_path(transient_registration[:token]))
- end
- end
- end
-
- context "when the transient registration is in the wrong state" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "company_name_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the correct form for the state" do
- get back_location_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_company_name_form_path(transient_registration[:token]))
- end
- end
- end
- end
- end
end
end
diff --git a/spec/requests/waste_carriers_engine/main_people_forms_spec.rb b/spec/requests/waste_carriers_engine/main_people_forms_spec.rb
index 71225cf85..131972f2a 100644
--- a/spec/requests/waste_carriers_engine/main_people_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/main_people_forms_spec.rb
@@ -196,66 +196,6 @@ module WasteCarriersEngine
end
end
- describe "GET back_main_people_forms_path" do
- context "when a valid user is signed in" do
- let(:user) { create(:user) }
- before(:each) do
- sign_in(user)
- end
-
- context "when a valid transient registration exists" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- business_type: defined?(business_type) ? business_type : "limitedCompany",
- workflow_state: "main_people_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response" do
- get back_main_people_forms_path(transient_registration[:token])
- expect(response).to have_http_status(302)
- end
-
- context "when the business type is limitedCompany" do
- let(:business_type) { "limitedCompany" }
- it "redirects to the check_registered_company_name form" do
- get back_main_people_forms_path(transient_registration[:token])
- expect(response).to redirect_to(new_check_registered_company_name_form_path(transient_registration[:token]))
- end
- end
-
- context "when the business type is soleTrader" do
- let(:business_type) { "soleTrader" }
- it "redirects to the cbd_type form" do
- get back_main_people_forms_path(transient_registration[:token])
- expect(response).to redirect_to(new_cbd_type_form_path(transient_registration[:token]))
- end
- end
- end
- end
-
- context "when the transient registration is in the wrong state" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "renewal_start_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the correct form for the state" do
- get back_main_people_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_renewal_start_form_path(transient_registration[:token]))
- end
- end
- end
- end
- end
-
describe "DELETE delete_person_main_people_forms_path" do
context "when a valid user is signed in" do
let(:user) { create(:user) }
diff --git a/spec/requests/waste_carriers_engine/other_businesses_forms_spec.rb b/spec/requests/waste_carriers_engine/other_businesses_forms_spec.rb
index e20cbc459..30d9b3d7c 100644
--- a/spec/requests/waste_carriers_engine/other_businesses_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/other_businesses_forms_spec.rb
@@ -19,50 +19,5 @@ module WasteCarriersEngine
invalid_params: { other_businesses: "foo" }
end
end
-
- describe "GET back_other_businesses_forms_path" do
- context "when a valid user is signed in" do
- let(:user) { create(:user) }
- before(:each) do
- sign_in(user)
- end
-
- context "when a valid transient registration exists" do
- let(:transient_registration) do
- create(:new_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "other_businesses_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the check_your_tier form" do
- get back_other_businesses_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_check_your_tier_form_path(transient_registration[:token]))
- end
- end
- end
-
- context "when the transient registration is in the wrong state" do
- let(:transient_registration) do
- create(:new_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "renewal_start_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the correct form for the state" do
- get back_other_businesses_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_renewal_start_form_path(transient_registration[:token]))
- end
- end
- end
- end
- end
end
end
diff --git a/spec/requests/waste_carriers_engine/payment_summary_forms_spec.rb b/spec/requests/waste_carriers_engine/payment_summary_forms_spec.rb
index c632d1c03..168543c2c 100644
--- a/spec/requests/waste_carriers_engine/payment_summary_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/payment_summary_forms_spec.rb
@@ -24,50 +24,5 @@ module WasteCarriersEngine
invalid_params: { temp_payment_method: "foo" }
end
end
-
- describe "GET back_payment_summary_forms_path" do
- context "when a valid user is signed in" do
- let(:user) { create(:user) }
- before(:each) do
- sign_in(user)
- end
-
- context "when a valid transient registration exists" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "payment_summary_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the cards form" do
- get back_payment_summary_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_cards_form_path(transient_registration[:token]))
- end
- end
- end
-
- context "when the transient registration is in the wrong state" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "renewal_start_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the correct form for the state" do
- get back_payment_summary_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_renewal_start_form_path(transient_registration[:token]))
- end
- end
- end
- end
- end
end
end
diff --git a/spec/requests/waste_carriers_engine/register_in_northern_ireland_forms_spec.rb b/spec/requests/waste_carriers_engine/register_in_northern_ireland_forms_spec.rb
index f53146763..862037e60 100644
--- a/spec/requests/waste_carriers_engine/register_in_northern_ireland_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/register_in_northern_ireland_forms_spec.rb
@@ -7,50 +7,5 @@ module WasteCarriersEngine
include_examples "GET flexible form", "register_in_northern_ireland_form"
include_examples "POST without params form", "register_in_northern_ireland_form"
-
- describe "GET back_register_in_northern_ireland_forms_path" do
- context "when a valid user is signed in" do
- let(:user) { create(:user) }
- before(:each) do
- sign_in(user)
- end
-
- context "when a valid transient registration exists" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "register_in_northern_ireland_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the location form" do
- get back_register_in_northern_ireland_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_location_form_path(transient_registration[:token]))
- end
- end
- end
-
- context "when the transient registration is in the wrong state" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "renewal_start_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the correct form for the state" do
- get back_register_in_northern_ireland_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_renewal_start_form_path(transient_registration[:token]))
- end
- end
- end
- end
- end
end
end
diff --git a/spec/requests/waste_carriers_engine/register_in_scotland_forms_spec.rb b/spec/requests/waste_carriers_engine/register_in_scotland_forms_spec.rb
index 809fd878a..396d74778 100644
--- a/spec/requests/waste_carriers_engine/register_in_scotland_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/register_in_scotland_forms_spec.rb
@@ -7,50 +7,5 @@ module WasteCarriersEngine
include_examples "GET flexible form", "register_in_scotland_form"
include_examples "POST without params form", "register_in_scotland_form"
-
- describe "GET back_register_in_scotland_forms_path" do
- context "when a valid user is signed in" do
- let(:user) { create(:user) }
- before(:each) do
- sign_in(user)
- end
-
- context "when a valid transient registration exists" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "register_in_scotland_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the location form" do
- get back_register_in_scotland_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_location_form_path(transient_registration[:token]))
- end
- end
- end
-
- context "when the transient registration is in the wrong state" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "renewal_start_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the correct form for the state" do
- get back_register_in_scotland_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_renewal_start_form_path(transient_registration[:token]))
- end
- end
- end
- end
- end
end
end
diff --git a/spec/requests/waste_carriers_engine/register_in_wales_forms_spec.rb b/spec/requests/waste_carriers_engine/register_in_wales_forms_spec.rb
index b136c0f1a..e47b408e8 100644
--- a/spec/requests/waste_carriers_engine/register_in_wales_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/register_in_wales_forms_spec.rb
@@ -7,50 +7,5 @@ module WasteCarriersEngine
include_examples "GET flexible form", "register_in_wales_form"
include_examples "POST without params form", "register_in_wales_form"
-
- describe "GET back_register_in_wales_forms_path" do
- context "when a valid user is signed in" do
- let(:user) { create(:user) }
- before(:each) do
- sign_in(user)
- end
-
- context "when a valid transient registration exists" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "register_in_wales_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the location form" do
- get back_register_in_wales_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_location_form_path(transient_registration[:token]))
- end
- end
- end
-
- context "when the transient registration is in the wrong state" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "renewal_start_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the correct form for the state" do
- get back_register_in_wales_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_renewal_start_form_path(transient_registration[:token]))
- end
- end
- end
- end
- end
end
end
diff --git a/spec/requests/waste_carriers_engine/registration_number_forms_spec.rb b/spec/requests/waste_carriers_engine/registration_number_forms_spec.rb
index b71063c63..131f99da1 100644
--- a/spec/requests/waste_carriers_engine/registration_number_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/registration_number_forms_spec.rb
@@ -66,50 +66,5 @@ module WasteCarriersEngine
end
end
end
-
- describe "GET back_registration_number_forms_path" do
- context "when a valid user is signed in" do
- let(:user) { create(:user) }
- before(:each) do
- sign_in(user)
- end
-
- context "when a valid transient registration exists" do
- let(:transient_registration) do
- create(:new_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "registration_number_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the renewal_information form" do
- get back_registration_number_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_cbd_type_form_path(transient_registration[:token]))
- end
- end
- end
-
- context "when the transient registration is in the wrong state" do
- let(:transient_registration) do
- create(:new_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "renewal_start_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response" do
- get back_registration_number_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_renewal_start_form_path(transient_registration[:token]))
- end
- end
- end
- end
- end
end
end
diff --git a/spec/requests/waste_carriers_engine/renew_registration_forms_spec.rb b/spec/requests/waste_carriers_engine/renew_registration_forms_spec.rb
index a975781d2..6477598fe 100644
--- a/spec/requests/waste_carriers_engine/renew_registration_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/renew_registration_forms_spec.rb
@@ -126,46 +126,5 @@ module WasteCarriersEngine
end
end
end
-
- describe "GET back_renew_registration_forms_path" do
- context "when a valid user is signed in" do
- let(:user) { create(:user) }
- before(:each) do
- sign_in(user)
- end
-
- context "when a valid transient registration exists" do
- let(:transient_registration) do
- create(:new_registration,
- workflow_state: "renew_registration_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the start form" do
- get back_renew_registration_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_start_form_path(params: { token: transient_registration[:token] }))
- end
- end
- end
-
- context "when the transient registration is in the wrong state" do
- let(:transient_registration) do
- create(:new_registration,
- workflow_state: "contact_name_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the correct form for the state" do
- get back_renew_registration_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_contact_name_form_path(transient_registration[:token]))
- end
- end
- end
- end
- end
end
end
diff --git a/spec/requests/waste_carriers_engine/renewal_information_forms_spec.rb b/spec/requests/waste_carriers_engine/renewal_information_forms_spec.rb
index 6fe166e1c..c41bd9833 100644
--- a/spec/requests/waste_carriers_engine/renewal_information_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/renewal_information_forms_spec.rb
@@ -7,50 +7,5 @@ module WasteCarriersEngine
include_examples "GET flexible form", "renewal_information_form"
include_examples "POST without params form", "renewal_information_form"
-
- describe "GET back_renewal_information_forms_path" do
- context "when a valid user is signed in" do
- let(:user) { create(:user) }
- before(:each) do
- sign_in(user)
- end
-
- context "when a valid transient registration exists" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "renewal_information_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the cbd_type form" do
- get back_renewal_information_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_cbd_type_form_path(transient_registration[:token]))
- end
- end
- end
-
- context "when the transient registration is in the wrong state" do
- let(:transient_registration) do
- create(:renewing_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "renewal_start_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the correct form for the state" do
- get back_renewal_information_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_renewal_start_form_path(transient_registration[:token]))
- end
- end
- end
- end
- end
end
end
diff --git a/spec/requests/waste_carriers_engine/service_provided_forms_spec.rb b/spec/requests/waste_carriers_engine/service_provided_forms_spec.rb
index ad2a47387..4f6c6364a 100644
--- a/spec/requests/waste_carriers_engine/service_provided_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/service_provided_forms_spec.rb
@@ -18,50 +18,5 @@ module WasteCarriersEngine
invalid_params: { is_main_service: "foo" }
end
end
-
- describe "GET back_service_provided_forms_path" do
- context "when a valid user is signed in" do
- let(:user) { create(:user) }
- before(:each) do
- sign_in(user)
- end
-
- context "when a valid transient registration exists" do
- let(:transient_registration) do
- create(:new_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "service_provided_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the other_businesses form" do
- get back_service_provided_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_other_businesses_form_path(transient_registration[:token]))
- end
- end
- end
-
- context "when the transient registration is in the wrong state" do
- let(:transient_registration) do
- create(:new_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "renewal_start_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the correct form for the state" do
- get back_service_provided_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_renewal_start_form_path(transient_registration[:token]))
- end
- end
- end
- end
- end
end
end
diff --git a/spec/requests/waste_carriers_engine/waste_types_forms_spec.rb b/spec/requests/waste_carriers_engine/waste_types_forms_spec.rb
index 62d21b28c..5deb8be65 100644
--- a/spec/requests/waste_carriers_engine/waste_types_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/waste_types_forms_spec.rb
@@ -18,50 +18,5 @@ module WasteCarriersEngine
invalid_params: { only_amf: "foo" }
end
end
-
- describe "GET back_waste_types_forms_path" do
- context "when a valid user is signed in" do
- let(:user) { create(:user) }
- before(:each) do
- sign_in(user)
- end
-
- context "when a valid transient registration exists" do
- let(:transient_registration) do
- create(:new_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "waste_types_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the service_provided form" do
- get back_waste_types_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_service_provided_form_path(transient_registration[:token]))
- end
- end
- end
-
- context "when the transient registration is in the wrong state" do
- let(:transient_registration) do
- create(:new_registration,
- :has_required_data,
- account_email: user.email,
- workflow_state: "renewal_start_form")
- end
-
- context "when the back action is triggered" do
- it "returns a 302 response and redirects to the correct form for the state" do
- get back_waste_types_forms_path(transient_registration[:token])
-
- expect(response).to have_http_status(302)
- expect(response).to redirect_to(new_renewal_start_form_path(transient_registration[:token]))
- end
- end
- end
- end
- end
end
end
diff --git a/spec/requests/waste_carriers_engine/worldpay_forms_spec.rb b/spec/requests/waste_carriers_engine/worldpay_forms_spec.rb
index 5dc60aa29..5080bf243 100644
--- a/spec/requests/waste_carriers_engine/worldpay_forms_spec.rb
+++ b/spec/requests/waste_carriers_engine/worldpay_forms_spec.rb
@@ -22,7 +22,8 @@ module WasteCarriersEngine
:has_conviction_search_result,
:has_key_people,
account_email: user.email,
- workflow_state: "worldpay_form")
+ workflow_state: "worldpay_form",
+ workflow_history: ["payment_summary_form"])
end
let(:token) { transient_registration[:token] }
From 7d880d35121d3cf5fe8ef97674e17a51191c9a2a Mon Sep 17 00:00:00 2001
From: PaulDoyle-DEFRA <97455399+PaulDoyle-DEFRA@users.noreply.github.com>
Date: Wed, 1 Jun 2022 14:25:48 +0100
Subject: [PATCH 10/10] Drop hard-wired unit tests for form back-navigation
---
...uest_get_unsuccessful_worldpay_response.rb | 3 ++-
.../a_manual_address_transition.rb | 19 +++++--------------
.../workflow_states/a_postcode_transition.rb | 18 +++++-------------
.../an_address_lookup_transition.rb | 9 ---------
.../workflow_states/has_back_transition.rb | 9 ---------
5 files changed, 12 insertions(+), 46 deletions(-)
delete mode 100644 spec/support/shared_examples/workflow_states/has_back_transition.rb
diff --git a/spec/support/shared_examples/request_get_unsuccessful_worldpay_response.rb b/spec/support/shared_examples/request_get_unsuccessful_worldpay_response.rb
index 544ab21cd..bbb30a2a3 100644
--- a/spec/support/shared_examples/request_get_unsuccessful_worldpay_response.rb
+++ b/spec/support/shared_examples/request_get_unsuccessful_worldpay_response.rb
@@ -15,7 +15,8 @@
:has_conviction_search_result,
:has_key_people,
account_email: user.email,
- workflow_state: "worldpay_form")
+ workflow_state: "worldpay_form",
+ workflow_history: ["payment_summary_form"])
end
let(:token) { transient_registration.token }
diff --git a/spec/support/shared_examples/workflow_states/a_manual_address_transition.rb b/spec/support/shared_examples/workflow_states/a_manual_address_transition.rb
index d30d8d66d..620c74d68 100644
--- a/spec/support/shared_examples/workflow_states/a_manual_address_transition.rb
+++ b/spec/support/shared_examples/workflow_states/a_manual_address_transition.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.shared_examples "a manual address transition" do |previous_state_if_overseas:, next_state:, address_type:, factory:|
+RSpec.shared_examples "a manual address transition" do |next_state:, address_type:, factory:|
describe "#workflow_state" do
current_state = "#{address_type}_address_manual_form".to_sym
subject do
@@ -9,17 +9,12 @@
end
context "when subject.overseas? is false" do
- previous_state_if_uk = "#{address_type}_postcode_form".to_sym
let(:location) { "england" }
- it "can only transition to either #{previous_state_if_uk} or #{next_state}" do
+ it "can only transition to either #{next_state}" do
permitted_states = Helpers::WorkflowStates.permitted_states(subject)
- expect(permitted_states).to match_array([previous_state_if_uk, next_state])
- end
-
- it "changes to #{previous_state_if_uk} after the 'back' event" do
- expect(subject).to transition_from(current_state).to(previous_state_if_uk).on_event(:back)
+ expect(permitted_states).to match_array([next_state])
end
it "changes to #{next_state} after the 'next' event" do
@@ -30,14 +25,10 @@
context "when subject.overseas? is true" do
let(:location) { "overseas" }
- it "can only transition to #{previous_state_if_overseas} or #{next_state}" do
+ it "can only transition to #{next_state}" do
permitted_states = Helpers::WorkflowStates.permitted_states(subject)
- expect(permitted_states).to match_array([previous_state_if_overseas, next_state].uniq)
- end
-
- it "changes to #{previous_state_if_overseas} after the 'back' event" do
- expect(subject).to transition_from(current_state).to(previous_state_if_overseas).on_event(:back)
+ expect(permitted_states).to match_array([next_state].uniq)
end
it "changes to #{next_state} after the 'next' event" do
diff --git a/spec/support/shared_examples/workflow_states/a_postcode_transition.rb b/spec/support/shared_examples/workflow_states/a_postcode_transition.rb
index 80d4fdf41..37775ab72 100644
--- a/spec/support/shared_examples/workflow_states/a_postcode_transition.rb
+++ b/spec/support/shared_examples/workflow_states/a_postcode_transition.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.shared_examples "a postcode transition" do |previous_state:, address_type:, factory:|
+RSpec.shared_examples "a postcode transition" do |address_type:, factory:|
describe "#workflow_state" do
current_state = "#{address_type}_postcode_form".to_sym
subject(:subject) do
@@ -14,10 +14,10 @@
before(:each) { subject.temp_os_places_error = nil }
- it "can only transition to either #{previous_state}, #{next_state}, or #{alt_state}" do
+ it "can only transition to either #{next_state} or #{alt_state}" do
permitted_states = Helpers::WorkflowStates.permitted_states(subject)
- expect(permitted_states).to match_array([previous_state, next_state, alt_state])
+ expect(permitted_states).to match_array([next_state, alt_state])
end
it "changes to #{next_state} after the 'next' event" do
@@ -30,10 +30,6 @@
.to(alt_state)
.on_event(:skip_to_manual_address)
end
-
- it "changes to #{previous_state} after the 'back' event" do
- expect(subject).to transition_from(current_state).to(previous_state).on_event(:back)
- end
end
context "when subject.skip_to_manual_address? is true" do
@@ -41,19 +37,15 @@
before(:each) { subject.temp_os_places_error = true }
- it "can only transition to either #{previous_state} or #{next_state}" do
+ it "can only transition to either #{next_state}" do
permitted_states = Helpers::WorkflowStates.permitted_states(subject)
- expect(permitted_states).to match_array([previous_state, next_state])
+ expect(permitted_states).to match_array([next_state])
end
it "changes to #{next_state} after the 'next' event" do
expect(subject).to transition_from(current_state).to(next_state).on_event(:next)
end
-
- it "changes to #{previous_state} after the 'back' event" do
- expect(subject).to transition_from(current_state).to(previous_state).on_event(:back)
- end
end
end
end
diff --git a/spec/support/shared_examples/workflow_states/an_address_lookup_transition.rb b/spec/support/shared_examples/workflow_states/an_address_lookup_transition.rb
index 5f8a2b672..8791d5bf8 100644
--- a/spec/support/shared_examples/workflow_states/an_address_lookup_transition.rb
+++ b/spec/support/shared_examples/workflow_states/an_address_lookup_transition.rb
@@ -2,7 +2,6 @@
RSpec.shared_examples "an address lookup transition" do |next_state_if_not_skipping_to_manual:, address_type:, factory:|
describe "#workflow_state" do
- previous_state = "#{address_type}_postcode_form".to_sym
current_state = "#{address_type}_address_form".to_sym
subject(:subject) do
create(factory, workflow_state: current_state,
@@ -26,10 +25,6 @@
.to(alt_state)
.on_event(:skip_to_manual_address)
end
-
- it "changes to #{previous_state} after the 'back' event" do
- expect(subject).to transition_from(current_state).to(previous_state).on_event(:back)
- end
end
context "when subject.skip_to_manual_address? is true" do
@@ -47,10 +42,6 @@
.to(next_state)
.on_event(:skip_to_manual_address)
end
-
- it "changes to #{previous_state} after the 'back' event" do
- expect(subject).to transition_from(current_state).to(previous_state).on_event(:back)
- end
end
end
end
diff --git a/spec/support/shared_examples/workflow_states/has_back_transition.rb b/spec/support/shared_examples/workflow_states/has_back_transition.rb
deleted file mode 100644
index 1f072e246..000000000
--- a/spec/support/shared_examples/workflow_states/has_back_transition.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-RSpec.shared_examples "has back transition" do |previous_state:|
- it "can transition to #{previous_state}" do
- current_state = subject.workflow_state
-
- expect(subject).to transition_from(current_state).to(previous_state).on_event(:back)
- end
-end