-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
afbda39
commit 2a714a2
Showing
5 changed files
with
118 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,6 +59,8 @@ | |
|
||
def given_there_are_few_applications | ||
# Create 2 specific applications for search tests | ||
create_list(:urn, 5, code: "TE") | ||
create_list(:urn, 5, code: "ST") | ||
unique_applicant = create(:applicant, given_name: "Unique Given Name", middle_name: "Unique Middle Name", family_name: "Unique Family Name", email_address: "[email protected]") | ||
create(:application, applicant: unique_applicant, urn: "Unique Urn 1") | ||
|
||
|
@@ -70,12 +72,16 @@ def given_there_are_few_applications | |
end | ||
|
||
def given_there_is_an_application_that_breached_sla | ||
create_list(:urn, 5, code: "TE") | ||
create_list(:urn, 5, code: "ST") | ||
applicant = create(:applicant) | ||
application = create(:application, applicant:) | ||
application.application_progress.update(initial_checks_completed_at: 4.days.ago) | ||
end | ||
|
||
def given_there_are_applications_with_different_dates | ||
create_list(:urn, 5, code: "TE") | ||
create_list(:urn, 5, code: "ST") | ||
create(:application, application_progress: build(:application_progress, :initial_checks_completed, status: :initial_checks)) | ||
create(:application, application_progress: build(:application_progress, :home_office_checks_completed, status: :home_office_checks)) | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
te_one: | ||
suffix: 5668 | ||
prefix: IRP | ||
code: TE | ||
|
||
te_two: | ||
suffix: 21368 | ||
prefix: IRP | ||
code: TE | ||
|
||
te_three: | ||
suffix: 5 | ||
prefix: IRP | ||
code: TE | ||
|
||
te_four: | ||
suffix: 76998 | ||
prefix: IRP | ||
code: TE | ||
|
||
te_five: | ||
suffix: 6559 | ||
prefix: IRP | ||
code: TE | ||
|
||
te_six: | ||
suffix: 6 | ||
prefix: IRP | ||
code: TE | ||
|
||
te_seven: | ||
suffix: 2298 | ||
prefix: IRP | ||
code: TE | ||
|
||
te_eight: | ||
suffix: 1159 | ||
prefix: IRP | ||
code: TE | ||
|
||
te_nine: | ||
suffix: 79298 | ||
prefix: IRP | ||
code: TE | ||
|
||
te_ten: | ||
suffix: 19549 | ||
prefix: IRP | ||
code: TE | ||
|
||
st_one: | ||
suffix: 5668 | ||
prefix: IRP | ||
code: ST | ||
|
||
st_two: | ||
suffix: 29968 | ||
prefix: IRP | ||
code: ST | ||
|
||
st_three: | ||
suffix: 5 | ||
prefix: IRP | ||
code: ST | ||
|
||
st_four: | ||
suffix: 76998 | ||
prefix: IRP | ||
code: ST | ||
|
||
st_five: | ||
suffix: 6559 | ||
prefix: IRP | ||
code: ST | ||
|
||
st_six: | ||
suffix: 6 | ||
prefix: IRP | ||
code: ST | ||
|
||
st_seven: | ||
suffix: 28 | ||
prefix: IRP | ||
code: ST | ||
|
||
st_eight: | ||
suffix: 159 | ||
prefix: IRP | ||
code: ST | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,23 @@ | ||
require "rails_helper" | ||
|
||
RSpec.describe GenerateUrns do | ||
subject(:service) { described_class } | ||
describe ".generate" do | ||
subject(:generate) { described_class.new(code:).generate } | ||
|
||
describe ".call" do | ||
it { fail } | ||
end | ||
before do | ||
allow(Urn).to receive(:insert_all) | ||
stub_const "Urn::MAX_SUFFIX", 3 | ||
generate | ||
end | ||
|
||
describe ".generate" do | ||
it { fail } | ||
let(:code) { "TE" } | ||
let(:expected_data) do | ||
[ | ||
{ prefix: "IRP", code: code, suffix: 1 }, | ||
{ prefix: "IRP", code: code, suffix: 2 }, | ||
] | ||
end | ||
|
||
it { expect(Urn).to have_received(:insert_all).with(match_array(expected_data)) } | ||
end | ||
end |