-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to download paper consent forms
This adds the ability to download a paper consent form for all sessions that are open, for now this is the same form for all HPV sessions, but we can expect to customise this in the future to automatically include the name of the school, etc. I took the consent form PDF from the prototype, I notice that the health questions are slightly different to the three we ask in the service, there's an additional one about any special needs the patient might require.
- Loading branch information
1 parent
f6e5e84
commit 9b6a6f1
Showing
6 changed files
with
77 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"ignored_warnings": [ | ||
{ | ||
"warning_type": "File Access", | ||
"warning_code": 16, | ||
"fingerprint": "25619a87718cc1eff74221288fbf4d6826ba182664ada813ecd280bd3d32549f", | ||
"check_name": "SendFile", | ||
"message": "Parameter value used in file name", | ||
"file": "app/controllers/sessions_controller.rb", | ||
"line": 73, | ||
"link": "https://brakemanscanner.org/docs/warning_types/file_access/", | ||
"code": "send_file(\"public/consent_forms/#{sessions_scope.find(params[:id]).programmes.first.type}.pdf\", :filename => (\"#{sessions_scope.find(params[:id]).programmes.first.name} Consent Form.pdf\"), :disposition => \"attachment\")", | ||
"render_path": null, | ||
"location": { | ||
"type": "method", | ||
"class": "SessionsController", | ||
"method": "consent_form" | ||
}, | ||
"user_input": "params[:id]", | ||
"confidence": "Weak", | ||
"cwe_id": [ | ||
22 | ||
], | ||
"note": "Programme names/types come from a limited set of enums." | ||
} | ||
], | ||
"updated": "2024-10-28 08:48:24 +0000", | ||
"brakeman_version": "6.2.1" | ||
} |
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
Binary file not shown.
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,30 @@ | ||
# frozen_string_literal: true | ||
|
||
describe "Paper consent" do | ||
scenario "Download the consent form" do | ||
given_i_am_signed_in | ||
|
||
when_i_click_download_consent_form | ||
then_i_download_a_pdf_consent_form | ||
end | ||
|
||
def given_i_am_signed_in | ||
programme = create(:programme, :hpv) | ||
team = create(:team, :with_one_nurse, programmes: [programme]) | ||
@session = create(:session, team:, programme:) | ||
|
||
sign_in team.users.first | ||
end | ||
|
||
def when_i_click_download_consent_form | ||
visit session_path(@session) | ||
click_on "Download consent form (PDF)" | ||
end | ||
|
||
def then_i_download_a_pdf_consent_form | ||
expect(page.status_code).to eq(200) | ||
|
||
# PDF files include this string at the start | ||
expect(page).to have_content("PDF") | ||
end | ||
end |