From 976cfb25314cbeb1e49db350a3246d60bb87f6de Mon Sep 17 00:00:00 2001 From: PaulDoyle-DEFRA <97455399+PaulDoyle-DEFRA@users.noreply.github.com> Date: Mon, 12 Dec 2022 14:42:26 +0000 Subject: [PATCH] Overseas company numbers (#1282) https://eaflood.atlassian.net/browse/RUBY-2014 --- .github/workflows/ci.yml | 4 ++-- .../can_use_renewing_registration_workflow.rb | 12 ++++-------- .../renewal_information_form_spec.rb | 10 ++++++++++ 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 196f81bed..3c8bf9556 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,7 @@ on: push jobs: build: # You must use a Linux environment when using service containers or container jobs - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest env: NOTIFY_API_KEY: ${{ secrets.NOTIFY_API_KEY }} WCRS_REGISTRATION_EXPIRES_AFTER: 3 @@ -36,7 +36,7 @@ jobs: steps: # Downloads a copy of the code in your repository before running CI tests - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of sonarcloud analysis diff --git a/app/models/concerns/waste_carriers_engine/can_use_renewing_registration_workflow.rb b/app/models/concerns/waste_carriers_engine/can_use_renewing_registration_workflow.rb index 8f4e9d551..ebb42f069 100644 --- a/app/models/concerns/waste_carriers_engine/can_use_renewing_registration_workflow.rb +++ b/app/models/concerns/waste_carriers_engine/can_use_renewing_registration_workflow.rb @@ -83,7 +83,7 @@ module CanUseRenewingRegistrationWorkflow if: :should_register_in_wales? transitions from: :location_form, to: :cbd_type_form, - if: :based_overseas? + if: :overseas? transitions from: :location_form, to: :business_type_form @@ -137,7 +137,7 @@ module CanUseRenewingRegistrationWorkflow transitions from: :use_trading_name_form, to: :company_postcode_form transitions from: :company_name_form, to: :company_address_manual_form, - if: :based_overseas? + if: :overseas? transitions from: :company_name_form, to: :company_postcode_form @@ -179,7 +179,7 @@ module CanUseRenewingRegistrationWorkflow transitions from: :contact_phone_form, to: :contact_email_form transitions from: :contact_email_form, to: :contact_address_manual_form, - if: :based_overseas? + if: :overseas? transitions from: :contact_email_form, to: :contact_address_reuse_form @@ -264,7 +264,7 @@ module CanUseRenewingRegistrationWorkflow private def company_status_invalid? - return false if company_no.blank? + return false if company_no.blank? || overseas? company_status = DefraRubyCompaniesHouse.new(company_no).company_status !%w[active voluntary-arrangement].include?(company_status) @@ -274,10 +274,6 @@ def skip_registration_number? !company_no_required? end - def based_overseas? - overseas? - end - def registered_address_was_manually_entered? return unless registered_address 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 5f6d43ae8..cf5dfffef 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 @@ -11,6 +11,7 @@ module WasteCarriersEngine business_type: business_type, location: location, tier: tier, + company_no: company_number, workflow_state: "renewal_information_form") end let(:tier) { WasteCarriersEngine::Registration::UPPER_TIER } @@ -18,6 +19,7 @@ module WasteCarriersEngine let(:location) { "england" } let(:defra_ruby_companies_house) { instance_double(DefraRubyCompaniesHouse) } let(:company_status) { "active" } + let(:company_number) { "12345678" } before do allow(DefraRubyCompaniesHouse).to receive(:new).and_return(defra_ruby_companies_house) @@ -106,6 +108,14 @@ module WasteCarriersEngine include_examples "check_registered_company_name_form or invalid_company_status_form" end + + context "when the business is overseas" do + let(:location) { "overseas" } + let(:business_type) { "overseas" } + let(:company_number) { "invalid" } + + include_examples "has next transition", next_state: "main_people_form" + end end end end