eac_rails_base0 0.37.0 → 0.39.1

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: a432acee9af945b984da1ec653f7904a5c5cde7f7898694ff28d79cba1f822c9
4
- data.tar.gz: 69566b474eeb22d328188427864200a2c7402044e809d0388eda856a3c8f2b4b
3
+ metadata.gz: '09afacb952ef742890bedbd4cb74ba068068845e11f1b55027e1daf19f47b678'
4
+ data.tar.gz: 92719c116ec417d888d9b8f63bcc12e07d5bd5b7f641fda3bbd68eef13cf50a7
5
5
  SHA512:
6
- metadata.gz: e6c423c9e11901c72137a2a8b3b9e81ea7b7db8052f66a7a0dd215cf936137ce8f217a058a9557f59864846ecb4a2cf9f3c3a8fec19f99f5609ee2addbc23fa8
7
- data.tar.gz: '0099a466e95273bb5dc658cc14ba537490b7286f364d5290f4c9614b3da26d1b4d2241b3aa2704211dc29a838506d769752a8f3498875e6f8beee45e0db52033'
6
+ metadata.gz: debf1bd86d1d670470f81676ec145015799ff5e56c24c537c7876c4771ff4072070d5199a80ebf198f8345b89b201eef2d715e9666ab898cb1c2549354adace2
7
+ data.tar.gz: 1df7ce2f1b9bee101ef6d4aaff3619a64b0a683ce2105a8af77f28f919d8e5a7e3053b48f39071f18151d9ac42c17e78e87cd9c0ed9af7a90eb33b34f30fbcd4
@@ -5,6 +5,7 @@ module EacRailsBase0
5
5
  include ::CanCanDry::ControllerAuthorization
6
6
 
7
7
  layout 'eac_rails_base0/application'
8
+ helper ::EacRailsBase0::AppVersionHelper
8
9
  helper ::EacRailsBase0::LayoutHelper
9
10
  helper ::EacRailsUtils::FormatterHelper
10
11
  helper ::EacRailsUtils::LinksHelper
@@ -22,6 +23,7 @@ module EacRailsBase0
22
23
  redirect_to main_app.root_url
23
24
  else
24
25
  flash[:danger] = 'Por favor faça o login.'
26
+ store_location_for(::EacUsersSupport::User, request.fullpath)
25
27
  redirect_to eac_users_support.new_user_session_path
26
28
  end
27
29
  end
@@ -33,5 +35,9 @@ module EacRailsBase0
33
35
  super
34
36
  end
35
37
  end
38
+
39
+ def after_sign_in_path_for(resource)
40
+ stored_location_for(resource) || root_path
41
+ end
36
42
  end
37
43
  end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EacRailsBase0
4
+ module AppVersionHelper
5
+ def base0_app_version
6
+ base0_app_version_by_environment_variable ||
7
+ base0_app_version_by_version_file ||
8
+ ::I18n.t('eac_rails_base0.app_version.unsetted')
9
+ end
10
+
11
+ def base0_app_version_by_environment_variable
12
+ ENV['APP_VERSION'].to_s.strip.presence
13
+ end
14
+
15
+ def base0_app_version_by_version_file
16
+ ::Rails.root.children.find { |file| file.basename.to_path.downcase == 'version' }
17
+ .if_present { |file| file.read.presence }
18
+ end
19
+ end
20
+ end
@@ -25,6 +25,8 @@ pt-BR:
25
25
  picker: '%d/%m/%Y %H:%M'
26
26
  short: '%d/%m/%y %H:%M'
27
27
  eac_rails_base0:
28
+ app_version:
29
+ unsetted: Não especificada
28
30
  main_menu:
29
31
  admin:
30
32
  aranha: Aranha
@@ -18,6 +18,7 @@ module EacRailsBase0
18
18
  return unless user.new_record?
19
19
 
20
20
  can :create, 'Devise::Confirmation'
21
+ can :read, 'Devise::Confirmation'
21
22
  end
22
23
 
23
24
  def devise_invitable_rules(user)
@@ -1,20 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # This file was generated by the `rails generate rspec:install` command. Conventionally, all
4
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
5
- # The generated `.rspec` file contains `--require spec_helper` which will cause
6
- # this file to always be loaded, without a need to explicitly require it in any
7
- # files.
8
- #
9
- # Given that it is always loaded, you are encouraged to keep this file as
10
- # light-weight as possible. Requiring heavyweight dependencies from this file
11
- # will add to the boot time of your test suite on EVERY test run, even for an
12
- # individual file that may not need all of that loaded. Instead, consider making
13
- # a separate helper file that requires the additional dependencies and performs
14
- # the additional setup, and require it from the spec files that actually need
15
- # it.
16
- #
17
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
18
3
  begin
19
4
  ActiveRecord::Migration.maintain_test_schema!
20
5
  rescue ActiveRecord::PendingMigrationError => e
@@ -23,114 +8,22 @@ rescue ActiveRecord::PendingMigrationError => e
23
8
  end
24
9
 
25
10
  RSpec.configure do |config|
26
- # rspec-expectations config goes here. You can use an alternate
27
- # assertion/expectation library such as wrong or the stdlib/minitest
28
- # assertions if you prefer.
29
11
  config.expect_with :rspec do |expectations|
30
- # This option will default to `true` in RSpec 4. It makes the `description`
31
- # and `failure_message` of custom matchers include text for helper methods
32
- # defined using `chain`, e.g.:
33
- # be_bigger_than(2).and_smaller_than(4).description
34
- # # => "be bigger than 2 and smaller than 4"
35
- # ...rather than:
36
- # # => "be bigger than 2"
37
12
  expectations.include_chain_clauses_in_custom_matcher_descriptions = true
38
13
  end
39
14
 
40
- # rspec-mocks config goes here. You can use an alternate test double
41
- # library (such as bogus or mocha) by changing the `mock_with` option here.
42
15
  config.mock_with :rspec do |mocks|
43
- # Prevents you from mocking or stubbing a method that does not exist on
44
- # a real object. This is generally recommended, and will default to
45
- # `true` in RSpec 4.
46
16
  mocks.verify_partial_doubles = true
47
17
  end
48
18
 
49
- # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
50
- # have no way to turn it off -- the option exists only for backwards
51
- # compatibility in RSpec 3). It causes shared context metadata to be
52
- # inherited by the metadata hash of host groups and examples, rather than
53
- # triggering implicit auto-inclusion in groups with matching metadata.
54
19
  config.shared_context_metadata_behavior = :apply_to_host_groups
55
-
56
- # The settings below are suggested to provide a good initial experience
57
- # with RSpec, but feel free to customize to your heart's content.
58
- # # This allows you to limit a spec run to individual examples or groups
59
- # # you care about by tagging them with `:focus` metadata. When nothing
60
- # # is tagged with `:focus`, all examples get run. RSpec also provides
61
- # # aliases for `it`, `describe`, and `context` that include `:focus`
62
- # # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
63
- # config.filter_run_when_matching :focus
64
- #
65
- # # Allows RSpec to persist some state between runs in order to support
66
- # # the `--only-failures` and `--next-failure` CLI options. We recommend
67
- # # you configure your source control system to ignore this file.
68
20
  config.example_status_persistence_file_path = ::Rails.root.join('tmp', 'cache', 'rspec.txt')
69
- #
70
- # # Limits the available syntax to the non-monkey patched syntax that is
71
- # # recommended. For more details, see:
72
- # # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
73
- # # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
74
- # # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
75
- # config.disable_monkey_patching!
76
- #
77
- # # Many RSpec users commonly either run the entire suite or an individual
78
- # # file, and it's useful to allow more verbose output when running an
79
- # # individual spec file.
80
- # if config.files_to_run.one?
81
- # # Use the documentation formatter for detailed output,
82
- # # unless a formatter has already been configured
83
- # # (e.g. via a command-line flag).
84
- # config.default_formatter = "doc"
85
- # end
86
- #
87
- # # Print the 10 slowest examples and example groups at the
88
- # # end of the spec run, to help surface which specs are running
89
- # # particularly slow.
90
- # config.profile_examples = 10
91
- #
92
- # # Run specs in random order to surface order dependencies. If you find an
93
- # # order dependency and want to debug it, you can fix the order by providing
94
- # # the seed, which is printed after each run.
95
- # # --seed 1234
96
- # config.order = :random
97
- #
98
- # # Seed global randomization in this process using the `--seed` CLI option.
99
- # # Setting this allows you to use `--seed` to deterministically reproduce
100
- # # test failures related to randomization by passing the same `--seed` value
101
- # # as the one that triggered the failure.
102
- # Kernel.srand config.seed
103
-
104
- # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
105
21
  config.fixture_path = "#{::Rails.root}/spec/fixtures"
106
-
107
- # If you're not using ActiveRecord, or you'd prefer not to run each of your
108
- # examples within a transaction, remove the following line or assign false
109
- # instead of true.
110
22
  config.use_transactional_fixtures = true
111
-
112
- # RSpec Rails can automatically mix in different behaviours to your tests
113
- # based on their file location, for example enabling you to call `get` and
114
- # `post` in specs under `spec/controllers`.
115
- #
116
- # You can disable this behaviour by removing the line below, and instead
117
- # explicitly tag your specs with their type, e.g.:
118
- #
119
- # RSpec.describe UsersController, :type => :controller do
120
- # # ...
121
- # end
122
- #
123
- # The different available types are documented in the features, such as in
124
- # https://relishapp.com/rspec/rspec-rails/docs
125
23
  config.infer_spec_type_from_file_location!
126
-
127
- # Filter lines from Rails gems in backtraces.
128
24
  config.filter_rails_from_backtrace!
129
- # arbitrary gems may also be filtered via:
130
- # config.filter_gems_from_backtrace("gem name")
131
25
  end
132
26
 
133
- require 'eac_rails_base0/spec_helper/capybara'
134
- require 'eac_rails_base0/spec_helper/factory_bot'
135
- require 'eac_rails_base0/spec_helper/eac_users_support'
27
+ require 'eac_ruby_utils/require_sub'
28
+ ::EacRubyUtils.require_sub __FILE__
136
29
  require 'aranha/parsers/spec/source_target_fixtures_example'
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'devise'
4
+ require_relative 'factory_bot'
4
5
 
5
6
  RSpec.configure do |config|
6
7
  config.include Warden::Test::Helpers
@@ -23,9 +24,11 @@ RSpec.shared_context 'when user is admin', shared_context: :metadata do
23
24
 
24
25
  before do
25
26
  visit '/users/sign_in'
26
- fill_in 'E-mail', with: user.email
27
- fill_in 'Password', with: user.password
28
- click_on 'Log in'
27
+ fill_in ::I18n.translate!('activerecord.attributes.eac_users_support/user.email'),
28
+ with: user.email
29
+ fill_in ::I18n.translate!('activerecord.attributes.eac_users_support/user.password'),
30
+ with: user.password
31
+ click_button ::I18n.translate!('devise.log_in')
29
32
  end
30
33
 
31
34
  it 'user should be logged' do
@@ -37,9 +40,9 @@ end
37
40
  RSpec.shared_context 'when user is anonymous', shared_context: :metadata do
38
41
  before do
39
42
  visit '/'
40
- if link_exist?('Sair')
41
- click_link('Sair')
42
- elsif !link_exist?('Entrar')
43
+ if link_exist?(::I18n.translate!('devise.log_out'))
44
+ click_link(::I18n.translate!('devise.log_out'))
45
+ elsif !link_exist?(::I18n.translate!('devise.log_in'))
43
46
  raise 'login nor logout link found'
44
47
  end
45
48
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRailsBase0
4
- VERSION = '0.37.0'
4
+ VERSION = '0.39.1'
5
5
  end
@@ -1 +1 @@
1
- --require lib/spec_rails_helper --color --format doc --default-path . --pattern '**/spec/**/*_spec.rb'
1
+ --require lib/spec_rails_helper --color --format doc --default-path . --pattern 'spec/**/*_spec.rb'
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.37.0
4
+ version: 0.39.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: 2020-06-29 00:00:00.000000000 Z
11
+ date: 2020-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aranha
@@ -515,6 +515,7 @@ files:
515
515
  - app/assets/stylesheets/eac_rails_base0/components.scss
516
516
  - app/assets/stylesheets/eac_rails_base0/default_configuration.scss
517
517
  - app/controllers/eac_rails_base0/application_controller.rb
518
+ - app/helpers/eac_rails_base0/app_version_helper.rb
518
519
  - app/helpers/eac_rails_base0/layout_helper.rb
519
520
  - app/helpers/eac_rails_base0/panel_default_helper.rb
520
521
  - app/uploaders/eac_rails_base0/default_file_uploader.rb
@@ -620,8 +621,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
620
621
  - !ruby/object:Gem::Version
621
622
  version: '0'
622
623
  requirements: []
623
- rubyforge_project:
624
- rubygems_version: 2.7.7
624
+ rubygems_version: 3.0.8
625
625
  signing_key:
626
626
  specification_version: 4
627
627
  summary: A Rails base for multiple Rails projects developed by Esquilo Azul Company.