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
@@ -8,27 +8,37 @@ module Arpa
8
8
  end
9
9
 
10
10
  # GET /resources/1
11
- def show
12
- end
11
+ def show; end
13
12
 
14
13
  # GET /generate_resources_and_actions
15
14
  def generate_resources_and_actions
16
15
  Rails.application.eager_load!
17
16
 
18
- resource_creator.create({resourceables: ApplicationController.descendants, except_action_methods: ApplicationController.action_methods}, {
19
- success: -> (resource) {
20
- flash[:notice] = I18n.t('flash.actions.generate_resources_and_actions.notice')
21
- },
22
- fail: -> (error) {
23
- flash[:alert] = I18n.t('flash.actions.generate_resources_and_actions.alert')
24
- }
25
- })
17
+ resource_params = {
18
+ resourceables: ApplicationController.descendants,
19
+ except_action_methods: ApplicationController.action_methods
20
+ }
21
+ resource_creator.create(resource_params,
22
+ success: success_callback,
23
+ fail: fail_callback)
26
24
 
27
25
  redirect_to resources_path
28
26
  end
29
27
 
30
28
  private
31
29
 
30
+ def success_callback
31
+ lambda do |_resource|
32
+ flash[:notice] = I18n.t('flash.actions.generate_resources_and_actions.notice')
33
+ end
34
+ end
35
+
36
+ def fail_callback
37
+ lambda do |_error|
38
+ flash[:alert] = I18n.t('flash.actions.generate_resources_and_actions.alert')
39
+ end
40
+ end
41
+
32
42
  def resource_creator
33
43
  @resource_creator ||= Arpa::Services::Resources::ResourceManagerCreator.new
34
44
  end
@@ -40,6 +50,5 @@ module Arpa
40
50
  def set_resource
41
51
  @resource = resource_finder.find(params[:id])
42
52
  end
43
-
44
53
  end
45
54
  end
@@ -1,6 +1,6 @@
1
1
  module Arpa
2
2
  class RolesController < ApplicationController
3
- before_action :set_role, only: [:show, :edit, :update, :remove]
3
+ before_action :set_role, only: %i[show edit update remove]
4
4
 
5
5
  # GET /roles
6
6
  def index
@@ -8,8 +8,7 @@ module Arpa
8
8
  end
9
9
 
10
10
  # GET /roles/1
11
- def show
12
- end
11
+ def show; end
13
12
 
14
13
  # GET /roles/new
15
14
  def new
@@ -24,49 +23,42 @@ module Arpa
24
23
 
25
24
  # POST /roles
26
25
  def create
27
- role_creator.create({role: role_params}, {
28
- success: -> (role) {
29
- redirect_to role_path(role.id), notice: I18n.t('flash.actions.create_role.notice')
30
- },
31
- fail: -> (error) {
32
- @role = Arpa::Entities::Role.new(role_params)
33
- @error = error
34
- all_resources
35
- render :new
36
- }
37
- })
26
+ role_creator.create({ role: role_params },
27
+ success: redirect_to_index(I18n.t('flash.actions.create_role.notice')),
28
+ fail: render_errors(:new))
38
29
  end
39
30
 
40
31
  # PATCH/PUT /roles/1
41
32
  def update
42
- role_updater.update({role: role_params}, {
43
- success: -> (role) {
44
- redirect_to role_path(role.id), notice: I18n.t('flash.actions.update_role.notice')
45
- },
46
- fail: -> (error) {
47
- @role = Arpa::Entities::Role.new(role_params)
48
- @error = error
49
- all_resources
50
- render :edit
51
- }
52
- })
33
+ role_updater.update({ role: role_params },
34
+ success: redirect_to_index(I18n.t('flash.actions.update_role.notice')),
35
+ fail: render_errors(:edit))
53
36
  end
54
37
 
55
38
  # DELETE /roles/1
56
39
  def remove
57
- role_remover.remove({role: @role}, {
58
- success: -> (role) {
59
- redirect_to roles_path, notice: I18n.t('flash.actions.remove_role.notice')
60
- },
61
- fail: -> (error) {
62
- redirect_to roles_path, notice: I18n.t('flash.actions.remove_role.alert')
63
- }
64
- })
65
-
40
+ role_remover.remove({ role: @role },
41
+ success: redirect_to_index(I18n.t('flash.actions.remove_role.notice')),
42
+ fail: redirect_to_index(I18n.t('flash.actions.remove_role.alert')))
66
43
  end
67
44
 
68
45
  private
69
46
 
47
+ def redirect_to_index(message)
48
+ lambda do |_role|
49
+ redirect_to roles_path, notice: message
50
+ end
51
+ end
52
+
53
+ def render_errors(action_to_render)
54
+ lambda do |error|
55
+ @role = Arpa::Entities::Role.new(role_params)
56
+ @error = error
57
+ all_resources
58
+ render action_to_render
59
+ end
60
+ end
61
+
70
62
  def role_creator
71
63
  @role_creator ||= Arpa::Services::Roles::RoleManagerCreator.new
72
64
  end
@@ -96,9 +88,11 @@ module Arpa
96
88
  end
97
89
 
98
90
  def role_params
99
- params.require(:role).
100
- permit(:id, :name, :description, action_ids: [])
101
- end
91
+ permitted_params = %i[id name description]
102
92
 
93
+ params.require(:role)
94
+ .permit(permitted_params, action_ids: [])
95
+ .to_h
96
+ end
103
97
  end
104
98
  end
@@ -1,4 +1,4 @@
1
- class CreateArpaTables < ActiveRecord::Migration
1
+ class CreateArpaTables < ActiveRecord::Migration[5.2]
2
2
  def change
3
3
 
4
4
  create_table :repository_resources, :force => true do |t|
@@ -1,19 +1,18 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :repository_action, class: Arpa::Repositories::Actions::RepositoryAction do
3
-
4
3
  trait :index do
5
4
  name 'index'
6
- resource { FactoryGirl.create(:repository_resource, :user) }
5
+ resource { FactoryBot.create(:repository_resource, :user) }
7
6
  end
8
7
 
9
8
  trait :show do
10
9
  name 'show'
11
- resource { FactoryGirl.create(:repository_resource, :user) }
10
+ resource { FactoryBot.create(:repository_resource, :user) }
12
11
  end
13
12
 
14
13
  trait :with_complete_association do
15
14
  name 'index_new'
16
- resource { FactoryGirl.create(:repository_resource, :user) }
15
+ resource { FactoryBot.create(:repository_resource, :user) }
17
16
  end
18
17
  end
19
18
  end
@@ -1,16 +1,15 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :repository_profile, class: Arpa::Repositories::Profiles::RepositoryProfile do
3
-
4
3
  name 'some_profile'
5
4
  description 'description_profile'
6
5
 
7
6
  trait :with_complete_association do
8
- roles { [FactoryGirl.create(:repository_role, :with_complete_association)] }
7
+ roles { [FactoryBot.create(:repository_role, :with_complete_association)] }
9
8
  end
10
9
 
11
10
  trait :with_entity do
12
- entity_id { FactoryGirl.create(:entity) }
13
- entity_class { FactoryGirl.create(:entity).class.to_s }
11
+ entity_id { FactoryBot.create(:entity) }
12
+ entity_class { FactoryBot.create(:entity).class.to_s }
14
13
  end
15
14
  end
16
15
  end
@@ -1,6 +1,5 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :repository_resource, class: Arpa::Repositories::Resources::RepositoryResource do
3
-
4
3
  trait :user do
5
4
  full_name 'UsersController'
6
5
  name 'users'
@@ -10,6 +9,5 @@ FactoryGirl.define do
10
9
  full_name 'ContactsController'
11
10
  name 'contacts'
12
11
  end
13
-
14
12
  end
15
13
  end
@@ -1,11 +1,10 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :repository_role, class: Arpa::Repositories::Roles::RepositoryRole do
3
-
4
3
  name 'some_role'
5
4
  description 'description_role'
6
5
 
7
6
  trait :with_complete_association do
8
- actions {[FactoryGirl.create(:repository_action, :with_complete_association)] }
7
+ actions { [FactoryBot.create(:repository_action, :with_complete_association)] }
9
8
  end
10
9
  end
11
10
  end
@@ -1,4 +1,4 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :entity, class: TestRepository do
3
3
  name 'some entity'
4
4
  end
@@ -1,14 +1,18 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  class ResourceImplementation
4
- def self.helper_method(args);end
4
+ def self.helper_method(args); end
5
5
  include Arpa::Additions::Resource
6
- def session;'';end
7
- def current_user;'';end
6
+ def session
7
+ ''
8
+ end
9
+
10
+ def current_user
11
+ ''
12
+ end
8
13
  end
9
14
 
10
15
  describe Arpa::Additions::Resource, type: :addition, fast: true do
11
-
12
16
  let(:resource_implementation) { ResourceImplementation.new }
13
17
 
14
18
  let(:verifier) { double }
@@ -21,7 +25,6 @@ describe Arpa::Additions::Resource, type: :addition, fast: true do
21
25
  end
22
26
 
23
27
  describe '#has_access?' do
24
-
25
28
  let(:setup) do
26
29
  allow(verifier).to receive(:has_access?)
27
30
  resource_implementation.has_access?(resource, action)
@@ -35,5 +38,4 @@ describe Arpa::Additions::Resource, type: :addition, fast: true do
35
38
  expect(verifier).to have_received(:has_access?).with(resource, action).once
36
39
  end
37
40
  end
38
-
39
41
  end
@@ -4,7 +4,7 @@ describe Arpa::DataMappers::ActionMapper, type: :mapper, fast: true do
4
4
  let(:mapper) { Arpa::DataMappers::ActionMapper.instance }
5
5
 
6
6
  describe 'mapping to record instance' do
7
- let(:entity) { Arpa::Entities::Action.new(name: 'index', resource_id: 1)}
7
+ let(:entity) { Arpa::Entities::Action.new(name: 'index', resource_id: 1) }
8
8
  let(:record_instance) { mapper.map_to_record(entity) }
9
9
 
10
10
  it 'record_instance should be an instance of ActiveRecord::Base' do
@@ -19,7 +19,6 @@ describe Arpa::DataMappers::ActionMapper, type: :mapper, fast: true do
19
19
  expect(record_instance.resource_id).to be == 1
20
20
  expect(record_instance.repository_resource_id).to be == 1
21
21
  end
22
-
23
22
  end
24
23
 
25
24
  describe 'mapping to entity instance' do
@@ -42,5 +41,4 @@ describe Arpa::DataMappers::ActionMapper, type: :mapper, fast: true do
42
41
  expect(entity_instance.resource).to be_an Arpa::Entities::Resource
43
42
  end
44
43
  end
45
-
46
44
  end
@@ -10,7 +10,6 @@ describe Arpa::DataMappers::Base, type: :mapper, fast: true do
10
10
  let(:mapper) { TestMapper.instance }
11
11
 
12
12
  context 'when initialize more than one Mapper' do
13
-
14
13
  let(:mapper_002) { TestMapper.instance }
15
14
 
16
15
  it 'the instances should use singleton pattern' do
@@ -43,5 +42,4 @@ describe Arpa::DataMappers::Base, type: :mapper, fast: true do
43
42
  expect(entity_instance.id).to be == record.id
44
43
  end
45
44
  end
46
-
47
45
  end
@@ -4,7 +4,7 @@ describe Arpa::DataMappers::ProfileMapper, type: :mapper, fast: true do
4
4
  let(:mapper) { Arpa::DataMappers::ProfileMapper.instance }
5
5
 
6
6
  describe 'mapping to record instance' do
7
- let(:entity) { Arpa::Entities::Profile.new(name: 'some_profile')}
7
+ let(:entity) { Arpa::Entities::Profile.new(name: 'some_profile') }
8
8
  let(:record_instance) { mapper.map_to_record(entity) }
9
9
 
10
10
  it 'record_instance should be an instance of Arpa::Repositories::Profiles::RepositoryProfile' do
@@ -37,7 +37,5 @@ describe Arpa::DataMappers::ProfileMapper, type: :mapper, fast: true do
37
37
  it 'entity_instance should fill the property :role_ids from record property' do
38
38
  expect(entity_instance.role_ids).to eq [role_record.id]
39
39
  end
40
-
41
40
  end
42
-
43
41
  end
@@ -4,7 +4,7 @@ describe Arpa::DataMappers::ResourceMapper, type: :mapper, fast: true do
4
4
  let(:mapper) { Arpa::DataMappers::ResourceMapper.instance }
5
5
 
6
6
  describe 'mapping to record instance' do
7
- let(:entity) { Arpa::Entities::Resource.new(full_name: 'UsersController')}
7
+ let(:entity) { Arpa::Entities::Resource.new(full_name: 'UsersController') }
8
8
  let(:record_instance) { mapper.map_to_record(entity) }
9
9
 
10
10
  it 'record_instance should be an instance of ActiveRecord::Base' do
@@ -32,7 +32,5 @@ describe Arpa::DataMappers::ResourceMapper, type: :mapper, fast: true do
32
32
  it 'entity_instance should fill the property :actions from record property' do
33
33
  expect(entity_instance.actions.first).to be_an Arpa::Entities::Action
34
34
  end
35
-
36
35
  end
37
-
38
36
  end
@@ -4,7 +4,7 @@ describe Arpa::DataMappers::RoleMapper, type: :mapper, fast: true do
4
4
  let(:mapper) { Arpa::DataMappers::RoleMapper.instance }
5
5
 
6
6
  describe 'mapping to record instance' do
7
- let(:entity) { Arpa::Entities::Role.new(name: 'some_role')}
7
+ let(:entity) { Arpa::Entities::Role.new(name: 'some_role') }
8
8
  let(:record_instance) { mapper.map_to_record(entity) }
9
9
 
10
10
  it 'record_instance should be an instance of Arpa::Repositories::Roles::RepositoryRole' do
@@ -41,7 +41,5 @@ describe Arpa::DataMappers::RoleMapper, type: :mapper, fast: true do
41
41
  it 'entity_instance should fill the property :profiles from record property' do
42
42
  expect(entity_instance.profiles.first).to be_an Arpa::Entities::Profile
43
43
  end
44
-
45
44
  end
46
-
47
45
  end
@@ -1,24 +1,23 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Arpa::Entities::Action, type: :entity, fast: true do
4
- subject { Arpa::Entities::Action.new resource: resource, name: 'index'}
4
+ subject { Arpa::Entities::Action.new resource: resource, name: 'index' }
5
5
 
6
6
  describe 'getting description by action name and resource name' do
7
7
  before do
8
- I18n.backend.store_translations(:en, entities: { resources: { users: { actions: { description: { index: 'List of Users' } } } } } )
8
+ I18n.backend.store_translations(:en, entities: { resources: { users: { actions: { description: { index: 'List of Users' } } } } })
9
9
  end
10
10
 
11
11
  context 'when resource.name is "users" and action.name is "index"' do
12
12
  let(:resource) { double(name: 'users') }
13
13
 
14
14
  it 'description should be "List of Users"' do
15
- expect(subject.description).to eql "List of Users"
15
+ expect(subject.description).to eql 'List of Users'
16
16
  end
17
17
  end
18
18
  end
19
19
 
20
20
  describe 'getting the resource name' do
21
-
22
21
  context 'when resource is not nil' do
23
22
  let(:resource) { double(name: 'users') }
24
23
 
@@ -33,7 +32,5 @@ describe Arpa::Entities::Action, type: :entity, fast: true do
33
32
  expect(subject.resource_name).to be_empty
34
33
  end
35
34
  end
36
-
37
35
  end
38
-
39
36
  end
@@ -1,13 +1,9 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Arpa::Entities::Profile, type: :entity, fast: true do
4
-
5
4
  describe 'initializing' do
6
-
7
5
  describe 'setting default values' do
8
-
9
6
  context 'when pass some parameters as nil' do
10
-
11
7
  it 'attribute :role_ids should be an empty Array' do
12
8
  expect(subject.role_ids).to eq []
13
9
  end
@@ -23,7 +19,7 @@ describe Arpa::Entities::Profile, type: :entity, fast: true do
23
19
  end
24
20
 
25
21
  context 'when pass some parameters as empty' do
26
- let(:attrs) { {role_ids: '', roles: '', removed: ''} }
22
+ let(:attrs) { { role_ids: '', roles: '', removed: '' } }
27
23
  subject { Arpa::Entities::Profile.new attrs }
28
24
 
29
25
  it 'attribute :role_ids should be an empty Array' do
@@ -38,7 +34,5 @@ describe Arpa::Entities::Profile, type: :entity, fast: true do
38
34
  expect(subject.removed).to be_falsey
39
35
  end
40
36
  end
41
-
42
37
  end
43
-
44
38
  end
@@ -1,13 +1,9 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Arpa::Entities::Resource, type: :entity, fast: true do
4
-
5
4
  describe 'initializing' do
6
-
7
5
  describe 'setting default values' do
8
-
9
6
  context 'when pass :actions as nil' do
10
-
11
7
  it 'attribute :actions should be an empty Array' do
12
8
  expect(subject.actions).to eq []
13
9
  end
@@ -15,18 +11,16 @@ describe Arpa::Entities::Resource, type: :entity, fast: true do
15
11
  end
16
12
 
17
13
  context 'when pass :actions as empty' do
18
- let(:attrs) { {actions: ''} }
14
+ let(:attrs) { { actions: '' } }
19
15
  subject { Arpa::Entities::Resource.new attrs }
20
16
 
21
17
  it 'attribute :actions should be an empty Array' do
22
18
  expect(subject.actions).to eq []
23
19
  end
24
20
  end
25
-
26
21
  end
27
22
 
28
23
  describe '#build_correct_name' do
29
-
30
24
  before { subject.build_correct_name }
31
25
 
32
26
  context 'when pass :full_name as "UsersController"' do
@@ -52,7 +46,5 @@ describe Arpa::Entities::Resource, type: :entity, fast: true do
52
46
  expect(subject.name).to eql 'authentication/someone/users'
53
47
  end
54
48
  end
55
-
56
49
  end
57
-
58
50
  end