-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure the URN is validated correctly
- Loading branch information
Showing
4 changed files
with
57 additions
and
1 deletion.
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
50 changes: 50 additions & 0 deletions
50
spec/requests/downloading_a_pension_wise_digital_summary_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,50 @@ | ||
RSpec.describe 'Generating a Pension Wise Digital summary download', type: :request do | ||
specify 'Successfully generating the download without a URN' do | ||
post '/en/summary-document/download', params: { | ||
appointment_summary: { | ||
appointment_type: 'standard', | ||
supplementary_benefits: true, | ||
supplementary_debt: true, | ||
supplementary_ill_health: true, | ||
supplementary_defined_benefit_pensions: true, | ||
supplementary_pension_transfers: true | ||
} | ||
} | ||
|
||
expect(response.status).to eq(200) | ||
expect(response.content_type).to eq('application/pdf') | ||
end | ||
|
||
specify 'Successfully generating the download with a valid URN' do | ||
post '/en/summary-document/download', params: { | ||
appointment_summary: { | ||
urn: 'PMY9-0GCU', | ||
appointment_type: 'standard', | ||
supplementary_benefits: true, | ||
supplementary_debt: true, | ||
supplementary_ill_health: true, | ||
supplementary_defined_benefit_pensions: true, | ||
supplementary_pension_transfers: true | ||
} | ||
} | ||
|
||
expect(response.status).to eq(200) | ||
expect(response.content_type).to eq('application/pdf') | ||
end | ||
|
||
specify 'Attempting a download with an invalid URN' do | ||
post '/en/summary-document/download', params: { | ||
appointment_summary: { | ||
urn: 'PMY9-0GCUwhoopsies', | ||
appointment_type: 'standard', | ||
supplementary_benefits: true, | ||
supplementary_debt: true, | ||
supplementary_ill_health: true, | ||
supplementary_defined_benefit_pensions: true, | ||
supplementary_pension_transfers: true | ||
} | ||
} | ||
|
||
expect(response.status).to eq(422) | ||
end | ||
end |