-
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 #3362 from DFE-Digital/LUPEYALPHA-1231-EY-student-…
…loan-plan-task [LUPEYALPHA-1231] EY student loan plan task
- Loading branch information
Showing
17 changed files
with
127 additions
and
8 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
8 changes: 8 additions & 0 deletions
8
...models/journeys/early_years_payment/practitioner/answers_student_loans_details_updater.rb
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module Journeys | ||
module EarlyYearsPayment | ||
module Practitioner | ||
class AnswersStudentLoansDetailsUpdater < Journeys::AnswersStudentLoansDetailsUpdater | ||
end | ||
end | ||
end | ||
end |
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
29 changes: 29 additions & 0 deletions
29
app/models/policies/early_years_payments/claim_checking_tasks.rb
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# frozen_string_literal: true | ||
|
||
module Policies | ||
module EarlyYearsPayments | ||
class ClaimCheckingTasks | ||
attr_reader :claim | ||
|
||
def initialize(claim) | ||
@claim = claim | ||
end | ||
|
||
delegate :policy, to: :claim | ||
|
||
def applicable_task_names | ||
tasks = [] | ||
|
||
tasks << "student_loan_plan" if claim.submitted_without_slc_data? | ||
|
||
tasks | ||
end | ||
|
||
private | ||
|
||
def matching_claims | ||
@matching_claims ||= Claim::MatchingAttributeFinder.new(claim).matching_claims | ||
end | ||
end | ||
end | ||
end |
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
34 changes: 34 additions & 0 deletions
34
spec/features/early_years_payment/practitioner/student_loan_spec.rb
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
require "rails_helper" | ||
|
||
RSpec.feature "Early Years Payments Student Loan Plan" do | ||
include ActionView::Helpers::NumberHelper | ||
|
||
let(:claim) { Claim.last } | ||
let(:magic_link) { mail[:personalisation].unparsed_value[:magic_link] } | ||
let(:mail) { ActionMailer::Base.deliveries.last } | ||
|
||
scenario "student loan data does not exist on submission" do | ||
when_early_years_practitioner_claim_submitted | ||
|
||
expect(claim.tasks.where(name: "student_loan_plan")).to be_empty | ||
|
||
sign_in_as_service_operator | ||
|
||
visit admin_claim_tasks_path(claim) | ||
within "li.student_loan_plan" do | ||
expect(page).to have_content "Incomplete" | ||
end | ||
end | ||
|
||
scenario "student loan data does exist on submission" do | ||
when_student_loan_data_exists | ||
when_early_years_practitioner_claim_submitted | ||
|
||
expect(claim.reload.student_loan_plan).to eq "plan_1" | ||
|
||
sign_in_as_service_operator | ||
|
||
visit admin_claim_tasks_path(claim) | ||
expect(page).not_to have_content "Student loan plan" | ||
end | ||
end |
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
2 changes: 2 additions & 0 deletions
2
spec/support/steps/early_years_provider_journey_authenticated.rb
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,4 +1,6 @@ | ||
def when_early_years_payment_provider_authenticated_journey_ready_to_submit | ||
nursery = EligibleEyProvider.last || create(:eligible_ey_provider, primary_key_contact_email_address: "[email protected]") | ||
|
||
visit magic_link | ||
check "I confirm that I have obtained consent from my employee and have provided them with the relevant privacy notice." | ||
click_button "Continue" | ||
|
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,3 +1,3 @@ | ||
def when_eligible_ey_provider_exists | ||
create(:eligible_ey_provider, primary_key_contact_email_address: "[email protected]", secondary_contact_email_address: "[email protected]") | ||
create(:eligible_ey_provider, primary_key_contact_email_address: "[email protected]", secondary_contact_email_address: "[email protected]") unless EligibleEyProvider.any? | ||
end |