Skip to content

Commit

Permalink
Overseas company numbers (#1282)
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulDoyle-DEFRA committed Dec 12, 2022
1 parent 186a2c7 commit 976cfb2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand All @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ 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 }
let(:business_type) { nil }
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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 976cfb2

Please sign in to comment.