arpa 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop.yml +17 -0
  3. data/.ruby-version +1 -1
  4. data/.travis.yml +5 -0
  5. data/CHANGELOG.md +4 -0
  6. data/README.md +4 -4
  7. data/Rakefile +1 -2
  8. data/arpa.gemspec +17 -18
  9. data/lib/arpa.rb +65 -67
  10. data/lib/arpa/additions/resource.rb +0 -2
  11. data/lib/arpa/data_mappers/action_mapper.rb +1 -2
  12. data/lib/arpa/data_mappers/base.rb +15 -16
  13. data/lib/arpa/data_mappers/profile_mapper.rb +3 -4
  14. data/lib/arpa/data_mappers/resource_mapper.rb +1 -1
  15. data/lib/arpa/data_mappers/role_mapper.rb +2 -2
  16. data/lib/arpa/entities/action.rb +0 -2
  17. data/lib/arpa/entities/profile.rb +2 -3
  18. data/lib/arpa/entities/resource.rb +4 -6
  19. data/lib/arpa/entities/role.rb +2 -3
  20. data/lib/arpa/exceptions/record_invalid.rb +0 -1
  21. data/lib/arpa/repositories/actions/creator.rb +0 -1
  22. data/lib/arpa/repositories/actions/finder.rb +5 -6
  23. data/lib/arpa/repositories/actions/remover.rb +0 -1
  24. data/lib/arpa/repositories/actions/repository_action.rb +1 -2
  25. data/lib/arpa/repositories/base.rb +0 -2
  26. data/lib/arpa/repositories/profiles/creator.rb +0 -1
  27. data/lib/arpa/repositories/profiles/finder.rb +2 -3
  28. data/lib/arpa/repositories/profiles/remover.rb +0 -1
  29. data/lib/arpa/repositories/profiles/repository_profile.rb +1 -2
  30. data/lib/arpa/repositories/profiles/updater.rb +0 -1
  31. data/lib/arpa/repositories/registrator.rb +5 -10
  32. data/lib/arpa/repositories/resources/creator.rb +0 -1
  33. data/lib/arpa/repositories/resources/finder.rb +0 -1
  34. data/lib/arpa/repositories/resources/remover.rb +0 -1
  35. data/lib/arpa/repositories/resources/repository_resource.rb +1 -2
  36. data/lib/arpa/repositories/roles/creator.rb +0 -1
  37. data/lib/arpa/repositories/roles/finder.rb +0 -1
  38. data/lib/arpa/repositories/roles/remover.rb +0 -1
  39. data/lib/arpa/repositories/roles/repository_role.rb +1 -2
  40. data/lib/arpa/repositories/roles/updater.rb +0 -1
  41. data/lib/arpa/services/actions/create/action_creator.rb +1 -3
  42. data/lib/arpa/services/actions/remove/action_remover.rb +0 -2
  43. data/lib/arpa/services/base.rb +6 -10
  44. data/lib/arpa/services/profiles/create/profile_creator.rb +0 -2
  45. data/lib/arpa/services/profiles/profile_manager_creator.rb +0 -1
  46. data/lib/arpa/services/profiles/profile_manager_remover.rb +0 -1
  47. data/lib/arpa/services/profiles/profile_manager_updater.rb +0 -1
  48. data/lib/arpa/services/profiles/remove/profile_remover.rb +0 -2
  49. data/lib/arpa/services/profiles/update/profile_updater.rb +0 -2
  50. data/lib/arpa/services/resources/create/resource_creator.rb +0 -2
  51. data/lib/arpa/services/resources/remove/resource_remover.rb +1 -4
  52. data/lib/arpa/services/resources/resource_manager_creator.rb +1 -2
  53. data/lib/arpa/services/roles/create/role_creator.rb +0 -3
  54. data/lib/arpa/services/roles/remove/role_remover.rb +0 -2
  55. data/lib/arpa/services/roles/role_manager_creator.rb +0 -2
  56. data/lib/arpa/services/roles/role_manager_remover.rb +0 -1
  57. data/lib/arpa/services/roles/role_manager_updater.rb +0 -1
  58. data/lib/arpa/services/roles/update/role_updater.rb +0 -2
  59. data/lib/arpa/services/verifier.rb +0 -1
  60. data/lib/arpa/validators/action_validator.rb +0 -1
  61. data/lib/arpa/validators/profile_validator.rb +0 -1
  62. data/lib/arpa/validators/resource_validator.rb +0 -1
  63. data/lib/arpa/validators/role_validator.rb +0 -2
  64. data/lib/arpa/version.rb +1 -1
  65. data/lib/generators/arpa/controllers_generator.rb +21 -22
  66. data/lib/generators/arpa/install_generator.rb +5 -6
  67. data/lib/generators/arpa/templates/controllers/profiles_controller.rb +31 -37
  68. data/lib/generators/arpa/templates/controllers/resources_controller.rb +20 -11
  69. data/lib/generators/arpa/templates/controllers/roles_controller.rb +31 -37
  70. data/lib/generators/arpa/templates/migration.rb +1 -1
  71. data/spec/factories/repository_actions.rb +4 -5
  72. data/spec/factories/repository_profiles.rb +4 -5
  73. data/spec/factories/repository_resources.rb +1 -3
  74. data/spec/factories/repository_roles.rb +2 -3
  75. data/spec/factories/repository_test.rb +1 -1
  76. data/spec/lib/arpa/additions/resource_spec.rb +8 -6
  77. data/spec/lib/arpa/data_mappers/action_mapper_spec.rb +1 -3
  78. data/spec/lib/arpa/data_mappers/base_spec.rb +0 -2
  79. data/spec/lib/arpa/data_mappers/profile_mapper_spec.rb +1 -3
  80. data/spec/lib/arpa/data_mappers/resource_mapper_spec.rb +1 -3
  81. data/spec/lib/arpa/data_mappers/role_mapper_spec.rb +1 -3
  82. data/spec/lib/arpa/entities/action_spec.rb +3 -6
  83. data/spec/lib/arpa/entities/profile_spec.rb +1 -7
  84. data/spec/lib/arpa/entities/resource_spec.rb +1 -9
  85. data/spec/lib/arpa/entities/role_spec.rb +1 -7
  86. data/spec/lib/arpa/repositories/actions/finder_spec.rb +1 -8
  87. data/spec/lib/arpa/repositories/base_spec.rb +1 -9
  88. data/spec/lib/arpa/repositories/profiles/finder_spec.rb +0 -6
  89. data/spec/lib/arpa/repositories/profiles/remover_spec.rb +0 -4
  90. data/spec/lib/arpa/repositories/resources/finder_spec.rb +0 -8
  91. data/spec/lib/arpa/repositories/resources/remover_spec.rb +0 -4
  92. data/spec/lib/arpa/repositories/roles/finder_spec.rb +0 -4
  93. data/spec/lib/arpa/repositories/roles/remover_spec.rb +0 -4
  94. data/spec/lib/arpa/requests/profiles/create_request_spec.rb +10 -12
  95. data/spec/lib/arpa/requests/profiles/remove_request_spec.rb +4 -9
  96. data/spec/lib/arpa/requests/resources/create_request_spec.rb +18 -21
  97. data/spec/lib/arpa/requests/roles/create_request_spec.rb +7 -9
  98. data/spec/lib/arpa/requests/roles/remove_request_spec.rb +3 -6
  99. data/spec/lib/arpa/requests/roles/update_request_spec.rb +7 -9
  100. data/spec/lib/arpa/services/actions/create/action_creator_spec.rb +5 -14
  101. data/spec/lib/arpa/services/actions/remove/action_remover_spec.rb +3 -6
  102. data/spec/lib/arpa/services/base_spec.rb +8 -15
  103. data/spec/lib/arpa/services/profiles/create/profile_creator_spec.rb +0 -7
  104. data/spec/lib/arpa/services/profiles/profile_manager_creator_spec.rb +2 -4
  105. data/spec/lib/arpa/services/profiles/profile_manager_remover_spec.rb +3 -6
  106. data/spec/lib/arpa/services/profiles/profile_manager_updater_spec.rb +2 -4
  107. data/spec/lib/arpa/services/profiles/remove/profile_remover_spec.rb +0 -5
  108. data/spec/lib/arpa/services/profiles/update/profile_updater_spec.rb +0 -7
  109. data/spec/lib/arpa/services/resources/create/resource_creator_spec.rb +1 -7
  110. data/spec/lib/arpa/services/resources/remove/resource_remover_spec.rb +2 -6
  111. data/spec/lib/arpa/services/resources/resource_manager_creator_spec.rb +5 -7
  112. data/spec/lib/arpa/services/roles/create/role_creator_spec.rb +0 -7
  113. data/spec/lib/arpa/services/roles/remove/role_remover_spec.rb +1 -8
  114. data/spec/lib/arpa/services/roles/role_manager_creator_spec.rb +2 -4
  115. data/spec/lib/arpa/services/roles/role_manager_remover_spec.rb +2 -4
  116. data/spec/lib/arpa/services/roles/role_manager_updater_spec.rb +2 -4
  117. data/spec/lib/arpa/services/roles/update/role_updater_spec.rb +0 -7
  118. data/spec/lib/arpa/services/verifier_spec.rb +3 -6
  119. data/spec/lib/arpa/validators/action_validator_spec.rb +0 -1
  120. data/spec/lib/arpa/validators/profile_validator_spec.rb +1 -2
  121. data/spec/lib/arpa/validators/resource_validator_spec.rb +0 -1
  122. data/spec/lib/arpa/validators/role_validator_spec.rb +1 -2
  123. data/spec/spec_helper.rb +4 -6
  124. data/spec/support/schema.rb +9 -10
  125. metadata +40 -36
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Arpa::Services::Resources::Create::ResourceCreator, type: :service, fast: true do
4
-
5
4
  let(:resource_entity_class) { Arpa::Entities::Resource }
6
5
  let(:resource) { double full_name: 'UsersController' }
7
6
  let(:resourceable) { double }
@@ -11,7 +10,7 @@ describe Arpa::Services::Resources::Create::ResourceCreator, type: :service, fas
11
10
  let(:validator_class) { Arpa::Validators::ResourceValidator }
12
11
  let(:validator) { instance_double validator_class }
13
12
 
14
- let(:finder_repo_class) { Arpa::Repositories::Resources::Finder}
13
+ let(:finder_repo_class) { Arpa::Repositories::Resources::Finder }
15
14
  let(:finder_repo) { instance_double finder_repo_class }
16
15
 
17
16
  before do
@@ -24,7 +23,6 @@ describe Arpa::Services::Resources::Create::ResourceCreator, type: :service, fas
24
23
  end
25
24
 
26
25
  describe 'creating a new resource' do
27
-
28
26
  context 'when resource is invalid' do
29
27
  let(:errors) { instance_double('ActiveModel::Errors') }
30
28
 
@@ -40,7 +38,6 @@ describe Arpa::Services::Resources::Create::ResourceCreator, type: :service, fas
40
38
  expect(error.errors).not_to be_nil
41
39
  }
42
40
  end
43
-
44
41
  end
45
42
 
46
43
  context 'when resouce already exists' do
@@ -71,7 +68,6 @@ describe Arpa::Services::Resources::Create::ResourceCreator, type: :service, fas
71
68
  end
72
69
 
73
70
  context 'when build the resource with resourceable' do
74
-
75
71
  it 'entity resource should call new method' do
76
72
  expect(resource_entity_class).to have_received(:new).once
77
73
  end
@@ -80,8 +76,6 @@ describe Arpa::Services::Resources::Create::ResourceCreator, type: :service, fas
80
76
  expect(resource).to have_received(:build_correct_name).once
81
77
  end
82
78
  end
83
-
84
79
  end
85
-
86
80
  end
87
81
  end
@@ -1,17 +1,15 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Arpa::Services::Resources::Remove::ResourceRemover, type: :service, fast: true do
4
-
5
4
  let(:resource_001) { double full_name: 'UsersController' }
6
5
  let(:resource_002) { double full_name: 'OldContactsController' }
7
- let(:resources) { [resource_001, resource_002]}
6
+ let(:resources) { [resource_001, resource_002] }
8
7
 
9
8
  let(:resourceable_001) { double to_s: 'UsersController' }
10
9
  let(:resourceable_002) { double to_s: 'ContactsController' }
11
- let(:resourceables) { [resourceable_001, resourceable_002]}
10
+ let(:resourceables) { [resourceable_001, resourceable_002] }
12
11
 
13
12
  describe 'removing nonexistent resources' do
14
-
15
13
  let(:finder_repo_class) { Arpa::Repositories::Resources::Finder }
16
14
  let(:finder_repo) { instance_double finder_repo_class }
17
15
 
@@ -44,7 +42,5 @@ describe Arpa::Services::Resources::Remove::ResourceRemover, type: :service, fas
44
42
  expect(remover_repo).to have_received(:destroy).once
45
43
  expect(remover_repo).to have_received(:destroy).with(resource_002).once
46
44
  end
47
-
48
45
  end
49
-
50
46
  end
@@ -1,19 +1,18 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Arpa::Services::Resources::ResourceManagerCreator, type: :service, fast: true do
4
-
5
4
  let(:action_remover) { double }
6
5
  let(:resource_remover) { double }
7
6
  let(:resource_creator) { double }
8
7
  let(:action_creator) { double }
9
8
  let(:element) { double }
10
9
  let(:resourceables) { [resourceable_001, resourceable_002] }
11
- let(:params) { {resourceables: resourceables, except_action_methods: ['some_method']} }
10
+ let(:params) { { resourceables: resourceables, except_action_methods: ['some_method'] } }
12
11
  let(:success_proc) { ->(r) {} }
13
- let(:callback) { {success: success_proc, fail: ->(e) {raise e} } }
12
+ let(:callback) { { success: success_proc, fail: ->(e) { raise e } } }
14
13
 
15
14
  let(:resourceable_001) { double action_methods: [] }
16
- let(:resourceable_002) { double action_methods: []}
15
+ let(:resourceable_002) { double action_methods: [] }
17
16
  let(:resource_created) { double }
18
17
 
19
18
  let(:setup_creators) do
@@ -52,7 +51,7 @@ describe Arpa::Services::Resources::ResourceManagerCreator, type: :service, fast
52
51
  end
53
52
 
54
53
  it 'action_remover should call :remove_nonexistent_actions with :action_params as parameter' do
55
- expect(action_remover).to have_received(:remove_nonexistent_actions).with({resource: resource_created, actions_names: []}).twice
54
+ expect(action_remover).to have_received(:remove_nonexistent_actions).with(resource: resource_created, actions_names: []).twice
56
55
  end
57
56
 
58
57
  it 'resource_creator should call :create with :resourceable as parameter' do
@@ -61,11 +60,10 @@ describe Arpa::Services::Resources::ResourceManagerCreator, type: :service, fast
61
60
  end
62
61
 
63
62
  it 'action_creator should call :create_many with :action_params as parameter' do
64
- expect(action_creator).to have_received(:create_many).with({resource: resource_created, actions_names: []}).twice
63
+ expect(action_creator).to have_received(:create_many).with(resource: resource_created, actions_names: []).twice
65
64
  end
66
65
 
67
66
  it 'success callback should be called with Array of resources as parameter' do
68
67
  expect(success_proc).to have_received(:call).with([resource_created, resource_created])
69
68
  end
70
-
71
69
  end
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Arpa::Services::Roles::Create::RoleCreator, type: :service, fast: true do
4
-
5
4
  let(:role_entity_class) { Arpa::Entities::Role }
6
5
  let(:role) { double }
7
6
  let(:params) { double }
@@ -16,7 +15,6 @@ describe Arpa::Services::Roles::Create::RoleCreator, type: :service, fast: true
16
15
  end
17
16
 
18
17
  describe 'creating a new role' do
19
-
20
18
  context 'when role is invalid' do
21
19
  let(:errors) { instance_double('ActiveModel::Errors') }
22
20
 
@@ -32,7 +30,6 @@ describe Arpa::Services::Roles::Create::RoleCreator, type: :service, fast: true
32
30
  expect(error.errors).not_to be_nil
33
31
  }
34
32
  end
35
-
36
33
  end
37
34
 
38
35
  context 'when role is valid' do
@@ -55,14 +52,10 @@ describe Arpa::Services::Roles::Create::RoleCreator, type: :service, fast: true
55
52
  end
56
53
 
57
54
  context 'when build the role' do
58
-
59
55
  it 'entity role should call new method' do
60
56
  expect(role_entity_class).to have_received(:new).once
61
57
  end
62
-
63
58
  end
64
-
65
59
  end
66
-
67
60
  end
68
61
  end
@@ -1,13 +1,12 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Arpa::Services::Roles::Remove::RoleRemover, type: :service, fast: true do
4
-
5
4
  let(:role) { double }
6
5
 
7
6
  describe 'removing role' do
8
7
  let(:remover_repo_class) { Arpa::Repositories::Roles::Remover }
9
8
  let(:remover_repo) { instance_double remover_repo_class }
10
- let(:setup) { }
9
+ let(:setup) {}
11
10
 
12
11
  before do
13
12
  allow(remover_repo_class).to receive(:new).and_return(remover_repo)
@@ -16,7 +15,6 @@ describe Arpa::Services::Roles::Remove::RoleRemover, type: :service, fast: true
16
15
  end
17
16
 
18
17
  context 'when role has no profiles' do
19
-
20
18
  let(:setup) do
21
19
  allow(role).to receive(:has_profile?).and_return(false)
22
20
  allow(remover_repo).to receive(:destroy)
@@ -29,11 +27,9 @@ describe Arpa::Services::Roles::Remove::RoleRemover, type: :service, fast: true
29
27
  it 'remover repository should call :new once' do
30
28
  expect(remover_repo_class).to have_received(:new).once
31
29
  end
32
-
33
30
  end
34
31
 
35
32
  context 'when role has profiles' do
36
-
37
33
  let(:setup) do
38
34
  allow(role).to receive(:has_profile?).and_return(true)
39
35
  allow(remover_repo).to receive(:disable)
@@ -42,9 +38,6 @@ describe Arpa::Services::Roles::Remove::RoleRemover, type: :service, fast: true
42
38
  it 'remover repository should call :disable once' do
43
39
  expect(remover_repo).to have_received(:disable).once
44
40
  end
45
-
46
41
  end
47
-
48
42
  end
49
-
50
43
  end
@@ -1,11 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Arpa::Services::Roles::RoleManagerCreator, type: :service, fast: true do
4
-
5
4
  let(:role_creator) { double }
6
- let(:params) { {role: {name: 'role_name', description: 'role_description', action_ids: [1, 2]}} }
5
+ let(:params) { { role: { name: 'role_name', description: 'role_description', action_ids: [1, 2] } } }
7
6
  let(:success_proc) { ->(r) {} }
8
- let(:callback) { {success: success_proc, fail: ->(e) {raise e} } }
7
+ let(:callback) { { success: success_proc, fail: ->(e) { raise e } } }
9
8
 
10
9
  let(:setup_creators) do
11
10
  allow(Arpa::Services::Roles::Create::RoleCreator).to receive(:new).and_return(role_creator)
@@ -27,5 +26,4 @@ describe Arpa::Services::Roles::RoleManagerCreator, type: :service, fast: true d
27
26
  it 'role_creator should call :create with parameters' do
28
27
  expect(role_creator).to have_received(:create).with(params[:role]).once
29
28
  end
30
-
31
29
  end
@@ -1,12 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Arpa::Services::Roles::RoleManagerRemover, type: :service, fast: true do
4
-
5
4
  let(:role_remover) { double }
6
5
  let(:role) { double }
7
- let(:params) { {role: role} }
6
+ let(:params) { { role: role } }
8
7
  let(:success_proc) { ->(r) {} }
9
- let(:callback) { {success: success_proc, fail: ->(e) {raise e} } }
8
+ let(:callback) { { success: success_proc, fail: ->(e) { raise e } } }
10
9
 
11
10
  let(:setup_updaters) do
12
11
  allow(Arpa::Services::Roles::Remove::RoleRemover).to receive(:new).and_return(role_remover)
@@ -28,5 +27,4 @@ describe Arpa::Services::Roles::RoleManagerRemover, type: :service, fast: true d
28
27
  it 'role_remover should call :remove with role as parameter' do
29
28
  expect(role_remover).to have_received(:remove).with(role).once
30
29
  end
31
-
32
30
  end
@@ -1,11 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Arpa::Services::Roles::RoleManagerUpdater, type: :service, fast: true do
4
-
5
4
  let(:role_updater) { double }
6
- let(:params) { {role: {name: 'role_name', description: 'role_description', action_ids: [1, 2]}} }
5
+ let(:params) { { role: { name: 'role_name', description: 'role_description', action_ids: [1, 2] } } }
7
6
  let(:success_proc) { ->(r) {} }
8
- let(:callback) { {success: success_proc, fail: ->(e) {raise e} } }
7
+ let(:callback) { { success: success_proc, fail: ->(e) { raise e } } }
9
8
 
10
9
  let(:setup_updaters) do
11
10
  allow(Arpa::Services::Roles::Update::RoleUpdater).to receive(:new).and_return(role_updater)
@@ -27,5 +26,4 @@ describe Arpa::Services::Roles::RoleManagerUpdater, type: :service, fast: true d
27
26
  it 'role_updater should call :update with parameters' do
28
27
  expect(role_updater).to have_received(:update).with(params[:role]).once
29
28
  end
30
-
31
29
  end
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Arpa::Services::Roles::Update::RoleUpdater, type: :service, fast: true do
4
-
5
4
  let(:role_entity_class) { Arpa::Entities::Role }
6
5
  let(:role) { double }
7
6
  let(:params) { double }
@@ -16,7 +15,6 @@ describe Arpa::Services::Roles::Update::RoleUpdater, type: :service, fast: true
16
15
  end
17
16
 
18
17
  describe 'updating a role' do
19
-
20
18
  context 'when role is invalid' do
21
19
  let(:errors) { instance_double('ActiveModel::Errors') }
22
20
 
@@ -32,7 +30,6 @@ describe Arpa::Services::Roles::Update::RoleUpdater, type: :service, fast: true
32
30
  expect(error.errors).not_to be_nil
33
31
  }
34
32
  end
35
-
36
33
  end
37
34
 
38
35
  context 'when role is valid' do
@@ -55,14 +52,10 @@ describe Arpa::Services::Roles::Update::RoleUpdater, type: :service, fast: true
55
52
  end
56
53
 
57
54
  context 'when build the role' do
58
-
59
55
  it 'entity role should call new method' do
60
56
  expect(role_entity_class).to have_received(:new).once
61
57
  end
62
-
63
58
  end
64
-
65
59
  end
66
-
67
60
  end
68
61
  end
@@ -1,14 +1,13 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Arpa::Services::Verifier do
4
- let(:current_user) { double is_arpa_admin?: false, profile_ids: [1,2,3] }
4
+ let(:current_user) { double is_arpa_admin?: false, profile_ids: [1, 2, 3] }
5
5
 
6
6
  subject(:verifier) { Arpa::Services::Verifier.new(current_user) }
7
7
 
8
8
  describe '#has_access?' do
9
-
10
9
  context 'when current_user is a arpa admin' do
11
- let(:current_user) { double is_arpa_admin?: true, profile_ids: [1,2,3] }
10
+ let(:current_user) { double is_arpa_admin?: true, profile_ids: [1, 2, 3] }
12
11
 
13
12
  it 'should has access' do
14
13
  expect(subject.has_access?('home', 'some_action')).to be_truthy
@@ -38,10 +37,8 @@ describe Arpa::Services::Verifier do
38
37
  end
39
38
 
40
39
  it 'should be called :permissions from Arpa::Repositories::Actions::Finder' do
41
- expect(action_finder).to have_received(:permission).with('users', 'index', [1,2,3]).once
40
+ expect(action_finder).to have_received(:permission).with('users', 'index', [1, 2, 3]).once
42
41
  end
43
-
44
42
  end
45
-
46
43
  end
47
44
  end
@@ -11,5 +11,4 @@ describe Arpa::Validators::ActionValidator, type: :validator, fast: true do
11
11
  it { expect(subject.errors).to be_added(:name, :blank) }
12
12
  it { expect(subject.errors).to be_added(:resource_id, :blank) }
13
13
  end
14
-
15
14
  end
@@ -10,7 +10,6 @@ describe Arpa::Validators::ProfileValidator, type: :validator, fast: true do
10
10
  context 'when require' do
11
11
  it { expect(subject.errors).to be_added(:name, :blank) }
12
12
  it { expect(subject.errors).to be_added(:description, :blank) }
13
- it { expect(subject.errors).to be_added(:role_ids, :many_blank) }
13
+ it { expect(subject.errors).to be_added(:role_ids, :blank) }
14
14
  end
15
-
16
15
  end
@@ -11,5 +11,4 @@ describe Arpa::Validators::ResourceValidator, type: :validator, fast: true do
11
11
  it { expect(subject.errors).to be_added(:full_name, :blank) }
12
12
  it { expect(subject.errors).to be_added(:name, :blank) }
13
13
  end
14
-
15
14
  end
@@ -10,7 +10,6 @@ describe Arpa::Validators::RoleValidator, type: :validator, fast: true do
10
10
  context 'when require' do
11
11
  it { expect(subject.errors).to be_added(:name, :blank) }
12
12
  it { expect(subject.errors).to be_added(:description, :blank) }
13
- it { expect(subject.errors).to be_added(:action_ids, :many_blank) }
13
+ it { expect(subject.errors).to be_added(:action_ids, :blank) }
14
14
  end
15
-
16
15
  end
@@ -1,7 +1,7 @@
1
1
  require 'active_record'
2
2
  require 'arpa'
3
3
  require 'database_cleaner'
4
- require 'factory_girl'
4
+ require 'factory_bot'
5
5
  require 'support/repositories/test_repository'
6
6
  require 'i18n'
7
7
 
@@ -11,13 +11,12 @@ ActiveRecord::Base.establish_connection(adapter: 'sqlite3',
11
11
  load File.dirname(__FILE__) + '/support/schema.rb'
12
12
 
13
13
  I18n.config.enforce_available_locales = true
14
- I18n.load_path << File.expand_path('../../lib/config/locales/arpa.en.yml', __FILE__)
14
+ I18n.load_path << File.expand_path('../lib/config/locales/arpa.en.yml', __dir__)
15
15
  I18n.reload!
16
16
 
17
17
  RSpec.configure do |config|
18
-
19
- config.include FactoryGirl::Syntax::Methods
20
- FactoryGirl.find_definitions
18
+ config.include FactoryBot::Syntax::Methods
19
+ FactoryBot.find_definitions
21
20
 
22
21
  config.before(:suite) do
23
22
  DatabaseCleaner.strategy = :transaction
@@ -29,5 +28,4 @@ RSpec.configure do |config|
29
28
  example.run
30
29
  end
31
30
  end
32
-
33
31
  end
@@ -1,18 +1,18 @@
1
1
  ActiveRecord::Schema.define do
2
2
  self.verbose = false
3
3
 
4
- create_table :test_repositories, :force => true do |t|
4
+ create_table :test_repositories, force: true do |t|
5
5
  t.string :name
6
6
  t.timestamps null: false
7
7
  end
8
8
 
9
- create_table :repository_resources, :force => true do |t|
9
+ create_table :repository_resources, force: true do |t|
10
10
  t.string :name
11
11
  t.string :full_name
12
12
  t.timestamps null: false
13
13
  end
14
14
 
15
- create_table :repository_actions, :force => true do |t|
15
+ create_table :repository_actions, force: true do |t|
16
16
  t.string :name
17
17
  t.references :repository_resource, index: true
18
18
  t.timestamps null: false
@@ -20,42 +20,41 @@ ActiveRecord::Schema.define do
20
20
 
21
21
  add_foreign_key :repository_actions, :repository_resources
22
22
 
23
- create_table :repository_roles, :force => true do |t|
23
+ create_table :repository_roles, force: true do |t|
24
24
  t.string :name
25
25
  t.string :description
26
26
  t.boolean :removed, default: false
27
27
  t.timestamps null: false
28
28
  end
29
29
 
30
- create_join_table :repository_actions, :repository_roles, :force => true do |t|
30
+ create_join_table :repository_actions, :repository_roles, force: true do |t|
31
31
  t.index :repository_action_id, name: 'action_role_id'
32
32
  t.index :repository_role_id, name: 'role_action_id'
33
33
  end
34
34
 
35
- create_table :repository_profiles, :force => true do |t|
35
+ create_table :repository_profiles, force: true do |t|
36
36
  t.string :name
37
37
  t.string :description
38
38
  t.boolean :removed, default: false
39
39
  t.timestamps null: false
40
40
  end
41
41
 
42
- create_join_table :repository_roles, :repository_profiles, :force => true do |t|
42
+ create_join_table :repository_roles, :repository_profiles, force: true do |t|
43
43
  t.index :repository_role_id, name: 'role_profile_id'
44
44
  t.index :repository_profile_id, name: 'profile_role_ids'
45
45
  end
46
46
 
47
- create_table :users, :force => true do |t|
47
+ create_table :users, force: true do |t|
48
48
  t.string :name
49
49
  t.string :email
50
50
  t.timestamps null: false
51
51
  end
52
52
 
53
- create_join_table :repository_profiles, :users, :force => true do |t|
53
+ create_join_table :repository_profiles, :users, force: true do |t|
54
54
  t.index :repository_profile_id, name: 'profile_user_id'
55
55
  t.index :user_id, name: 'user_profile_id'
56
56
  end
57
57
 
58
58
  add_column :repository_profiles, :entity_id, :integer, default: nil
59
59
  add_column :repository_profiles, :entity_class, :string, default: nil
60
-
61
60
  end