eac_rails_base0 0.52.3 → 0.55.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/eac_rails_base0/main_menu_helper.rb +2 -0
- data/app/helpers/eac_rails_base0/user_menu_helper.rb +2 -2
- data/config/initializers/action_mailer.rb +1 -1
- 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/ability_mapping.rb +7 -2
- data/lib/eac_rails_base0/app_base/application/all.rb +9 -5
- data/lib/eac_rails_base0/rspec/setup.rb +114 -0
- data/lib/eac_rails_base0/rspec.rb +9 -0
- data/lib/eac_rails_base0/version.rb +1 -1
- data/lib/eac_rails_base0.rb +0 -1
- metadata +33 -100
- data/lib/eac_rails_base0/boolean_value.rb +0 -16
- data/lib/eac_rails_base0/spec_helper/capybara.rb +0 -7
- data/lib/eac_rails_base0/spec_helper/eac_users_support.rb +0 -84
- data/lib/eac_rails_base0/spec_helper/factory_bot.rb +0 -17
- data/lib/eac_rails_base0/spec_helper.rb +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad9290b446a74d62472aaf6d448743c9de7c1743f3157c1a9a7e2319fdd46aab
|
4
|
+
data.tar.gz: 00a14db5781301dcfc9f3f3eada9b9039bbc46f85692f0b8900869fd60bdaae2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bafd77b3e09259c80e1bdc7a9c96a6abe733aff1213b51542355bd5ef90afb1a6843863b186b47931b19fa9e3cbe3ea794825f3f853623140982f780b2dcfb6f
|
7
|
+
data.tar.gz: af1b3da3b781ec17b939494ba1215e4f2aaad0f869d826373e0b71d33cbb5b8d2a9d103e47b558be51185f3851e3e3d2140a90733e77d6aa5f3fc0cd9f0b7425
|
@@ -50,6 +50,8 @@ module EacRailsBase0
|
|
50
50
|
def aranha_main_menu_admin_entries
|
51
51
|
{
|
52
52
|
::Aranha::Address.model_name.human(count: 2) => [aranha.addresses_path],
|
53
|
+
::Aranha::ProcessorConfiguration.model_name.human(count: 2) =>
|
54
|
+
[aranha.processor_configurations_path],
|
53
55
|
::Aranha::StartPoint.model_name.human(count: 2) => [aranha.start_points_path]
|
54
56
|
}
|
55
57
|
end
|
@@ -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
|
@@ -10,7 +10,7 @@ unless ::Rails.env.test?
|
|
10
10
|
password: ENV['action_mailer_smtp_password'],
|
11
11
|
authentication: ENV['action_mailer_smtp_authentication'],
|
12
12
|
enable_starttls_auto:
|
13
|
-
::
|
13
|
+
::EacRubyUtils::Boolean.parse(ENV['action_mailer_smtp_enable_starttls_auto'])
|
14
14
|
}
|
15
15
|
%i[host port].each do |option|
|
16
16
|
value = ENV["action_mailer_default_url_#{option}"]
|
data/config/locales/en.yml
CHANGED
@@ -58,6 +58,7 @@ module EacRailsBase0
|
|
58
58
|
|
59
59
|
can :manage, ::EacUsersSupport::User
|
60
60
|
can :manage, ::Aranha::Address
|
61
|
+
can :manage, ::Aranha::ProcessorConfiguration
|
61
62
|
can :manage, ::Aranha::StartPoint
|
62
63
|
can :manage, ::BrRailties::FederalUnit
|
63
64
|
can :manage, ::BrRailties::Municipality
|
@@ -12,8 +12,7 @@ module EacRailsBase0
|
|
12
12
|
map_devise
|
13
13
|
map_devise_invitable
|
14
14
|
map_controller 'EacUsersSupport::Admin::Users', :manage, ::EacUsersSupport::User
|
15
|
-
|
16
|
-
map_controller 'Aranha::StartPoints', :manage, ::Aranha::StartPoint
|
15
|
+
map_aranha
|
17
16
|
map_controller 'BrRailties::FederalUnits', :manage, ::BrRailties::FederalUnit
|
18
17
|
map_controller 'BrRailties::Municipalities', :manage, ::BrRailties::Municipality
|
19
18
|
map_controller 'ScheduledTasks', :manage, ::ScheduledTask
|
@@ -24,6 +23,12 @@ module EacRailsBase0
|
|
24
23
|
def map_eac_rails_base0
|
25
24
|
map_controller 'EacRailsBase0::Mailer', :manage, :eac_rails_base0_mailer
|
26
25
|
end
|
26
|
+
|
27
|
+
def map_aranha
|
28
|
+
map_controller 'Aranha::Addresses', :manage, ::Aranha::Address
|
29
|
+
map_controller 'Aranha::ProcessorConfigurations', :manage, ::Aranha::ProcessorConfiguration
|
30
|
+
map_controller 'Aranha::StartPoints', :manage, ::Aranha::StartPoint
|
31
|
+
end
|
27
32
|
end
|
28
33
|
end
|
29
34
|
end
|
@@ -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
|
@@ -0,0 +1,114 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'factory_bot'
|
5
|
+
|
6
|
+
module EacRailsBase0
|
7
|
+
module Rspec
|
8
|
+
module Setup
|
9
|
+
def self.extended(obj)
|
10
|
+
return unless obj.rails_app_path
|
11
|
+
|
12
|
+
%w[engines admin_user non_admin_user admin_example non_admin_example
|
13
|
+
anonymous_example].each do |m|
|
14
|
+
obj.send("setup_#{m}")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def setup_engines
|
21
|
+
::FactoryBot.definition_file_paths += ::EacRailsBase0::XEngine.local.flat_map do |engine|
|
22
|
+
%w[factories test/factories spec/factories].map do |subpath|
|
23
|
+
engine.config.root.join(subpath).to_path
|
24
|
+
end
|
25
|
+
end
|
26
|
+
::FactoryBot.find_definitions
|
27
|
+
end
|
28
|
+
|
29
|
+
def setup_admin_user
|
30
|
+
::FactoryBot.define do
|
31
|
+
factory :admin_user, class: ::EacUsersSupport::User do
|
32
|
+
email { 'admin@example.com' }
|
33
|
+
password { 'mysecret' }
|
34
|
+
confirmed_at { ::Time.zone.now }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def setup_non_admin_user
|
40
|
+
::FactoryBot.define do
|
41
|
+
factory :non_admin_user, class: ::EacUsersSupport::User do
|
42
|
+
email { 'nonadmin@example.com' }
|
43
|
+
password { 'mysecret' }
|
44
|
+
confirmed_at { ::Time.zone.now }
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def setup_admin_example # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
50
|
+
::RSpec.shared_context 'when user is admin', shared_context: :metadata do
|
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
|
67
|
+
end
|
68
|
+
|
69
|
+
def setup_non_admin_example # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
70
|
+
::RSpec.shared_context 'when user is non admin', shared_context: :metadata do
|
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
|
87
|
+
end
|
88
|
+
|
89
|
+
def setup_anonymous_example # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
90
|
+
::RSpec.shared_context 'when user is anonymous', shared_context: :metadata do
|
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
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
data/lib/eac_rails_base0.rb
CHANGED
@@ -20,6 +20,5 @@ end
|
|
20
20
|
require_dependency 'eac_rails_base0/gems'
|
21
21
|
require_dependency 'eac_rails_base0/app_base/ability_mapping'
|
22
22
|
require_dependency 'eac_rails_base0/app_base/ability'
|
23
|
-
require_dependency 'eac_rails_base0/boolean_value'
|
24
23
|
require_dependency 'eac_rails_base0/patches/url_for_patch'
|
25
24
|
require_dependency 'eac_rails_base0/x_engine'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.1
|
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-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_scaffold
|
@@ -44,14 +44,20 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0.
|
47
|
+
version: '0.7'
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 0.7.1
|
48
51
|
type: :runtime
|
49
52
|
prerelease: false
|
50
53
|
version_requirements: !ruby/object:Gem::Requirement
|
51
54
|
requirements:
|
52
55
|
- - "~>"
|
53
56
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0.
|
57
|
+
version: '0.7'
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 0.7.1
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
62
|
name: bootstrap-sass
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,20 +92,6 @@ dependencies:
|
|
86
92
|
- - ">="
|
87
93
|
- !ruby/object:Gem::Version
|
88
94
|
version: 0.4.1
|
89
|
-
- !ruby/object:Gem::Dependency
|
90
|
-
name: byebug
|
91
|
-
requirement: !ruby/object:Gem::Requirement
|
92
|
-
requirements:
|
93
|
-
- - ">="
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
version: '0'
|
96
|
-
type: :runtime
|
97
|
-
prerelease: false
|
98
|
-
version_requirements: !ruby/object:Gem::Requirement
|
99
|
-
requirements:
|
100
|
-
- - ">="
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: '0'
|
103
95
|
- !ruby/object:Gem::Dependency
|
104
96
|
name: can_can_dry
|
105
97
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,20 +106,6 @@ dependencies:
|
|
114
106
|
- - "~>"
|
115
107
|
- !ruby/object:Gem::Version
|
116
108
|
version: '0.5'
|
117
|
-
- !ruby/object:Gem::Dependency
|
118
|
-
name: capybara
|
119
|
-
requirement: !ruby/object:Gem::Requirement
|
120
|
-
requirements:
|
121
|
-
- - ">="
|
122
|
-
- !ruby/object:Gem::Version
|
123
|
-
version: '0'
|
124
|
-
type: :runtime
|
125
|
-
prerelease: false
|
126
|
-
version_requirements: !ruby/object:Gem::Requirement
|
127
|
-
requirements:
|
128
|
-
- - ">="
|
129
|
-
- !ruby/object:Gem::Version
|
130
|
-
version: '0'
|
131
109
|
- !ruby/object:Gem::Dependency
|
132
110
|
name: carrierwave
|
133
111
|
requirement: !ruby/object:Gem::Requirement
|
@@ -196,20 +174,6 @@ dependencies:
|
|
196
174
|
- - "~>"
|
197
175
|
- !ruby/object:Gem::Version
|
198
176
|
version: '0.10'
|
199
|
-
- !ruby/object:Gem::Dependency
|
200
|
-
name: eac_ruby_gem_support
|
201
|
-
requirement: !ruby/object:Gem::Requirement
|
202
|
-
requirements:
|
203
|
-
- - "~>"
|
204
|
-
- !ruby/object:Gem::Version
|
205
|
-
version: '0.2'
|
206
|
-
type: :runtime
|
207
|
-
prerelease: false
|
208
|
-
version_requirements: !ruby/object:Gem::Requirement
|
209
|
-
requirements:
|
210
|
-
- - "~>"
|
211
|
-
- !ruby/object:Gem::Version
|
212
|
-
version: '0.2'
|
213
177
|
- !ruby/object:Gem::Dependency
|
214
178
|
name: eac_ruby_gems_utils
|
215
179
|
requirement: !ruby/object:Gem::Requirement
|
@@ -236,48 +200,34 @@ dependencies:
|
|
236
200
|
requirements:
|
237
201
|
- - "~>"
|
238
202
|
- !ruby/object:Gem::Version
|
239
|
-
version: '0.
|
203
|
+
version: '0.74'
|
240
204
|
type: :runtime
|
241
205
|
prerelease: false
|
242
206
|
version_requirements: !ruby/object:Gem::Requirement
|
243
207
|
requirements:
|
244
208
|
- - "~>"
|
245
209
|
- !ruby/object:Gem::Version
|
246
|
-
version: '0.
|
210
|
+
version: '0.74'
|
247
211
|
- !ruby/object:Gem::Dependency
|
248
212
|
name: eac_users_support
|
249
213
|
requirement: !ruby/object:Gem::Requirement
|
250
214
|
requirements:
|
251
215
|
- - "~>"
|
252
216
|
- !ruby/object:Gem::Version
|
253
|
-
version: '0.
|
217
|
+
version: '0.9'
|
254
218
|
- - ">="
|
255
219
|
- !ruby/object:Gem::Version
|
256
|
-
version: 0.
|
220
|
+
version: 0.9.3
|
257
221
|
type: :runtime
|
258
222
|
prerelease: false
|
259
223
|
version_requirements: !ruby/object:Gem::Requirement
|
260
224
|
requirements:
|
261
225
|
- - "~>"
|
262
226
|
- !ruby/object:Gem::Version
|
263
|
-
version: '0.
|
227
|
+
version: '0.9'
|
264
228
|
- - ">="
|
265
229
|
- !ruby/object:Gem::Version
|
266
|
-
version: 0.
|
267
|
-
- !ruby/object:Gem::Dependency
|
268
|
-
name: factory_bot_rails
|
269
|
-
requirement: !ruby/object:Gem::Requirement
|
270
|
-
requirements:
|
271
|
-
- - "~>"
|
272
|
-
- !ruby/object:Gem::Version
|
273
|
-
version: '4.0'
|
274
|
-
type: :runtime
|
275
|
-
prerelease: false
|
276
|
-
version_requirements: !ruby/object:Gem::Requirement
|
277
|
-
requirements:
|
278
|
-
- - "~>"
|
279
|
-
- !ruby/object:Gem::Version
|
280
|
-
version: '4.0'
|
230
|
+
version: 0.9.3
|
281
231
|
- !ruby/object:Gem::Dependency
|
282
232
|
name: fog-aws
|
283
233
|
requirement: !ruby/object:Gem::Requirement
|
@@ -438,20 +388,6 @@ dependencies:
|
|
438
388
|
- - ">="
|
439
389
|
- !ruby/object:Gem::Version
|
440
390
|
version: 3.10.1
|
441
|
-
- !ruby/object:Gem::Dependency
|
442
|
-
name: rspec-rails
|
443
|
-
requirement: !ruby/object:Gem::Requirement
|
444
|
-
requirements:
|
445
|
-
- - "~>"
|
446
|
-
- !ruby/object:Gem::Version
|
447
|
-
version: '3.7'
|
448
|
-
type: :runtime
|
449
|
-
prerelease: false
|
450
|
-
version_requirements: !ruby/object:Gem::Requirement
|
451
|
-
requirements:
|
452
|
-
- - "~>"
|
453
|
-
- !ruby/object:Gem::Version
|
454
|
-
version: '3.7'
|
455
391
|
- !ruby/object:Gem::Dependency
|
456
392
|
name: sass-rails
|
457
393
|
requirement: !ruby/object:Gem::Requirement
|
@@ -536,20 +472,6 @@ dependencies:
|
|
536
472
|
- - ">="
|
537
473
|
- !ruby/object:Gem::Version
|
538
474
|
version: 1.3.0
|
539
|
-
- !ruby/object:Gem::Dependency
|
540
|
-
name: web-console
|
541
|
-
requirement: !ruby/object:Gem::Requirement
|
542
|
-
requirements:
|
543
|
-
- - "~>"
|
544
|
-
- !ruby/object:Gem::Version
|
545
|
-
version: '2.0'
|
546
|
-
type: :runtime
|
547
|
-
prerelease: false
|
548
|
-
version_requirements: !ruby/object:Gem::Requirement
|
549
|
-
requirements:
|
550
|
-
- - "~>"
|
551
|
-
- !ruby/object:Gem::Version
|
552
|
-
version: '2.0'
|
553
475
|
- !ruby/object:Gem::Dependency
|
554
476
|
name: pg
|
555
477
|
requirement: !ruby/object:Gem::Requirement
|
@@ -578,6 +500,20 @@ dependencies:
|
|
578
500
|
- - ">="
|
579
501
|
- !ruby/object:Gem::Version
|
580
502
|
version: '0'
|
503
|
+
- !ruby/object:Gem::Dependency
|
504
|
+
name: eac_rails_gem_support
|
505
|
+
requirement: !ruby/object:Gem::Requirement
|
506
|
+
requirements:
|
507
|
+
- - "~>"
|
508
|
+
- !ruby/object:Gem::Version
|
509
|
+
version: '0.3'
|
510
|
+
type: :development
|
511
|
+
prerelease: false
|
512
|
+
version_requirements: !ruby/object:Gem::Requirement
|
513
|
+
requirements:
|
514
|
+
- - "~>"
|
515
|
+
- !ruby/object:Gem::Version
|
516
|
+
version: '0.3'
|
581
517
|
description:
|
582
518
|
email:
|
583
519
|
executables:
|
@@ -672,15 +608,12 @@ files:
|
|
672
608
|
- lib/eac_rails_base0/app_generator/templates/config/routes.rb
|
673
609
|
- lib/eac_rails_base0/app_generator/templates/gitignore
|
674
610
|
- lib/eac_rails_base0/app_generator/templates/lib/local_plugins.rb
|
675
|
-
- lib/eac_rails_base0/boolean_value.rb
|
676
611
|
- lib/eac_rails_base0/engine.rb
|
677
612
|
- lib/eac_rails_base0/gems.rb
|
678
613
|
- lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
|
679
614
|
- lib/eac_rails_base0/patches/url_for_patch.rb
|
680
|
-
- lib/eac_rails_base0/
|
681
|
-
- lib/eac_rails_base0/
|
682
|
-
- lib/eac_rails_base0/spec_helper/eac_users_support.rb
|
683
|
-
- lib/eac_rails_base0/spec_helper/factory_bot.rb
|
615
|
+
- lib/eac_rails_base0/rspec.rb
|
616
|
+
- lib/eac_rails_base0/rspec/setup.rb
|
684
617
|
- lib/eac_rails_base0/version.rb
|
685
618
|
- lib/eac_rails_base0/x_engine.rb
|
686
619
|
- lib/fog.rb
|
@@ -717,7 +650,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
717
650
|
- !ruby/object:Gem::Version
|
718
651
|
version: '0'
|
719
652
|
requirements: []
|
720
|
-
rubygems_version: 3.
|
653
|
+
rubygems_version: 3.1.6
|
721
654
|
signing_key:
|
722
655
|
specification_version: 4
|
723
656
|
summary: A Rails base for multiple Rails projects developed by Esquilo Azul Company.
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module EacRailsBase0
|
4
|
-
class BooleanValue
|
5
|
-
def self.to_b(object)
|
6
|
-
return false if object.blank?
|
7
|
-
|
8
|
-
if object.is_a?(String)
|
9
|
-
object = object.strip
|
10
|
-
object.present? && object != '0' && object != 'false'
|
11
|
-
else
|
12
|
-
object ? true : false
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,84 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'devise'
|
4
|
-
require_relative 'factory_bot'
|
5
|
-
|
6
|
-
RSpec.configure do |config|
|
7
|
-
config.include Warden::Test::Helpers
|
8
|
-
|
9
|
-
config.after(:each) do
|
10
|
-
Warden.test_reset!
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
FactoryBot.define do
|
15
|
-
factory :admin_user, class: ::EacUsersSupport::User do
|
16
|
-
email { 'admin@example.com' }
|
17
|
-
password { 'mysecret' }
|
18
|
-
confirmed_at { ::Time.zone.now }
|
19
|
-
end
|
20
|
-
|
21
|
-
factory :non_admin_user, class: ::EacUsersSupport::User do
|
22
|
-
email { 'nonadmin@example.com' }
|
23
|
-
password { 'mysecret' }
|
24
|
-
confirmed_at { ::Time.zone.now }
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
RSpec.shared_context 'when user is admin', shared_context: :metadata do
|
29
|
-
let(:user) { ::FactoryBot.create(:admin_user) }
|
30
|
-
|
31
|
-
before do
|
32
|
-
visit '/users/sign_in'
|
33
|
-
fill_in ::I18n.translate!('activerecord.attributes.eac_users_support/user.email'),
|
34
|
-
with: user.email
|
35
|
-
fill_in ::I18n.translate!('activerecord.attributes.eac_users_support/user.password'),
|
36
|
-
with: user.password
|
37
|
-
click_button ::I18n.translate!('devise.log_in')
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'user should be logged' do
|
41
|
-
expect(page).to have_content user.email
|
42
|
-
expect(::EacUsersSupport::User.current_user).not_to be_nil
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
RSpec.shared_context 'when user is non admin', shared_context: :metadata do
|
47
|
-
let(:user) { ::FactoryBot.create(:non_admin_user) }
|
48
|
-
|
49
|
-
before do
|
50
|
-
visit '/users/sign_in'
|
51
|
-
fill_in ::I18n.translate!('activerecord.attributes.eac_users_support/user.email'),
|
52
|
-
with: user.email
|
53
|
-
fill_in ::I18n.translate!('activerecord.attributes.eac_users_support/user.password'),
|
54
|
-
with: user.password
|
55
|
-
click_button ::I18n.translate!('devise.log_in')
|
56
|
-
end
|
57
|
-
|
58
|
-
it 'user should be logged' do
|
59
|
-
expect(page).to have_content user.email
|
60
|
-
expect(::EacUsersSupport::User.current_user).not_to be_nil
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
RSpec.shared_context 'when user is anonymous', shared_context: :metadata do
|
65
|
-
before do
|
66
|
-
visit '/'
|
67
|
-
if link_exist?(::I18n.translate!('devise.log_out'))
|
68
|
-
click_link(::I18n.translate!('devise.log_out'))
|
69
|
-
elsif !link_exist?(::I18n.translate!('devise.log_in'))
|
70
|
-
raise 'login nor logout link found'
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
it 'user should be not logged' do
|
75
|
-
expect(::EacUsersSupport::User.current_user).to be_nil
|
76
|
-
end
|
77
|
-
|
78
|
-
def link_exist?(locator)
|
79
|
-
find_link(locator)
|
80
|
-
true
|
81
|
-
rescue Capybara::ElementNotFound
|
82
|
-
false
|
83
|
-
end
|
84
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'factory_bot_rails'
|
4
|
-
|
5
|
-
RSpec.configure do |config|
|
6
|
-
config.include FactoryBot::Syntax::Methods
|
7
|
-
end
|
8
|
-
|
9
|
-
::FactoryBot.definition_file_paths += ::EacRailsBase0::XEngine.local.flat_map do |engine|
|
10
|
-
%w[factories test/factories spec/factories].map do |subpath|
|
11
|
-
engine.config.root.join(subpath).to_path
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
::FactoryBot.find_definitions
|
16
|
-
|
17
|
-
Spring.after_fork { FactoryBot.reload } if defined?(Spring)
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
begin
|
4
|
-
ActiveRecord::Migration.maintain_test_schema!
|
5
|
-
rescue ActiveRecord::PendingMigrationError => e
|
6
|
-
::Rails.logger.fatal(e)
|
7
|
-
::Kernel.exit 1 # rubocop:disable Rails/Exit
|
8
|
-
end
|
9
|
-
|
10
|
-
RSpec.configure do |config|
|
11
|
-
config.expect_with :rspec do |expectations|
|
12
|
-
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
13
|
-
end
|
14
|
-
|
15
|
-
config.mock_with :rspec do |mocks|
|
16
|
-
mocks.verify_partial_doubles = true
|
17
|
-
end
|
18
|
-
|
19
|
-
config.shared_context_metadata_behavior = :apply_to_host_groups
|
20
|
-
config.example_status_persistence_file_path = ::Rails.root.join('tmp', 'cache', 'rspec.txt')
|
21
|
-
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
22
|
-
config.use_transactional_fixtures = true
|
23
|
-
config.infer_spec_type_from_file_location!
|
24
|
-
config.filter_rails_from_backtrace!
|
25
|
-
|
26
|
-
require 'eac_ruby_gem_support/rspec'
|
27
|
-
::EacRubyGemSupport::Rspec.setup(::File.expand_path('..', __dir__), config)
|
28
|
-
end
|
29
|
-
|
30
|
-
require 'eac_ruby_utils/require_sub'
|
31
|
-
::EacRubyUtils.require_sub __FILE__
|
32
|
-
require 'aranha/parsers/spec/source_target_fixtures_example'
|