Skip to content

Commit

Permalink
add FE employment task if TRN provided
Browse files Browse the repository at this point in the history
  • Loading branch information
asmega committed Sep 6, 2024
1 parent 96d9dfa commit 6938d78
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
5 changes: 5 additions & 0 deletions app/models/automated_checks/claim_verifiers/employment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,18 @@ def initialize(claim:, admin_user: nil)
end

def perform
return unless required?
return unless awaiting_task?

no_data || no_match || matched
end

private

def required?
claim.eligibility.teacher_reference_number.present?
end

attr_accessor :admin_user, :claim, :teachers_pensions_service

def awaiting_task?
Expand Down
3 changes: 2 additions & 1 deletion app/models/policies/further_education_payments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ module FurtherEducationPayments
MIN_QA_THRESHOLD = 10

VERIFIERS = [
AutomatedChecks::ClaimVerifiers::ProviderVerification
AutomatedChecks::ClaimVerifiers::ProviderVerification,
AutomatedChecks::ClaimVerifiers::Employment
]

# Options shown to admins when rejecting a claim
Expand Down
37 changes: 37 additions & 0 deletions spec/models/automated_checks/claim_verifier_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,42 @@
it { is_expected.to eq(0) }
end
end

context "when verifier is conditional" do
subject(:perform) { claim_verifier }

let(:claim) { create(:claim, policy: Policies::FurtherEducationPayments) }

let(:claim_verifier_args) do
{
claim:,
dqt_teacher_status: nil
}
end

context "and is needed" do
before do
claim.eligibility.update teacher_reference_number: "1234567"
end

it "creates relevant task" do
expect {
subject.perform
}.to change { Task.where(name: "employment").count }.by(1)
end
end

context "and is not needed" do
before do
claim.eligibility.update teacher_reference_number: nil
end

it "does not create relevant task" do
expect {
subject.perform
}.to change { Task.where(name: "employment").count }.by(0)
end
end
end
end
end

0 comments on commit 6938d78

Please sign in to comment.