blob: 2b7bbcdca6f5bf09bc547bdad43c262816e90845 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
RSpec.describe Chouette::NetworkPolicy, type: :policy do
let( :record ){ build_stubbed :network }
before { stub_policy_scope(record) }
#
# Non Destructive
# ---------------
context 'Non Destructive actions →' do
permissions :index? do
it_behaves_like 'always allowed', 'anything', archived_and_finalised: true
end
permissions :show? do
it_behaves_like 'always allowed', 'anything', archived_and_finalised: true
end
end
#
# Destructive
# -----------
context 'Destructive actions →' do
permissions :create? do
it_behaves_like 'permitted policy', 'networks.create'
end
permissions :destroy? do
it_behaves_like 'permitted policy', 'networks.destroy'
end
permissions :edit? do
it_behaves_like 'permitted policy', 'networks.update'
end
permissions :new? do
it_behaves_like 'permitted policy', 'networks.create'
end
permissions :update? do
it_behaves_like 'permitted policy', 'networks.update'
end
end
end
|