push
circleci
835 of 2801 relevant lines covered (29.81%)
0.32 hits per line
1 |
class CheckoutPolicy < ApplicationPolicy |
× |
2 |
def index? |
× |
3 |
true
|
× |
4 |
end
|
× |
5 |
|
|
6 |
def show? |
× |
7 |
if user&.has_role?('Librarian') |
× |
8 |
true
|
× |
9 |
elsif user && (user == record.user)
|
× |
10 |
true
|
× |
11 |
end
|
× |
12 |
end
|
× |
13 |
|
|
14 |
def create? |
× |
15 |
user&.has_role?('Librarian')
|
× |
16 |
end
|
× |
17 |
|
|
18 |
def update? |
× |
19 |
if user&.has_role?('Librarian') |
× |
20 |
true
|
× |
21 |
elsif user && (user == record.user)
|
× |
22 |
true
|
× |
23 |
end
|
× |
24 |
end
|
× |
25 |
|
|
26 |
def destroy? |
× |
27 |
if record.checkin && record.user
|
× |
28 |
if user&.has_role?('Librarian') |
× |
29 |
true
|
× |
30 |
elsif user && (user == record.user)
|
× |
31 |
true
|
× |
32 |
end
|
× |
33 |
end
|
× |
34 |
end
|
× |
35 |
|
|
36 |
def remove_all? |
× |
37 |
true if user&.has_role?('User') |
× |
38 |
end
|
× |
39 |
|
|
40 |
def notify_due_date? |
× |
41 |
user&.has_role?('Librarian')
|
× |
42 |
end
|
× |
43 |
|
|
44 |
def notify_overdue? |
× |
45 |
user&.has_role?('Librarian')
|
× |
46 |
end
|
× |
47 |
end
|
× |