-
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.
Requirement is to check for matching claims across all policies, except for IRP, which should only flag matches with other IRP policies. At the minute the only attribute we use on eligibility when checking for matches is TRN, which is present in all the eligibilities we compare, if however we start checking other attributes the db will throw an error as the column may not be present on all eligibilities, hence having to update the "matching_claims - blank trn" test.
- Loading branch information
Showing
5 changed files
with
218 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -277,31 +277,29 @@ | |
it { is_expected.to eq [other_claim] } | ||
end | ||
|
||
describe "matching_claims - blank trn, another field group with same contract type, blank provision_search" do | ||
before do | ||
stub_const("Policies::FurtherEducationPayments::ELIGIBILITY_MATCHING_ATTRIBUTES", [["teacher_reference_number"], ["provision_search", "contract_type"]]) | ||
end | ||
|
||
describe "matching_claims - blank trn, matching email addresses" do | ||
let(:policy) { Policies::FurtherEducationPayments } | ||
|
||
let!(:source_claim) { | ||
eligibility = create(:further_education_payments_eligibility, :eligible, contract_type: "permanent", provision_search: nil) | ||
eligibility = create(:further_education_payments_eligibility, :eligible) | ||
create( | ||
:claim, | ||
:submitted, | ||
policy: policy, | ||
eligibility: eligibility | ||
eligibility: eligibility, | ||
email_address: "[email protected]" | ||
) | ||
} | ||
|
||
let!(:other_claim) { | ||
eligibility = create(:further_education_payments_eligibility, :eligible, contract_type: "permanent", provision_search: nil) | ||
eligibility = create(:further_education_payments_eligibility, :eligible) | ||
create( | ||
:claim, | ||
:submitted, | ||
policy: policy, | ||
eligibility: eligibility, | ||
surname: Faker::Name.last_name | ||
surname: Faker::Name.last_name, | ||
email_address: "[email protected]" | ||
) | ||
} | ||
|
||
|
@@ -310,6 +308,202 @@ | |
it { is_expected.to eq [other_claim] } | ||
end | ||
|
||
describe "matching claims across policies" do | ||
subject(:matching_claims) do | ||
Claim::MatchingAttributeFinder.new(source_claim).matching_claims | ||
end | ||
|
||
let(:source_claim) do | ||
create( | ||
:claim, | ||
:submitted, | ||
policy: source_policy, | ||
email_address: "[email protected]", | ||
academic_year: AcademicYear.current | ||
) | ||
end | ||
|
||
let!(:target_claim) do | ||
create( | ||
:claim, | ||
:submitted, | ||
policy: target_policy, | ||
email_address: "[email protected]", | ||
academic_year: AcademicYear.current | ||
) | ||
end | ||
|
||
context "with an ECP claim" do | ||
let(:source_policy) { Policies::EarlyCareerPayments } | ||
|
||
context "when compared with ECP" do | ||
let(:target_policy) { Policies::EarlyCareerPayments } | ||
|
||
it { is_expected.to include(target_claim) } | ||
end | ||
|
||
context "when compared with LUP" do | ||
let(:target_policy) { Policies::LevellingUpPremiumPayments } | ||
|
||
it { is_expected.to include(target_claim) } | ||
end | ||
|
||
context "when compared with TSLR" do | ||
let(:target_policy) { Policies::StudentLoans } | ||
|
||
it { is_expected.to include(target_claim) } | ||
end | ||
|
||
context "when compared with FE" do | ||
let(:target_policy) { Policies::FurtherEducationPayments } | ||
|
||
it { is_expected.to include(target_claim) } | ||
end | ||
|
||
context "when compared with IRP" do | ||
let(:target_policy) { Policies::InternationalRelocationPayments } | ||
|
||
it { is_expected.not_to include(target_claim) } | ||
end | ||
end | ||
|
||
context "with an LUP claim" do | ||
let(:source_policy) { Policies::LevellingUpPremiumPayments } | ||
|
||
context "when compared with ECP" do | ||
let(:target_policy) { Policies::EarlyCareerPayments } | ||
|
||
it { is_expected.to include(target_claim) } | ||
end | ||
|
||
context "when compared with LUP" do | ||
let(:target_policy) { Policies::LevellingUpPremiumPayments } | ||
|
||
it { is_expected.to include(target_claim) } | ||
end | ||
|
||
context "when compared with TSLR" do | ||
let(:target_policy) { Policies::StudentLoans } | ||
|
||
it { is_expected.to include(target_claim) } | ||
end | ||
|
||
context "when compared with FE" do | ||
let(:target_policy) { Policies::FurtherEducationPayments } | ||
|
||
it { is_expected.to include(target_claim) } | ||
end | ||
|
||
context "when compared with IRP" do | ||
let(:target_policy) { Policies::InternationalRelocationPayments } | ||
|
||
it { is_expected.not_to include(target_claim) } | ||
end | ||
end | ||
|
||
context "with a TSLR claim" do | ||
let(:source_policy) { Policies::StudentLoans } | ||
|
||
context "when compared with ECP" do | ||
let(:target_policy) { Policies::EarlyCareerPayments } | ||
|
||
it { is_expected.to include(target_claim) } | ||
end | ||
|
||
context "when compared with LUP" do | ||
let(:target_policy) { Policies::LevellingUpPremiumPayments } | ||
|
||
it { is_expected.to include(target_claim) } | ||
end | ||
|
||
context "when compared with TSLR" do | ||
let(:target_policy) { Policies::StudentLoans } | ||
|
||
it { is_expected.to include(target_claim) } | ||
end | ||
|
||
context "when compared with FE" do | ||
let(:target_policy) { Policies::FurtherEducationPayments } | ||
|
||
it { is_expected.to include(target_claim) } | ||
end | ||
|
||
context "when compared with IRP" do | ||
let(:target_policy) { Policies::InternationalRelocationPayments } | ||
|
||
it { is_expected.not_to include(target_claim) } | ||
end | ||
end | ||
|
||
context "with an FE claim" do | ||
let(:source_policy) { Policies::FurtherEducationPayments } | ||
|
||
context "when compared with ECP" do | ||
let(:target_policy) { Policies::EarlyCareerPayments } | ||
|
||
it { is_expected.to include(target_claim) } | ||
end | ||
|
||
context "when compared with LUP" do | ||
let(:target_policy) { Policies::LevellingUpPremiumPayments } | ||
|
||
it { is_expected.to include(target_claim) } | ||
end | ||
|
||
context "when compared with TSLR" do | ||
let(:target_policy) { Policies::StudentLoans } | ||
|
||
it { is_expected.to include(target_claim) } | ||
end | ||
|
||
context "when compared with FE" do | ||
let(:target_policy) { Policies::FurtherEducationPayments } | ||
|
||
it { is_expected.to include(target_claim) } | ||
end | ||
|
||
context "when compared with IRP" do | ||
let(:target_policy) { Policies::InternationalRelocationPayments } | ||
|
||
it { is_expected.not_to include(target_claim) } | ||
end | ||
end | ||
|
||
context "with an IRP claim" do | ||
let(:source_policy) { Policies::InternationalRelocationPayments } | ||
|
||
context "when compared with ECP" do | ||
let(:target_policy) { Policies::EarlyCareerPayments } | ||
|
||
it { is_expected.not_to include(target_claim) } | ||
end | ||
|
||
context "when compared with LUP" do | ||
let(:target_policy) { Policies::LevellingUpPremiumPayments } | ||
|
||
it { is_expected.not_to include(target_claim) } | ||
end | ||
|
||
context "when compared with TSLR" do | ||
let(:target_policy) { Policies::StudentLoans } | ||
|
||
it { is_expected.not_to include(target_claim) } | ||
end | ||
|
||
context "when compared with FE" do | ||
let(:target_policy) { Policies::FurtherEducationPayments } | ||
|
||
it { is_expected.not_to include(target_claim) } | ||
end | ||
|
||
context "when compared with IRP" do | ||
let(:target_policy) { Policies::InternationalRelocationPayments } | ||
|
||
it { is_expected.to include(target_claim) } | ||
end | ||
end | ||
end | ||
|
||
describe "#matching_attributes" do | ||
it "returns the attributes that match" do | ||
source_claim = create( | ||
|