eac_rails_base0 0.3.1 → 0.4.0
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 +5 -5
- data/lib/eac_rails_base0/spec_helper.rb +134 -0
- data/lib/eac_rails_base0/spec_helper/capybara.rb +6 -0
- data/lib/eac_rails_base0/spec_helper/eac_users_support.rb +33 -0
- data/lib/eac_rails_base0/spec_helper/factory_bot.rb +6 -0
- data/lib/eac_rails_base0/version.rb +1 -1
- data/lib/generators/eac_rails_base0/install/rspec/rspec_generator.rb +14 -0
- data/lib/generators/eac_rails_base0/install/rspec/templates/bin_rspec.rb +5 -0
- data/lib/generators/eac_rails_base0/install/rspec/templates/rspec.rc +1 -0
- data/lib/generators/eac_rails_base0/install/rspec/templates/spec_rails_helper.rb +6 -0
- metadata +53 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 7f76d15e3ad1188b9c239073102eac9f26a173bd
|
|
4
|
+
data.tar.gz: 86c8cf5b4134e9881eb80a7dbf73bec4abf541c3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a433f6422d51d4620ca2b092ed0b0b5a7d7094a2fa12d63a6072fbe651627224ef25dda6e2b55d9c5c160bf402e437f4dc042ed3b8c0e2a27015c484423da56a
|
|
7
|
+
data.tar.gz: f607cd7267e1fca4a1358f5c2edc8b1dfadc854512f559facd1835c9af283c7ffc955711bcf42ec016f9fe3c1855d48d3246244a92c73dc98971da60e30f3302
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
|
|
3
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
|
4
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
|
5
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
|
6
|
+
# files.
|
|
7
|
+
#
|
|
8
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
|
9
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
|
10
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
|
11
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
|
12
|
+
# a separate helper file that requires the additional dependencies and performs
|
|
13
|
+
# the additional setup, and require it from the spec files that actually need
|
|
14
|
+
# it.
|
|
15
|
+
#
|
|
16
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
|
17
|
+
begin
|
|
18
|
+
ActiveRecord::Migration.maintain_test_schema!
|
|
19
|
+
rescue ActiveRecord::PendingMigrationError => ex
|
|
20
|
+
::Rails.logger.fatal(ex)
|
|
21
|
+
::Kernel.exit 1
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
RSpec.configure do |config|
|
|
25
|
+
# rspec-expectations config goes here. You can use an alternate
|
|
26
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
|
27
|
+
# assertions if you prefer.
|
|
28
|
+
config.expect_with :rspec do |expectations|
|
|
29
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
|
30
|
+
# and `failure_message` of custom matchers include text for helper methods
|
|
31
|
+
# defined using `chain`, e.g.:
|
|
32
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
|
33
|
+
# # => "be bigger than 2 and smaller than 4"
|
|
34
|
+
# ...rather than:
|
|
35
|
+
# # => "be bigger than 2"
|
|
36
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
|
40
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
|
41
|
+
config.mock_with :rspec do |mocks|
|
|
42
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
|
43
|
+
# a real object. This is generally recommended, and will default to
|
|
44
|
+
# `true` in RSpec 4.
|
|
45
|
+
mocks.verify_partial_doubles = true
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
|
49
|
+
# have no way to turn it off -- the option exists only for backwards
|
|
50
|
+
# compatibility in RSpec 3). It causes shared context metadata to be
|
|
51
|
+
# inherited by the metadata hash of host groups and examples, rather than
|
|
52
|
+
# triggering implicit auto-inclusion in groups with matching metadata.
|
|
53
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
|
54
|
+
|
|
55
|
+
# The settings below are suggested to provide a good initial experience
|
|
56
|
+
# with RSpec, but feel free to customize to your heart's content.
|
|
57
|
+
# # This allows you to limit a spec run to individual examples or groups
|
|
58
|
+
# # you care about by tagging them with `:focus` metadata. When nothing
|
|
59
|
+
# # is tagged with `:focus`, all examples get run. RSpec also provides
|
|
60
|
+
# # aliases for `it`, `describe`, and `context` that include `:focus`
|
|
61
|
+
# # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
|
62
|
+
# config.filter_run_when_matching :focus
|
|
63
|
+
#
|
|
64
|
+
# # Allows RSpec to persist some state between runs in order to support
|
|
65
|
+
# # the `--only-failures` and `--next-failure` CLI options. We recommend
|
|
66
|
+
# # you configure your source control system to ignore this file.
|
|
67
|
+
config.example_status_persistence_file_path = ::Rails.root.join('tmp', 'cache', 'rspec.txt')
|
|
68
|
+
#
|
|
69
|
+
# # Limits the available syntax to the non-monkey patched syntax that is
|
|
70
|
+
# # recommended. For more details, see:
|
|
71
|
+
# # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
|
72
|
+
# # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
|
73
|
+
# # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
|
74
|
+
# config.disable_monkey_patching!
|
|
75
|
+
#
|
|
76
|
+
# # Many RSpec users commonly either run the entire suite or an individual
|
|
77
|
+
# # file, and it's useful to allow more verbose output when running an
|
|
78
|
+
# # individual spec file.
|
|
79
|
+
# if config.files_to_run.one?
|
|
80
|
+
# # Use the documentation formatter for detailed output,
|
|
81
|
+
# # unless a formatter has already been configured
|
|
82
|
+
# # (e.g. via a command-line flag).
|
|
83
|
+
# config.default_formatter = "doc"
|
|
84
|
+
# end
|
|
85
|
+
#
|
|
86
|
+
# # Print the 10 slowest examples and example groups at the
|
|
87
|
+
# # end of the spec run, to help surface which specs are running
|
|
88
|
+
# # particularly slow.
|
|
89
|
+
# config.profile_examples = 10
|
|
90
|
+
#
|
|
91
|
+
# # Run specs in random order to surface order dependencies. If you find an
|
|
92
|
+
# # order dependency and want to debug it, you can fix the order by providing
|
|
93
|
+
# # the seed, which is printed after each run.
|
|
94
|
+
# # --seed 1234
|
|
95
|
+
# config.order = :random
|
|
96
|
+
#
|
|
97
|
+
# # Seed global randomization in this process using the `--seed` CLI option.
|
|
98
|
+
# # Setting this allows you to use `--seed` to deterministically reproduce
|
|
99
|
+
# # test failures related to randomization by passing the same `--seed` value
|
|
100
|
+
# # as the one that triggered the failure.
|
|
101
|
+
# Kernel.srand config.seed
|
|
102
|
+
|
|
103
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
|
104
|
+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
|
105
|
+
|
|
106
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
|
107
|
+
# examples within a transaction, remove the following line or assign false
|
|
108
|
+
# instead of true.
|
|
109
|
+
config.use_transactional_fixtures = true
|
|
110
|
+
|
|
111
|
+
# RSpec Rails can automatically mix in different behaviours to your tests
|
|
112
|
+
# based on their file location, for example enabling you to call `get` and
|
|
113
|
+
# `post` in specs under `spec/controllers`.
|
|
114
|
+
#
|
|
115
|
+
# You can disable this behaviour by removing the line below, and instead
|
|
116
|
+
# explicitly tag your specs with their type, e.g.:
|
|
117
|
+
#
|
|
118
|
+
# RSpec.describe UsersController, :type => :controller do
|
|
119
|
+
# # ...
|
|
120
|
+
# end
|
|
121
|
+
#
|
|
122
|
+
# The different available types are documented in the features, such as in
|
|
123
|
+
# https://relishapp.com/rspec/rspec-rails/docs
|
|
124
|
+
config.infer_spec_type_from_file_location!
|
|
125
|
+
|
|
126
|
+
# Filter lines from Rails gems in backtraces.
|
|
127
|
+
config.filter_rails_from_backtrace!
|
|
128
|
+
# arbitrary gems may also be filtered via:
|
|
129
|
+
# config.filter_gems_from_backtrace("gem name")
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
require 'eac_rails_base0/spec_helper/capybara'
|
|
133
|
+
require 'eac_rails_base0/spec_helper/factory_bot'
|
|
134
|
+
require 'eac_rails_base0/spec_helper/eac_users_support'
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require 'devise'
|
|
3
|
+
|
|
4
|
+
RSpec.configure do |config|
|
|
5
|
+
config.include Warden::Test::Helpers
|
|
6
|
+
|
|
7
|
+
config.after(:each) do
|
|
8
|
+
Warden.test_reset!
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
FactoryBot.define do
|
|
13
|
+
factory :user, class: ::EacUsersSupport::User do
|
|
14
|
+
email 'admin@example.com'
|
|
15
|
+
password 'mysecret'
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
RSpec.shared_context 'when user is admin', shared_context: :metadata do
|
|
20
|
+
let(:user) { ::FactoryBot.create(:user) }
|
|
21
|
+
|
|
22
|
+
before do
|
|
23
|
+
visit '/users/sign_in'
|
|
24
|
+
fill_in 'E-mail', with: user.email
|
|
25
|
+
fill_in 'Password', with: user.password
|
|
26
|
+
click_on 'Log in'
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it 'user should be logged' do
|
|
30
|
+
expect(page).to have_content user.email
|
|
31
|
+
expect(::EacUsersSupport::User.current_user).not_to be_nil
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
module EacRailsBase0
|
|
3
|
+
module Install
|
|
4
|
+
class RspecGenerator < Rails::Generators::Base
|
|
5
|
+
source_root File.expand_path('../templates', __FILE__)
|
|
6
|
+
|
|
7
|
+
def create_initializer_files
|
|
8
|
+
copy_file 'rspec.rc', '.rspec'
|
|
9
|
+
copy_file 'spec_rails_helper.rb', 'lib/spec_rails_helper.rb'
|
|
10
|
+
copy_file 'bin_rspec.rb', 'bin/rspec'
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
--require lib/spec_rails_helper --color --format doc --default-path . --pattern '**/spec/**/*_spec.rb'
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
ENV['RAILS_ENV'] ||= 'test'
|
|
3
|
+
require File.expand_path('../../config/environment', __FILE__)
|
|
4
|
+
abort('The Rails environment is running in production mode!') if Rails.env.production?
|
|
5
|
+
require 'rspec/rails'
|
|
6
|
+
require 'eac_rails_base0/spec_helper'
|
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.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Esquilo Azul Company
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-
|
|
11
|
+
date: 2018-08-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bootstrap-sass
|
|
@@ -52,6 +52,20 @@ dependencies:
|
|
|
52
52
|
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: 0.0.8
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: capybara
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :runtime
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
55
69
|
- !ruby/object:Gem::Dependency
|
|
56
70
|
name: coffee-rails
|
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -100,6 +114,20 @@ dependencies:
|
|
|
100
114
|
- - "~>"
|
|
101
115
|
- !ruby/object:Gem::Version
|
|
102
116
|
version: 0.2.1
|
|
117
|
+
- !ruby/object:Gem::Dependency
|
|
118
|
+
name: factory_bot_rails
|
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
|
120
|
+
requirements:
|
|
121
|
+
- - "~>"
|
|
122
|
+
- !ruby/object:Gem::Version
|
|
123
|
+
version: '4.0'
|
|
124
|
+
type: :runtime
|
|
125
|
+
prerelease: false
|
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
127
|
+
requirements:
|
|
128
|
+
- - "~>"
|
|
129
|
+
- !ruby/object:Gem::Version
|
|
130
|
+
version: '4.0'
|
|
103
131
|
- !ruby/object:Gem::Dependency
|
|
104
132
|
name: jbuilder
|
|
105
133
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -142,6 +170,20 @@ dependencies:
|
|
|
142
170
|
- - "~>"
|
|
143
171
|
- !ruby/object:Gem::Version
|
|
144
172
|
version: 4.2.10
|
|
173
|
+
- !ruby/object:Gem::Dependency
|
|
174
|
+
name: rspec-rails
|
|
175
|
+
requirement: !ruby/object:Gem::Requirement
|
|
176
|
+
requirements:
|
|
177
|
+
- - "~>"
|
|
178
|
+
- !ruby/object:Gem::Version
|
|
179
|
+
version: '3.7'
|
|
180
|
+
type: :runtime
|
|
181
|
+
prerelease: false
|
|
182
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
183
|
+
requirements:
|
|
184
|
+
- - "~>"
|
|
185
|
+
- !ruby/object:Gem::Version
|
|
186
|
+
version: '3.7'
|
|
145
187
|
- !ruby/object:Gem::Dependency
|
|
146
188
|
name: rubocop
|
|
147
189
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -278,7 +320,15 @@ files:
|
|
|
278
320
|
- lib/eac_rails_base0/ability.rb
|
|
279
321
|
- lib/eac_rails_base0/ability_mapping.rb
|
|
280
322
|
- lib/eac_rails_base0/engine.rb
|
|
323
|
+
- lib/eac_rails_base0/spec_helper.rb
|
|
324
|
+
- lib/eac_rails_base0/spec_helper/capybara.rb
|
|
325
|
+
- lib/eac_rails_base0/spec_helper/eac_users_support.rb
|
|
326
|
+
- lib/eac_rails_base0/spec_helper/factory_bot.rb
|
|
281
327
|
- lib/eac_rails_base0/version.rb
|
|
328
|
+
- lib/generators/eac_rails_base0/install/rspec/rspec_generator.rb
|
|
329
|
+
- lib/generators/eac_rails_base0/install/rspec/templates/bin_rspec.rb
|
|
330
|
+
- lib/generators/eac_rails_base0/install/rspec/templates/rspec.rc
|
|
331
|
+
- lib/generators/eac_rails_base0/install/rspec/templates/spec_rails_helper.rb
|
|
282
332
|
homepage: https://github.com/esquilo-azul/eac_rails_base0
|
|
283
333
|
licenses:
|
|
284
334
|
- MIT
|
|
@@ -300,7 +350,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
300
350
|
version: '0'
|
|
301
351
|
requirements: []
|
|
302
352
|
rubyforge_project:
|
|
303
|
-
rubygems_version: 2.
|
|
353
|
+
rubygems_version: 2.6.14
|
|
304
354
|
signing_key:
|
|
305
355
|
specification_version: 4
|
|
306
356
|
summary: A Rails base for multiple Rails projects developed by Esquilo Azul Company.
|