File tree Expand file tree Collapse file tree 3 files changed +20
-17
lines changed
views/sessions/patient_specific_directions Expand file tree Collapse file tree 3 files changed +20
-17
lines changed Original file line number Diff line number Diff line change 2
2
3
3
class PatientSpecificDirectionPolicy < ApplicationPolicy
4
4
def create?
5
- user . is_nurse?
5
+ user . is_nurse? || user . is_prescriber?
6
6
end
7
7
end
Original file line number Diff line number Diff line change 26
26
There are <%= @eligible_for_bulk_psd_count %> children with consent for the nasal flu vaccine
27
27
who do not require triage and do not yet have a PSD in place.
28
28
</ p >
29
- <% if current_user . is_nurse? %>
29
+
30
+ <% if policy ( PatientSpecificDirection ) . create? %>
30
31
<%= link_to new_session_patient_specific_directions_path ( @session ) , class : "nhsuk-action-link" do %>
31
32
< svg class ="nhsuk-icon nhsuk-icon--arrow-right-circle " xmlns ="http://www.w3.org/2000/svg " viewBox ="0 0 24 24 " width ="16 " height ="16 " focusable ="false " aria-hidden ="true ">
32
33
< path d ="M12 2a10 10 0 0 0-10 9h11.7l-4-4a1 1 0 0 1 1.5-1.4l5.6 5.7a1 1 0 0 1 0 1.4l-5.6 5.7a1 1 0 0 1-1.5 0 1 1 0 0 1 0-1.4l4-4H2A10 10 0 1 0 12 2z " />
Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
3
- RSpec . describe PatientSpecificDirectionPolicy do
3
+ describe PatientSpecificDirectionPolicy do
4
4
subject ( :policy ) { described_class . new ( user , PatientSpecificDirection ) }
5
5
6
- context "cis2 is disabled" , cis2 : :disabled do
7
- describe "#create?" do
8
- context "when user is a nurse" do
9
- let ( :user ) { build ( :user , :nurse ) }
6
+ describe "#create?" do
7
+ subject ( :create? ) { policy . create? }
10
8
11
- it "permits creation" do
12
- expect ( policy . create? ) . to be ( true )
13
- end
14
- end
9
+ context "when user is a nurse" do
10
+ let ( :user ) { build ( :user , :nurse ) }
15
11
16
- context "when user is not a nurse" do
17
- let ( :user ) { build ( :user , :healthcare_assistant ) }
12
+ it { should be ( true ) }
13
+ end
14
+
15
+ context "when user is a prescriber" do
16
+ let ( :user ) { build ( :user , :prescriber ) }
17
+
18
+ it { should be ( true ) }
19
+ end
20
+
21
+ context "when user is a healthcare assistant" do
22
+ let ( :user ) { build ( :user , :healthcare_assistant ) }
18
23
19
- it "denies creation" do
20
- expect ( policy . create? ) . to be ( false )
21
- end
22
- end
24
+ it { should be ( false ) }
23
25
end
24
26
end
25
27
end
You can’t perform that action at this time.
0 commit comments