-
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.
Revert "Revert "Remove concept of submitted application""
This reverts commit 3a3b38b.
- Loading branch information
1 parent
84be3f6
commit 9f2f5bf
Showing
23 changed files
with
26 additions
and
119 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
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
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
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
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 |
---|---|---|
|
@@ -60,13 +60,13 @@ | |
def given_there_are_few_applications | ||
# Create 2 specific applications for search tests | ||
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, :submitted, applicant: unique_applicant, urn: "Unique Urn 1") | ||
create(:application, applicant: unique_applicant, urn: "Unique Urn 1") | ||
|
||
another_applicant = create(:applicant, given_name: "Another Given Name", middle_name: "Another Middle Name", family_name: "Another Family Name", email_address: "[email protected]") | ||
create(:application, :submitted, applicant: another_applicant, urn: "Unique Urn 2") | ||
create(:application, applicant: another_applicant, urn: "Unique Urn 2") | ||
|
||
# Create 19 more applications for pagination test | ||
create_list(:application, 19, :submitted) | ||
create_list(:application, 19) | ||
end | ||
|
||
def given_there_is_an_application_that_breached_sla | ||
|
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 |
---|---|---|
|
@@ -10,10 +10,10 @@ | |
let!(:applicant_four) { build(:applicant, email_address: "[email protected]", passport_number: "123456", phone_number: "999999999") } | ||
|
||
before do | ||
create(:application, :submitted, applicant: applicant_one) | ||
create(:application, :submitted, applicant: applicant_two) | ||
create(:application, :submitted, applicant: applicant_three) | ||
create(:application, :submitted, applicant: applicant_four) | ||
create(:application, applicant: applicant_one) | ||
create(:application, applicant: applicant_two) | ||
create(:application, applicant: applicant_three) | ||
create(:application, applicant: applicant_four) | ||
end | ||
|
||
it "Admin can search for duplicates by email" do | ||
|
@@ -34,20 +34,6 @@ | |
then_i_see_matching_duplicates_by_passport_number | ||
end | ||
|
||
it "the view renders even where there are 'in progress' applications" do | ||
given_i_am_signed_as_an_admin | ||
when_there_are_in_progress_applications | ||
when_i_visit_the_duplicates_page | ||
then_i_see_the_in_progress_applications | ||
end | ||
|
||
it "shows duplicates only once even if they match multiple times" do | ||
given_i_am_signed_as_an_admin | ||
when_there_are_in_progress_applications | ||
when_i_visit_the_duplicates_page | ||
then_i_see_the_in_progress_applications_only_once | ||
end | ||
|
||
def when_i_search_for_a_duplicate_by(type) | ||
visit duplicates_path | ||
case type | ||
|
@@ -60,18 +46,10 @@ def when_i_search_for_a_duplicate_by(type) | |
end | ||
end | ||
|
||
def when_there_are_in_progress_applications | ||
create(:application, applicant: nil, urn: nil, application_progress: nil) | ||
end | ||
|
||
def when_i_visit_the_duplicates_page | ||
visit duplicates_path | ||
end | ||
|
||
def then_i_see_the_in_progress_applications | ||
expect(page).to have_content("Duplicated applications") | ||
end | ||
|
||
def then_i_see_matching_duplicates | ||
expect(page).to have_content("[email protected]") | ||
expect(page).to have_content("123456") | ||
|
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 |
---|---|---|
|
@@ -26,7 +26,7 @@ | |
RSpec.describe Application do | ||
describe "validations" do | ||
context "when the application has been submitted" do | ||
subject(:application) { build(:teacher_application, :submitted) } | ||
subject(:application) { build(:teacher_application) } | ||
|
||
it { expect(application).to validate_presence_of(:application_date) } | ||
it { expect(application).to validate_presence_of(:application_route) } | ||
|
@@ -36,30 +36,9 @@ | |
it { expect(application).to validate_presence_of(:visa_type) } | ||
it { expect(application).to validate_presence_of(:applicant) } | ||
end | ||
|
||
context "when the application has not been submitted" do | ||
it "is valid" do | ||
expect(described_class.new).to be_valid | ||
end | ||
end | ||
end | ||
|
||
describe "scopes" do | ||
describe ".submitted" do | ||
it "returns applications with a URN" do | ||
create_list(:application, 2, :submitted) | ||
create(:application, :not_submitted) | ||
|
||
expect(described_class.submitted.count).to eq 2 | ||
end | ||
|
||
it "does not return applications without a URN" do | ||
create(:application, :not_submitted) | ||
|
||
expect(described_class.submitted.count).to eq 0 | ||
end | ||
end | ||
|
||
describe ".filter_by_status" do | ||
it "returns applications with the specified status" do | ||
initial_checks_application = build(:application) | ||
|
@@ -95,22 +74,6 @@ | |
end | ||
end | ||
|
||
describe "#assign_urn!" do | ||
it "matches the required format for a teacher" do | ||
application = create(:teacher_application) | ||
application.assign_urn! | ||
|
||
expect(application.reload.urn).to match(/^IRPTE[A-Z0-9]{5}$/) | ||
end | ||
|
||
it "matches the required format for a trainee" do | ||
application = create(:salaried_trainee_application) | ||
application.assign_urn! | ||
|
||
expect(application.reload.urn).to match(/^IRPST[A-Z0-9]{5}$/) | ||
end | ||
end | ||
|
||
describe ".search" do | ||
let(:applicant_john) { create(:applicant, given_name: "John", family_name: "Doe", email_address: "[email protected]", passport_number: "123456") } | ||
let(:application_john) { create(:application, urn: "APP123", applicant: applicant_john) } | ||
|
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
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
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