eac_rails_base0 0.52.3 → 0.53.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dc8643c467630eafd3aa09d1bcff9a5200d92bb0f56cba81945cc0ffb53dcfae
4
- data.tar.gz: cea03ab4cf7560dc3406a0a41d38cf2b74f3418cf8e6778d8c81d54bfdfab36a
3
+ metadata.gz: 309880b1cad226e7d5eca8cf4070121ff05c59c0897779636bfed488672dc616
4
+ data.tar.gz: 50b55d0c59aaad55355782e4971d50b9be793aaf3dfe3e7b159eb017759919ce
5
5
  SHA512:
6
- metadata.gz: 333160a6b83bc3b7c1c11895de2aa92812149ff4ab99c26c3285725b6690e515890a1a107e4f5ce4047a5e001717260ca44544852d55342ca2164736c640d0a9
7
- data.tar.gz: 60038878e6a47834ce7b2beac7682492034d3791acc7a1e026e303ba7aa2df962b1bc9b2d34c216b59cce46852bc003bfc9dfa64d647c3c39d56973cdeabde95
6
+ metadata.gz: 7270a394cddcb88fcb2a38f8c23cf29d3bd569ad89333828da5e278c46505460543a288be4d6bcb4d9e7f46af2d20b9a17fbf3e7dd1d201f04f5d6d4748cc5a1
7
+ data.tar.gz: 3132f0e276d26d14aaaa5615461e8682231b40587d1c2cb95b1fe16e7c1706de20c3ac16e8389541211e84e89f61b355e9c49aa199b6ea8ce39617fa5c42d7fb
@@ -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
- ::EacRailsBase0::BooleanValue.to_b(ENV['action_mailer_smtp_enable_starttls_auto'])
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}"]
@@ -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'
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EacRailsBase0
6
+ module Rspec
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -0,0 +1,116 @@
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
+ class Setup
9
+ common_constructor :setup_obj
10
+
11
+ def perform
12
+ return unless defined?(::Rails)
13
+
14
+ %w[engines admin_user non_admin_user admin_example non_admin_example
15
+ anonymous_example].each do |m|
16
+ send("setup_#{m}")
17
+ end
18
+ end
19
+
20
+ private
21
+
22
+ def setup_engines
23
+ ::FactoryBot.definition_file_paths += ::EacRailsBase0::XEngine.local.flat_map do |engine|
24
+ %w[factories test/factories spec/factories].map do |subpath|
25
+ engine.config.root.join(subpath).to_path
26
+ end
27
+ end
28
+ ::FactoryBot.find_definitions
29
+ end
30
+
31
+ def setup_admin_user
32
+ ::FactoryBot.define do
33
+ factory :admin_user, class: ::EacUsersSupport::User do
34
+ email { 'admin@example.com' }
35
+ password { 'mysecret' }
36
+ confirmed_at { ::Time.zone.now }
37
+ end
38
+ end
39
+ end
40
+
41
+ def setup_non_admin_user
42
+ ::FactoryBot.define do
43
+ factory :non_admin_user, class: ::EacUsersSupport::User do
44
+ email { 'nonadmin@example.com' }
45
+ password { 'mysecret' }
46
+ confirmed_at { ::Time.zone.now }
47
+ end
48
+ end
49
+ end
50
+
51
+ def setup_admin_example # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
52
+ ::RSpec.shared_context 'when user is admin', shared_context: :metadata do
53
+ let(:user) { ::FactoryBot.create(:admin_user) }
54
+
55
+ before do
56
+ visit '/users/sign_in'
57
+ fill_in ::I18n.translate!('activerecord.attributes.eac_users_support/user.email'),
58
+ with: user.email
59
+ fill_in ::I18n.translate!('activerecord.attributes.eac_users_support/user.password'),
60
+ with: user.password
61
+ click_button ::I18n.translate!('devise.log_in')
62
+ end
63
+
64
+ it 'user should be logged' do
65
+ expect(page).to have_content user.email
66
+ expect(::EacUsersSupport::User.current_user).not_to be_nil
67
+ end
68
+ end
69
+ end
70
+
71
+ def setup_non_admin_example # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
72
+ ::RSpec.shared_context 'when user is non admin', shared_context: :metadata do
73
+ let(:user) { ::FactoryBot.create(:non_admin_user) }
74
+
75
+ before do
76
+ visit '/users/sign_in'
77
+ fill_in ::I18n.translate!('activerecord.attributes.eac_users_support/user.email'),
78
+ with: user.email
79
+ fill_in ::I18n.translate!('activerecord.attributes.eac_users_support/user.password'),
80
+ with: user.password
81
+ click_button ::I18n.translate!('devise.log_in')
82
+ end
83
+
84
+ it 'user should be logged' do
85
+ expect(page).to have_content user.email
86
+ expect(::EacUsersSupport::User.current_user).not_to be_nil
87
+ end
88
+ end
89
+ end
90
+
91
+ def setup_anonymous_example # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
92
+ ::RSpec.shared_context 'when user is anonymous', shared_context: :metadata do
93
+ before do
94
+ visit '/'
95
+ if link_exist?(::I18n.translate!('devise.log_out'))
96
+ click_link(::I18n.translate!('devise.log_out'))
97
+ elsif !link_exist?(::I18n.translate!('devise.log_in'))
98
+ raise 'login nor logout link found'
99
+ end
100
+ end
101
+
102
+ it 'user should be not logged' do
103
+ expect(::EacUsersSupport::User.current_user).to be_nil
104
+ end
105
+
106
+ def link_exist?(locator) # rubocop:disable Lint/NestedMethodDefinition
107
+ find_link(locator)
108
+ true
109
+ rescue Capybara::ElementNotFound
110
+ false
111
+ end
112
+ end
113
+ end
114
+ end
115
+ end
116
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRailsBase0
4
- VERSION = '0.52.3'
4
+ VERSION = '0.53.0'
5
5
  end
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.52.3
4
+ version: 0.53.0
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-06-28 00:00:00.000000000 Z
11
+ date: 2021-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_scaffold
@@ -86,20 +86,6 @@ dependencies:
86
86
  - - ">="
87
87
  - !ruby/object:Gem::Version
88
88
  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
89
  - !ruby/object:Gem::Dependency
104
90
  name: can_can_dry
105
91
  requirement: !ruby/object:Gem::Requirement
@@ -114,20 +100,6 @@ dependencies:
114
100
  - - "~>"
115
101
  - !ruby/object:Gem::Version
116
102
  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
103
  - !ruby/object:Gem::Dependency
132
104
  name: carrierwave
133
105
  requirement: !ruby/object:Gem::Requirement
@@ -196,20 +168,6 @@ dependencies:
196
168
  - - "~>"
197
169
  - !ruby/object:Gem::Version
198
170
  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
171
  - !ruby/object:Gem::Dependency
214
172
  name: eac_ruby_gems_utils
215
173
  requirement: !ruby/object:Gem::Requirement
@@ -236,14 +194,14 @@ dependencies:
236
194
  requirements:
237
195
  - - "~>"
238
196
  - !ruby/object:Gem::Version
239
- version: '0.32'
197
+ version: '0.72'
240
198
  type: :runtime
241
199
  prerelease: false
242
200
  version_requirements: !ruby/object:Gem::Requirement
243
201
  requirements:
244
202
  - - "~>"
245
203
  - !ruby/object:Gem::Version
246
- version: '0.32'
204
+ version: '0.72'
247
205
  - !ruby/object:Gem::Dependency
248
206
  name: eac_users_support
249
207
  requirement: !ruby/object:Gem::Requirement
@@ -264,20 +222,6 @@ dependencies:
264
222
  - - ">="
265
223
  - !ruby/object:Gem::Version
266
224
  version: 0.8.2
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'
281
225
  - !ruby/object:Gem::Dependency
282
226
  name: fog-aws
283
227
  requirement: !ruby/object:Gem::Requirement
@@ -438,20 +382,6 @@ dependencies:
438
382
  - - ">="
439
383
  - !ruby/object:Gem::Version
440
384
  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
385
  - !ruby/object:Gem::Dependency
456
386
  name: sass-rails
457
387
  requirement: !ruby/object:Gem::Requirement
@@ -536,20 +466,6 @@ dependencies:
536
466
  - - ">="
537
467
  - !ruby/object:Gem::Version
538
468
  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
469
  - !ruby/object:Gem::Dependency
554
470
  name: pg
555
471
  requirement: !ruby/object:Gem::Requirement
@@ -578,6 +494,20 @@ dependencies:
578
494
  - - ">="
579
495
  - !ruby/object:Gem::Version
580
496
  version: '0'
497
+ - !ruby/object:Gem::Dependency
498
+ name: eac_rails_gem_support
499
+ requirement: !ruby/object:Gem::Requirement
500
+ requirements:
501
+ - - "~>"
502
+ - !ruby/object:Gem::Version
503
+ version: '0.1'
504
+ type: :development
505
+ prerelease: false
506
+ version_requirements: !ruby/object:Gem::Requirement
507
+ requirements:
508
+ - - "~>"
509
+ - !ruby/object:Gem::Version
510
+ version: '0.1'
581
511
  description:
582
512
  email:
583
513
  executables:
@@ -672,15 +602,12 @@ files:
672
602
  - lib/eac_rails_base0/app_generator/templates/config/routes.rb
673
603
  - lib/eac_rails_base0/app_generator/templates/gitignore
674
604
  - lib/eac_rails_base0/app_generator/templates/lib/local_plugins.rb
675
- - lib/eac_rails_base0/boolean_value.rb
676
605
  - lib/eac_rails_base0/engine.rb
677
606
  - lib/eac_rails_base0/gems.rb
678
607
  - lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
679
608
  - lib/eac_rails_base0/patches/url_for_patch.rb
680
- - lib/eac_rails_base0/spec_helper.rb
681
- - lib/eac_rails_base0/spec_helper/capybara.rb
682
- - lib/eac_rails_base0/spec_helper/eac_users_support.rb
683
- - lib/eac_rails_base0/spec_helper/factory_bot.rb
609
+ - lib/eac_rails_base0/rspec.rb
610
+ - lib/eac_rails_base0/rspec/setup.rb
684
611
  - lib/eac_rails_base0/version.rb
685
612
  - lib/eac_rails_base0/x_engine.rb
686
613
  - lib/fog.rb
@@ -717,7 +644,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
717
644
  - !ruby/object:Gem::Version
718
645
  version: '0'
719
646
  requirements: []
720
- rubygems_version: 3.0.9
647
+ rubygems_version: 3.1.6
721
648
  signing_key:
722
649
  specification_version: 4
723
650
  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,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'
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'capybara/rspec'
4
-
5
- RSpec.configure do |config|
6
- config.include Capybara::DSL, file_path: 'spec/requests'
7
- 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)