Skip to content

Commit

Permalink
change eligibility factory traits - new trait: not_verified
Browse files Browse the repository at this point in the history
  • Loading branch information
alkesh committed Sep 27, 2024
1 parent 452e097 commit c3755af
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,19 @@
trait :eligible do
eligible_school
contract_type { "permanent" }
verified
end

trait :not_verified do
eligible_school
contract_type { "permanent" }
end

trait :eligible_school do
association :school, factory: :fe_eligible_school
end

trait :eligible_duplicate do
trait :duplicate do
flagged_as_duplicate { true }
end

Expand Down
2 changes: 1 addition & 1 deletion spec/features/admin/admin_claims_filtering_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
let(:approved_awaiting_qa_claims) { create_list(:claim, 2, :approved, :flagged_for_qa, policy: Policies::LevellingUpPremiumPayments) }
let(:auto_approved_awaiting_payroll_claims) { create_list(:claim, 2, :auto_approved, policy: Policies::LevellingUpPremiumPayments) }
let(:approved_claim) { create(:claim, :approved, policy: Policies::LevellingUpPremiumPayments, assigned_to: mette, decision_creator: mary) }
let(:further_education_claims_awaiting_provider_verification) { create_list(:claim, 2, :submitted, policy: Policies::FurtherEducationPayments, eligibility_trait: :eligible, assigned_to: valentino) }
let(:further_education_claims_awaiting_provider_verification) { create_list(:claim, 2, :submitted, policy: Policies::FurtherEducationPayments, eligibility_trait: :not_verified, assigned_to: valentino) }
let(:rejected_claim) { create(:claim, :rejected, policy: Policies::LevellingUpPremiumPayments, assigned_to: valentino) }

let!(:claims) do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
:claim,
:submitted,
policy: Policies::FurtherEducationPayments,
eligibility_trait: :eligible
eligibility_trait: :not_verified
)
}
let!(:claim_with_trn) {
Expand All @@ -24,15 +24,15 @@
:claim,
:submitted,
policy: Policies::FurtherEducationPayments,
eligibility_trait: :eligible_duplicate
eligibility_trait: :duplicate
)
}
let!(:claim_with_duplicates_provider_email_sent) {
create(
:claim,
:submitted,
policy: Policies::FurtherEducationPayments,
eligibility_trait: :eligible_duplicate
eligibility_trait: :duplicate
)
}
let!(:verified_claim) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
policy: Policies::FurtherEducationPayments,
eligibility: build(
:further_education_payments_eligibility,
:eligible
:not_verified
))
}

Expand All @@ -24,7 +24,7 @@
policy: Policies::FurtherEducationPayments,
eligibility: build(
:further_education_payments_eligibility,
:eligible,
:not_verified,
provider_verification_email_last_sent_at: DateTime.new(2024, 10, 1, 7, 0, 0)
))
}
Expand All @@ -35,7 +35,7 @@
policy: Policies::FurtherEducationPayments,
eligibility: build(
:further_education_payments_eligibility,
:eligible,
:not_verified,
provider_verification_email_last_sent_at: DateTime.new(2024, 10, 15, 7, 0, 0)
))
}
Expand All @@ -47,7 +47,6 @@
eligibility: build(
:further_education_payments_eligibility,
:eligible,
:verified,
provider_verification_email_last_sent_at: DateTime.new(2024, 10, 1, 7, 0, 0)
))
}
Expand All @@ -59,7 +58,6 @@
eligibility: build(
:further_education_payments_eligibility,
:eligible,
:verified,
provider_verification_email_last_sent_at: DateTime.new(2024, 9, 1, 8, 0, 0),
provider_verification_chase_email_last_sent_at: DateTime.new(2024, 9, 22, 8, 0, 0)
))
Expand All @@ -83,7 +81,7 @@
policy: Policies::FurtherEducationPayments,
eligibility: build(
:further_education_payments_eligibility,
:eligible,
:not_verified,
provider_verification_email_last_sent_at: DateTime.new(2024, 10, 1, 7, 0, 0)
))
}
Expand Down
14 changes: 7 additions & 7 deletions spec/models/claim_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -909,10 +909,10 @@
describe ".awaiting_further_education_provider_verification" do
subject { described_class.awaiting_further_education_provider_verification }

let!(:claim_not_verified_provider_email_automatically_sent) { create(:claim, :submitted, policy: Policies::FurtherEducationPayments, eligibility_trait: :eligible) }
let!(:claim_not_verified_provider_email_not_sent) { create(:claim, :submitted, policy: Policies::FurtherEducationPayments, eligibility_trait: :eligible_duplicate) }
let!(:claim_not_verified_has_duplicates_provider_email_not_sent) { create(:claim, :submitted, policy: Policies::FurtherEducationPayments, eligibility_trait: :eligible_duplicate) }
let!(:claim_not_verified_has_duplicates_provider_email_manually_sent) { create(:claim, :submitted, policy: Policies::FurtherEducationPayments, eligibility_trait: :eligible_duplicate) }
let!(:claim_not_verified_provider_email_automatically_sent) { create(:claim, :submitted, policy: Policies::FurtherEducationPayments, eligibility_trait: :not_verified) }
let!(:claim_not_verified_provider_email_not_sent) { create(:claim, :submitted, policy: Policies::FurtherEducationPayments, eligibility_trait: :duplicate) }
let!(:claim_not_verified_has_duplicates_provider_email_not_sent) { create(:claim, :submitted, policy: Policies::FurtherEducationPayments, eligibility_trait: :duplicate) }
let!(:claim_not_verified_has_duplicates_provider_email_manually_sent) { create(:claim, :submitted, policy: Policies::FurtherEducationPayments, eligibility_trait: :duplicate) }
let!(:claim_with_fe_provider_verification) { create(:claim, policy: Policies::FurtherEducationPayments, eligibility_trait: :verified) }
let!(:non_fe_claim) { create(:claim, policy: Policies::StudentLoans) }

Expand All @@ -921,7 +921,7 @@
create(:note, claim: claim_not_verified_provider_email_not_sent, label: "student_loan_plan")
end

it "returns claims that have not been verified by the provider, and have no matching_details task or have a passed matching_details task" do
it "returns claims that have not been verified by the provider, and have had a provider email sent" do
is_expected.to match_array([claim_not_verified_provider_email_automatically_sent, claim_not_verified_has_duplicates_provider_email_manually_sent])
end
end
Expand Down Expand Up @@ -1344,13 +1344,13 @@

context "when the eligiblity is not verified" do
context "when there are no duplicates" do
let(:claim) { create(:claim, :submitted, policy: Policies::FurtherEducationPayments, eligibility_trait: :eligible) }
let(:claim) { create(:claim, :submitted, policy: Policies::FurtherEducationPayments, eligibility_trait: :not_verified) }

it { is_expected.to be true }
end

context "when there are duplicates" do
let(:claim) { create(:claim, :submitted, policy: Policies::FurtherEducationPayments, eligibility_trait: :eligible_duplicate) }
let(:claim) { create(:claim, :submitted, policy: Policies::FurtherEducationPayments, eligibility_trait: :duplicate) }

context "the provider email has not been sent" do
it { is_expected.to be false }
Expand Down
6 changes: 1 addition & 5 deletions spec/support/admin_view_claim_feature_shared_examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,7 @@
}

let!(:approved_awaiting_payroll_claim) {
eligibility = if policy == Policies::FurtherEducationPayments
create(:"#{policy.to_s.underscore}_eligibility", :verified)
else
create(:"#{policy.to_s.underscore}_eligibility", :eligible)
end
eligibility = create(:"#{policy.to_s.underscore}_eligibility", :eligible)
create(
:claim,
:payrollable,
Expand Down

0 comments on commit c3755af

Please sign in to comment.