travis-ci
43 of 43 new or added lines in 4 files covered. (100.0%)
271 of 289 relevant lines covered (93.77%)
32.4 hits per line
|
class ApplicationPolicy |
1✔ |
|
attr_reader :user, :record |
1✔ |
3 |
|
|
|
def initialize(user, record) |
1✔ |
|
@user = user
|
20✔ |
|
@record = record
|
20✔ |
7 |
end
|
|
8 |
|
|
|
def index? |
1✔ |
|
false
|
× |
11 |
end
|
|
12 |
|
|
|
def show? |
1✔ |
|
scope.where(:id => record.id).exists?
|
× |
15 |
end
|
|
16 |
|
|
|
def create? |
1✔ |
|
false
|
× |
19 |
end
|
|
20 |
|
|
|
def new? |
1✔ |
|
create? |
× |
23 |
end
|
|
24 |
|
|
|
def update? |
1✔ |
|
false
|
× |
27 |
end
|
|
28 |
|
|
|
def edit? |
1✔ |
|
update? |
9✔ |
31 |
end
|
|
32 |
|
|
|
def destroy? |
1✔ |
|
false
|
× |
35 |
end
|
|
36 |
|
|
|
def scope |
1✔ |
|
Pundit.policy_scope!(user, record.class)
|
× |
39 |
end
|
|
40 |
|
|
|
class Scope |
1✔ |
|
attr_reader :user, :scope |
1✔ |
43 |
|
|
|
def initialize(user, scope) |
1✔ |
|
@user = user
|
× |
|
@scope = scope
|
× |
47 |
end
|
|
48 |
|
|
|
def resolve |
1✔ |
|
scope |
× |
51 |
end
|
|
52 |
end
|
|
53 |
end
|
|
54 |
|