Skip to content

Commit

Permalink
Add scenarios for refresher training to create_claim_spec.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
Kizr authored and ollietreend committed Oct 7, 2024
1 parent d527986 commit a1ecbad
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions spec/system/claims/schools/claims/create_claim_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,44 @@
then_i_should_land_on_the_check_page
end

context "when a claim has been created for the mentor in the previous year" do
let(:claim_window) { Claims::ClaimWindow.previous }
let(:claim) { build(:claim, :submitted, claim_window:, provider: bpn) }
let(:mentor_training) { create(:mentor_training, mentor: mentor1, provider: bpn, claim:, hours_completed: 20) }

before do
mentor_training
end

scenario "Anne creates a claim" do
when_i_click("Add claim")
when_i_choose_a_provider(bpn)
when_i_click("Continue")
when_i_select_a_mentor(mentor1)
when_i_click("Continue")
then_i_expect_to_be_able_to_add_training_hours_to_mentor(mentor1)
and_the_total_claimable_hours_are_for_refresher_training
when_i_add_training_hours("6 hours")
when_i_click("Continue")
then_i_should_land_on_the_check_page
when_i_click("Submit claim")
then_i_get_a_claim_reference_and_see_next_steps(Claims::Claim.submitted.last)
end

scenario "Anne creates a claim with more than the remaining hours" do
when_i_click("Add claim")
when_i_choose_a_provider(bpn)
when_i_click("Continue")
when_i_select_a_mentor(mentor1)
when_i_click("Continue")
then_i_expect_to_be_able_to_add_training_hours_to_mentor(mentor1)
and_the_total_claimable_hours_are_for_refresher_training
when_i_choose_other_amount_and_input_hours(7)
when_i_click("Continue")
then_i_see_the_error("Enter the number of hours between 1 and 6")
end
end

private

def given_i_sign_in
Expand Down Expand Up @@ -330,4 +368,9 @@ def then_i_expect_the_provider_to_be_checked(provider)
def then_i_expect_to_be_on_the_claims_index_page
expect(page).to have_current_path(claims_school_claims_path(school))
end

def and_the_total_claimable_hours_are_for_refresher_training
expect(page).to have_content("6 hours")
expect(page).to have_content("The remaining amount of hours for standard training")
end
end

0 comments on commit a1ecbad

Please sign in to comment.