eac_rails_base0 0.54.0 → 0.55.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/eac_rails_base0.js +1 -0
- data/app/assets/stylesheets/eac_rails_base0.scss +1 -0
- data/app/controllers/eac_rails_base0/application_controller.rb +1 -0
- data/app/helpers/eac_rails_base0/user_menu_helper.rb +2 -2
- data/config/initializers/active_scaffold.rb +1 -1
- data/config/initializers/devise.rb +14 -0
- data/config/locales/en.yml +4 -0
- data/lib/eac_rails_base0/app_base/ability.rb +1 -0
- data/lib/eac_rails_base0/app_base/application/all.rb +9 -5
- data/lib/eac_rails_base0/engine.rb +1 -0
- data/lib/eac_rails_base0/rspec/setup.rb +6 -58
- data/lib/eac_rails_base0/rspec/shared_contexts/when_user_is_admin.rb +22 -0
- data/lib/eac_rails_base0/rspec/shared_contexts/when_user_is_anonymous.rb +23 -0
- data/lib/eac_rails_base0/rspec/shared_contexts/when_user_is_non_admin.rb +22 -0
- data/lib/eac_rails_base0/version.rb +1 -1
- metadata +36 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed004cd53392468a8b2841179121a6bbc4d95e910c19c3d9ad8bcbfaa33e21cd
|
4
|
+
data.tar.gz: 46f38c602f05b20989f2c5faafe98666dfc6d679a5f08083e7dc21894abab724
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5f04875a125f2ce7b988c42dad3239571d7ecba1e224a73d3863cb7924fe7fdb77e05406380bf9cd964ca3b1d7019b36f4829ba3abfe6edfb4c88f8170bd022
|
7
|
+
data.tar.gz: 1d3749dc34a384cbf99883003b45d7516f74335b383d289415f3826110384a7555584aa545786fbbb46edffb28e652330b8f1535ef7cd7ad3f3ecc1c0af2c9a9
|
@@ -11,6 +11,7 @@ module EacRailsBase0
|
|
11
11
|
helper ::EacRailsUtils::FormatterHelper
|
12
12
|
helper ::EacRailsUtils::LinksHelper
|
13
13
|
helper ::EacRailsUtils::OpenGraphProtocolHelper
|
14
|
+
helper ::EacRailsBase0::PanelDefaultHelper
|
14
15
|
helper ::EacRailsBase0::UserMenuHelper
|
15
16
|
|
16
17
|
# Prevent CSRF attacks by raising an exception.
|
@@ -8,9 +8,9 @@ module EacRailsBase0
|
|
8
8
|
r[current_user.to_s] = {
|
9
9
|
'Alterar senha' => [eac_users_support.edit_user_registration_path]
|
10
10
|
}
|
11
|
-
r['
|
11
|
+
r[t('devise.log_out')] = [eac_users_support.destroy_user_session_path, link_method: :delete]
|
12
12
|
else
|
13
|
-
r['
|
13
|
+
r[t('devise.log_in')] = [eac_users_support.new_user_session_path]
|
14
14
|
end
|
15
15
|
r
|
16
16
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'devise'
|
4
|
+
|
5
|
+
# Use this hook to configure devise mailer, warden hooks and so forth.
|
6
|
+
# Many of these configuration options can be set straight in your model.
|
7
|
+
Devise.setup do |config|
|
8
|
+
#
|
9
|
+
# When using OmniAuth, Devise cannot automatically set OmniAuth path,
|
10
|
+
# so you need to do it manually. For the users scope, it would be:
|
11
|
+
# config.omniauth_path_prefix = '/my_engine/users/auth'
|
12
|
+
|
13
|
+
# config.parent_controller = 'EacRailsBase0::ApplicationController'
|
14
|
+
end
|
data/config/locales/en.yml
CHANGED
@@ -6,7 +6,8 @@ module EacRailsBase0App
|
|
6
6
|
class Application < Rails::Application
|
7
7
|
module All
|
8
8
|
common_concern do
|
9
|
-
setup('assets_cache', 'dependencies', '
|
9
|
+
setup('app_root', 'assets_cache', 'dependencies', 'defaults', 'localization', 'load_paths',
|
10
|
+
'loggers')
|
10
11
|
end
|
11
12
|
|
12
13
|
module ClassMethods
|
@@ -14,11 +15,10 @@ module EacRailsBase0App
|
|
14
15
|
::File.join(::Dir.tmpdir, ::Rails.root.to_path.parameterize, 'tmp')
|
15
16
|
end
|
16
17
|
|
17
|
-
def
|
18
|
-
return
|
19
|
-
raise 'config.ru not found in ascendent path' if dir == '/'
|
18
|
+
def setup_app_root
|
19
|
+
return unless defined?(APP_PATH)
|
20
20
|
|
21
|
-
|
21
|
+
config.root = find_root(APP_PATH)
|
22
22
|
end
|
23
23
|
|
24
24
|
def setup_assets_cache
|
@@ -31,6 +31,10 @@ module EacRailsBase0App
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
+
def setup_defaults
|
35
|
+
config.load_defaults 5.1
|
36
|
+
end
|
37
|
+
|
34
38
|
def setup_dependencies
|
35
39
|
require 'carrierwave'
|
36
40
|
end
|
@@ -46,68 +46,16 @@ module EacRailsBase0
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
def setup_admin_example
|
50
|
-
|
51
|
-
let(:user) { ::FactoryBot.create(:admin_user) }
|
52
|
-
|
53
|
-
before do
|
54
|
-
visit '/users/sign_in'
|
55
|
-
fill_in ::I18n.translate!('activerecord.attributes.eac_users_support/user.email'),
|
56
|
-
with: user.email
|
57
|
-
fill_in ::I18n.translate!('activerecord.attributes.eac_users_support/user.password'),
|
58
|
-
with: user.password
|
59
|
-
click_button ::I18n.translate!('devise.log_in')
|
60
|
-
end
|
61
|
-
|
62
|
-
it 'user should be logged' do
|
63
|
-
expect(page).to have_content user.email
|
64
|
-
expect(::EacUsersSupport::User.current_user).not_to be_nil
|
65
|
-
end
|
66
|
-
end
|
49
|
+
def setup_admin_example
|
50
|
+
require 'eac_rails_base0/rspec/shared_contexts/when_user_is_admin'
|
67
51
|
end
|
68
52
|
|
69
|
-
def setup_non_admin_example
|
70
|
-
|
71
|
-
let(:user) { ::FactoryBot.create(:non_admin_user) }
|
72
|
-
|
73
|
-
before do
|
74
|
-
visit '/users/sign_in'
|
75
|
-
fill_in ::I18n.translate!('activerecord.attributes.eac_users_support/user.email'),
|
76
|
-
with: user.email
|
77
|
-
fill_in ::I18n.translate!('activerecord.attributes.eac_users_support/user.password'),
|
78
|
-
with: user.password
|
79
|
-
click_button ::I18n.translate!('devise.log_in')
|
80
|
-
end
|
81
|
-
|
82
|
-
it 'user should be logged' do
|
83
|
-
expect(page).to have_content user.email
|
84
|
-
expect(::EacUsersSupport::User.current_user).not_to be_nil
|
85
|
-
end
|
86
|
-
end
|
53
|
+
def setup_non_admin_example
|
54
|
+
require 'eac_rails_base0/rspec/shared_contexts/when_user_is_non_admin'
|
87
55
|
end
|
88
56
|
|
89
|
-
def setup_anonymous_example
|
90
|
-
|
91
|
-
before do
|
92
|
-
visit '/'
|
93
|
-
if link_exist?(::I18n.translate!('devise.log_out'))
|
94
|
-
click_link(::I18n.translate!('devise.log_out'))
|
95
|
-
elsif !link_exist?(::I18n.translate!('devise.log_in'))
|
96
|
-
raise 'login nor logout link found'
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
it 'user should be not logged' do
|
101
|
-
expect(::EacUsersSupport::User.current_user).to be_nil
|
102
|
-
end
|
103
|
-
|
104
|
-
def link_exist?(locator) # rubocop:disable Lint/NestedMethodDefinition
|
105
|
-
find_link(locator)
|
106
|
-
true
|
107
|
-
rescue Capybara::ElementNotFound
|
108
|
-
false
|
109
|
-
end
|
110
|
-
end
|
57
|
+
def setup_anonymous_example
|
58
|
+
require 'eac_rails_base0/rspec/shared_contexts/when_user_is_anonymous'
|
111
59
|
end
|
112
60
|
end
|
113
61
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
::RSpec.shared_context 'when user is admin', shared_context: :metadata do
|
4
|
+
let(:user) { ::FactoryBot.create(:admin_user) }
|
5
|
+
|
6
|
+
before do
|
7
|
+
visit '/users/sign_in'
|
8
|
+
fill_in ::I18n.translate!('activerecord.attributes.eac_users_support/user.email'),
|
9
|
+
with: user.email
|
10
|
+
fill_in ::I18n.translate!('activerecord.attributes.eac_users_support/user.password'),
|
11
|
+
with: user.password
|
12
|
+
click_button ::I18n.translate!('devise.log_in')
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'user should be logged' do
|
16
|
+
expect(page).to have_content user.email
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should be a link to logout' do
|
20
|
+
expect(page).to have_link(nil, href: '/users/sign_out')
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
::RSpec.shared_context 'when user is anonymous', shared_context: :metadata do
|
4
|
+
before do
|
5
|
+
visit '/'
|
6
|
+
if link_exist?(::I18n.translate!('devise.log_out'))
|
7
|
+
click_link(::I18n.translate!('devise.log_out'))
|
8
|
+
elsif !link_exist?(::I18n.translate!('devise.log_in'))
|
9
|
+
raise 'login nor logout link found'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should be a link to log in' do
|
14
|
+
expect(page).to have_link(nil, href: '/users/sign_in')
|
15
|
+
end
|
16
|
+
|
17
|
+
def link_exist?(locator)
|
18
|
+
find_link(locator)
|
19
|
+
true
|
20
|
+
rescue Capybara::ElementNotFound
|
21
|
+
false
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
::RSpec.shared_context 'when user is non admin', shared_context: :metadata do
|
4
|
+
let(:user) { ::FactoryBot.create(:non_admin_user) }
|
5
|
+
|
6
|
+
before do
|
7
|
+
visit '/users/sign_in'
|
8
|
+
fill_in ::I18n.translate!('activerecord.attributes.eac_users_support/user.email'),
|
9
|
+
with: user.email
|
10
|
+
fill_in ::I18n.translate!('activerecord.attributes.eac_users_support/user.password'),
|
11
|
+
with: user.password
|
12
|
+
click_button ::I18n.translate!('devise.log_in')
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'user should be logged' do
|
16
|
+
expect(page).to have_content user.email
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should be a link to logout' do
|
20
|
+
expect(page).to have_link(nil, href: '/users/sign_out')
|
21
|
+
end
|
22
|
+
end
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eac_rails_base0
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.55.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Esquilo Azul Company
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: active_scaffold
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 3.5.5
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 3.5.5
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: aranha-parsers
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,14 +30,20 @@ dependencies:
|
|
44
30
|
requirements:
|
45
31
|
- - "~>"
|
46
32
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0.
|
33
|
+
version: '0.7'
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 0.7.1
|
48
37
|
type: :runtime
|
49
38
|
prerelease: false
|
50
39
|
version_requirements: !ruby/object:Gem::Requirement
|
51
40
|
requirements:
|
52
41
|
- - "~>"
|
53
42
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0.
|
43
|
+
version: '0.7'
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 0.7.1
|
55
47
|
- !ruby/object:Gem::Dependency
|
56
48
|
name: bootstrap-sass
|
57
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -134,6 +126,20 @@ dependencies:
|
|
134
126
|
- - ">="
|
135
127
|
- !ruby/object:Gem::Version
|
136
128
|
version: 4.2.2
|
129
|
+
- !ruby/object:Gem::Dependency
|
130
|
+
name: eac_active_scaffold
|
131
|
+
requirement: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - "~>"
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0.2'
|
136
|
+
type: :runtime
|
137
|
+
prerelease: false
|
138
|
+
version_requirements: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - "~>"
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0.2'
|
137
143
|
- !ruby/object:Gem::Dependency
|
138
144
|
name: eac_cli
|
139
145
|
requirement: !ruby/object:Gem::Requirement
|
@@ -211,7 +217,7 @@ dependencies:
|
|
211
217
|
version: '0.9'
|
212
218
|
- - ">="
|
213
219
|
- !ruby/object:Gem::Version
|
214
|
-
version: 0.9.
|
220
|
+
version: 0.9.6
|
215
221
|
type: :runtime
|
216
222
|
prerelease: false
|
217
223
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -221,7 +227,7 @@ dependencies:
|
|
221
227
|
version: '0.9'
|
222
228
|
- - ">="
|
223
229
|
- !ruby/object:Gem::Version
|
224
|
-
version: 0.9.
|
230
|
+
version: 0.9.6
|
225
231
|
- !ruby/object:Gem::Dependency
|
226
232
|
name: fog-aws
|
227
233
|
requirement: !ruby/object:Gem::Requirement
|
@@ -358,16 +364,16 @@ dependencies:
|
|
358
364
|
name: rails-i18n
|
359
365
|
requirement: !ruby/object:Gem::Requirement
|
360
366
|
requirements:
|
361
|
-
- - "
|
367
|
+
- - ">="
|
362
368
|
- !ruby/object:Gem::Version
|
363
|
-
version: '
|
369
|
+
version: '0'
|
364
370
|
type: :runtime
|
365
371
|
prerelease: false
|
366
372
|
version_requirements: !ruby/object:Gem::Requirement
|
367
373
|
requirements:
|
368
|
-
- - "
|
374
|
+
- - ">="
|
369
375
|
- !ruby/object:Gem::Version
|
370
|
-
version: '
|
376
|
+
version: '0'
|
371
377
|
- !ruby/object:Gem::Dependency
|
372
378
|
name: recordselect
|
373
379
|
requirement: !ruby/object:Gem::Requirement
|
@@ -500,20 +506,14 @@ dependencies:
|
|
500
506
|
requirements:
|
501
507
|
- - "~>"
|
502
508
|
- !ruby/object:Gem::Version
|
503
|
-
version: '0.
|
504
|
-
- - ">="
|
505
|
-
- !ruby/object:Gem::Version
|
506
|
-
version: 0.1.1
|
509
|
+
version: '0.3'
|
507
510
|
type: :development
|
508
511
|
prerelease: false
|
509
512
|
version_requirements: !ruby/object:Gem::Requirement
|
510
513
|
requirements:
|
511
514
|
- - "~>"
|
512
515
|
- !ruby/object:Gem::Version
|
513
|
-
version: '0.
|
514
|
-
- - ">="
|
515
|
-
- !ruby/object:Gem::Version
|
516
|
-
version: 0.1.1
|
516
|
+
version: '0.3'
|
517
517
|
description:
|
518
518
|
email:
|
519
519
|
executables:
|
@@ -565,6 +565,7 @@ files:
|
|
565
565
|
- config/initializers/backtrace_silencers.rb
|
566
566
|
- config/initializers/carrier_wave.rb
|
567
567
|
- config/initializers/cookies_serializer.rb
|
568
|
+
- config/initializers/devise.rb
|
568
569
|
- config/initializers/filter_parameter_logging.rb
|
569
570
|
- config/initializers/mime_types.rb
|
570
571
|
- config/initializers/patches.rb
|
@@ -614,6 +615,9 @@ files:
|
|
614
615
|
- lib/eac_rails_base0/patches/url_for_patch.rb
|
615
616
|
- lib/eac_rails_base0/rspec.rb
|
616
617
|
- lib/eac_rails_base0/rspec/setup.rb
|
618
|
+
- lib/eac_rails_base0/rspec/shared_contexts/when_user_is_admin.rb
|
619
|
+
- lib/eac_rails_base0/rspec/shared_contexts/when_user_is_anonymous.rb
|
620
|
+
- lib/eac_rails_base0/rspec/shared_contexts/when_user_is_non_admin.rb
|
617
621
|
- lib/eac_rails_base0/version.rb
|
618
622
|
- lib/eac_rails_base0/x_engine.rb
|
619
623
|
- lib/fog.rb
|