|
1 | | -shared_examples 'full access' do |
| 1 | +RSpec.shared_examples 'full access' do |
2 | 2 | it { is_expected.to allow_op_on_object :create, object } |
3 | 3 | it { is_expected.to allow_op_on_object :read, object } |
4 | 4 | it { is_expected.to allow_op_on_object :read_for_update, object } |
|
7 | 7 | it { is_expected.to allow_op_on_object :index, object.class } |
8 | 8 | end |
9 | 9 |
|
10 | | -shared_examples 'read only access' do |
| 10 | +RSpec.shared_examples 'read only access' do |
11 | 11 | it { is_expected.not_to allow_op_on_object :create, object } |
12 | 12 | it { is_expected.to allow_op_on_object :read, object } |
13 | 13 | it { is_expected.not_to allow_op_on_object :read_for_update, object } |
|
17 | 17 | it { is_expected.to allow_op_on_object :index, object.class } |
18 | 18 | end |
19 | 19 |
|
20 | | -shared_examples 'no access' do |
| 20 | +RSpec.shared_examples 'no access' do |
21 | 21 | it { is_expected.not_to allow_op_on_object :create, object } |
22 | 22 | it { is_expected.not_to allow_op_on_object :read, object } |
23 | 23 | it { is_expected.not_to allow_op_on_object :read_for_update, object } |
|
29 | 29 | # override the default behavior of always allowing access to :index |
30 | 30 | end |
31 | 31 |
|
32 | | -shared_examples 'admin full access' do |
| 32 | +RSpec.shared_examples 'admin full access' do |
33 | 33 | include_context 'admin setup' |
34 | 34 | it_behaves_like 'full access' |
35 | 35 | end |
36 | 36 |
|
37 | | -shared_examples 'admin read only access' do |
| 37 | +RSpec.shared_examples 'admin read only access' do |
38 | 38 | include_context 'admin read only setup' |
39 | 39 | it_behaves_like 'read only access' |
40 | 40 | end |
41 | 41 |
|
42 | | -shared_examples 'global auditor access' do |
| 42 | +RSpec.shared_examples 'global auditor access' do |
43 | 43 | include_context 'global auditor setup' |
44 | 44 | it_behaves_like 'read only access' |
45 | 45 | end |
46 | 46 |
|
47 | | -shared_context 'admin setup' do |
| 47 | +RSpec.shared_context 'admin setup' do |
48 | 48 | before do |
49 | 49 | token = { 'scope' => [VCAP::CloudController::Roles::CLOUD_CONTROLLER_ADMIN_SCOPE] } |
50 | 50 | VCAP::CloudController::SecurityContext.set(user, token) |
|
53 | 53 | after { VCAP::CloudController::SecurityContext.clear } |
54 | 54 | end |
55 | 55 |
|
56 | | -shared_context 'global auditor setup' do |
| 56 | +RSpec.shared_context 'global auditor setup' do |
57 | 57 | before do |
58 | 58 | token = { 'scope' => [VCAP::CloudController::Roles::CLOUD_CONTROLLER_GLOBAL_AUDITOR] } |
59 | 59 | VCAP::CloudController::SecurityContext.set(user, token) |
|
62 | 62 | after { VCAP::CloudController::SecurityContext.clear } |
63 | 63 | end |
64 | 64 |
|
65 | | -shared_context 'admin read only setup' do |
| 65 | +RSpec.shared_context 'admin read only setup' do |
66 | 66 | before do |
67 | 67 | token = { 'scope' => [VCAP::CloudController::Roles::CLOUD_CONTROLLER_ADMIN_READ_ONLY_SCOPE] } |
68 | 68 | VCAP::CloudController::SecurityContext.set(user, token) |
|
0 commit comments