Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overseas company numbers #1282

Merged
merged 3 commits into from
Dec 12, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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-20.04
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we just use ubuntu-latest here? Then we don't have to worry about bumping the tag.

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