-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3348 from DFE-Digital/LUPEYALPHA-1172-ey-admin-ma…
…tching-details [LUPEYALPHA-1172] EY admin matching details
- Loading branch information
Showing
10 changed files
with
129 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
require "rails_helper" | ||
|
||
RSpec.describe Claim::MatchingAttributeFinder do | ||
describe "#matching_claims for ECP/LUP claims" do | ||
describe "#matching_claims" do | ||
let!(:source_claim) { | ||
create(:claim, | ||
first_name: "Genghis", | ||
|
@@ -49,10 +49,40 @@ | |
eligibility_attributes: {teacher_reference_number: "0902344"}) | ||
} | ||
|
||
let!(:fe_claim) { | ||
create(:claim, | ||
:submitted, | ||
first_name: "Genghis", | ||
surname: "Khan", | ||
date_of_birth: Date.new(1162, 5, 31), | ||
national_insurance_number: "QQ891011C", | ||
email_address: "[email protected]", | ||
bank_account_number: "34682151", | ||
bank_sort_code: "972654", | ||
academic_year: AcademicYear.new("2019"), | ||
building_society_roll_number: "123456789/ABCD", | ||
policy: Policies::FurtherEducationPayments, | ||
eligibility_attributes: {teacher_reference_number: "0902344"}) | ||
} | ||
|
||
let!(:ey_claim) { | ||
create(:claim, | ||
:submitted, | ||
first_name: "Genghis", | ||
surname: "Khan", | ||
date_of_birth: Date.new(1162, 5, 31), | ||
national_insurance_number: "QQ891011C", | ||
email_address: "[email protected]", | ||
bank_account_number: "34682151", | ||
bank_sort_code: "972654", | ||
academic_year: AcademicYear.new("2019"), | ||
policy: Policies::EarlyYearsPayments) | ||
} | ||
|
||
subject(:matching_claims) { Claim::MatchingAttributeFinder.new(source_claim).matching_claims } | ||
|
||
it "includes only claims for ECP or LUP claims" do | ||
expect(matching_claims).to contain_exactly(lup_claim, student_loans_claim) | ||
it "includes claims for ECP, LUP, FE and EY claims" do | ||
expect(matching_claims).to contain_exactly(lup_claim, student_loans_claim, fe_claim, ey_claim) | ||
end | ||
end | ||
|
||
|
@@ -211,6 +241,35 @@ | |
|
||
expect(matching_claims).to eq([claim_with_matching_attributes]) | ||
end | ||
|
||
context "when the policy has an array of attributes in ELIGIBILITY_MATCHING_ATTRIBUTES" do # current policies don't do this | ||
before do | ||
allow(Policies::StudentLoans).to receive(:eligibility_matching_attributes) { [["teacher_reference_number", "current_school_id"]] } | ||
end | ||
|
||
it "does not include a claim that only partially matches eligibility_matching_attributes" do | ||
create( | ||
:claim, | ||
:submitted, | ||
eligibility_attributes: {teacher_reference_number: "0902344"} | ||
) | ||
|
||
expect(matching_claims).to be_empty | ||
end | ||
|
||
context "when matching with a claim that has one but not all of the eligibility_matching_attributes" do | ||
it "does not include" do | ||
create( | ||
:claim, | ||
:submitted, | ||
policy: Policies::FurtherEducationPayments, | ||
eligibility_attributes: {teacher_reference_number: "0902344"} | ||
) | ||
|
||
expect(matching_claims).to be_empty | ||
end | ||
end | ||
end | ||
end | ||
|
||
describe "matching_claims - blank trn" do | ||
|
@@ -359,6 +418,12 @@ | |
|
||
it { is_expected.not_to include(target_claim) } | ||
end | ||
|
||
context "when compared with EY" do | ||
let(:target_policy) { Policies::EarlyYearsPayments } | ||
|
||
it { is_expected.to include(target_claim) } | ||
end | ||
end | ||
|
||
context "with an LUP claim" do | ||
|
@@ -393,6 +458,12 @@ | |
|
||
it { is_expected.not_to include(target_claim) } | ||
end | ||
|
||
context "when compared with EY" do | ||
let(:target_policy) { Policies::EarlyYearsPayments } | ||
|
||
it { is_expected.to include(target_claim) } | ||
end | ||
end | ||
|
||
context "with a TSLR claim" do | ||
|
@@ -427,6 +498,12 @@ | |
|
||
it { is_expected.not_to include(target_claim) } | ||
end | ||
|
||
context "when compared with EY" do | ||
let(:target_policy) { Policies::EarlyYearsPayments } | ||
|
||
it { is_expected.to include(target_claim) } | ||
end | ||
end | ||
|
||
context "with an FE claim" do | ||
|
@@ -461,6 +538,12 @@ | |
|
||
it { is_expected.not_to include(target_claim) } | ||
end | ||
|
||
context "when compared with EY" do | ||
let(:target_policy) { Policies::EarlyYearsPayments } | ||
|
||
it { is_expected.to include(target_claim) } | ||
end | ||
end | ||
|
||
context "with an IRP claim" do | ||
|
@@ -490,6 +573,12 @@ | |
it { is_expected.not_to include(target_claim) } | ||
end | ||
|
||
context "when compared with EY" do | ||
let(:target_policy) { Policies::EarlyYearsPayments } | ||
|
||
it { is_expected.not_to include(target_claim) } | ||
end | ||
|
||
context "when compared with IRP" do | ||
let(:target_policy) { Policies::InternationalRelocationPayments } | ||
|
||
|