Skip to content

Commit 7e6fa7f

Browse files
committed
deps: Run rails generate rspec:install after updates.
1 parent 34383de commit 7e6fa7f

File tree

2 files changed

+23
-15
lines changed

2 files changed

+23
-15
lines changed

spec/rails_helper.rb

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
require_relative "../config/environment"
77
# Prevent database truncation if the environment is production
88
abort("The Rails environment is running in production mode!") if Rails.env.production?
9+
# Uncomment the line below in case you have `--require rails_helper` in the `.rspec` file
10+
# that will avoid rails generators crashing because migrations haven't been run yet
11+
# return unless Rails.env.test?
912
require "factory_bot"
1013
require "devise"
1114
require "rspec/rails"
@@ -25,19 +28,22 @@
2528
# directory. Alternatively, in the individual `*_spec.rb` files, manually
2629
# require only the support files necessary.
2730
#
28-
# Dir[Rails.root.join('spec', 'support', '**', '*.rb')].sort.each { |f| require f }
31+
# Rails.root.glob('spec/support/**/*.rb').sort_by(&:to_s).each { |f| require f }
2932

30-
# Checks for pending migrations and applies them before tests are run.
33+
# Ensures that the test database schema matches the current schema file.
34+
# If there are pending migrations it will invoke `db:test:prepare` to
35+
# recreate the test database by loading the schema.
3136
# If you are not using ActiveRecord, you can remove these lines.
3237
begin
3338
ActiveRecord::Migration.maintain_test_schema!
3439
rescue ActiveRecord::PendingMigrationError => e
35-
puts e.to_s.strip
36-
exit 1
40+
abort e.to_s.strip
3741
end
3842
RSpec.configure do |config|
3943
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
40-
config.fixture_path = Rails.root.join("spec/fixtures")
44+
config.fixture_paths = [
45+
Rails.root.join("spec/fixtures")
46+
]
4147

4248
# If you're not using ActiveRecord, or you'd prefer not to run each of your
4349
# examples within a transaction, remove the following line or assign false
@@ -47,26 +53,28 @@
4753
# You can uncomment this line to turn off ActiveRecord support entirely.
4854
# config.use_active_record = false
4955

50-
# RSpec Rails can automatically mix in different behaviours to your tests
51-
# based on their file location, for example enabling you to call `get` and
52-
# `post` in specs under `spec/controllers`.
56+
# RSpec Rails uses metadata to mix in different behaviours to your tests,
57+
# for example enabling you to call `get` and `post` in request specs. e.g.:
5358
#
54-
# You can disable this behaviour by removing the line below, and instead
55-
# explicitly tag your specs with their type, e.g.:
56-
#
57-
# RSpec.describe UsersController, type: :controller do
59+
# RSpec.describe UsersController, type: :request do
5860
# # ...
5961
# end
6062
#
6163
# The different available types are documented in the features, such as in
62-
# https://relishapp.com/rspec/rspec-rails/docs
64+
# https://rspec.info/features/8-0/rspec-rails
65+
#
66+
# You can also this infer these behaviours automatically by location, e.g.
67+
# /spec/models would pull in the same behaviour as `type: :model` but this
68+
# behaviour is considered legacy and will be removed in a future version.
69+
#
70+
# To enable this behaviour uncomment the line below.
6371
config.infer_spec_type_from_file_location!
6472

6573
# Filter lines from Rails gems in backtraces.
6674
config.filter_rails_from_backtrace!
6775
# arbitrary gems may also be filtered via:
6876
# config.filter_gems_from_backtrace("gem name")
69-
#
77+
7078
config.include Devise::Test::ControllerHelpers, type: :controller
7179
config.include Devise::Test::ControllerHelpers, type: :view
7280

spec/spec_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
#
6868
# # Limits the available syntax to the non-monkey patched syntax that is
6969
# # recommended. For more details, see:
70-
# # https://relishapp.com/rspec/rspec-core/docs/configuration/zero-monkey-patching-mode
70+
# # https://rspec.info/features/3-12/rspec-core/configuration/zero-monkey-patching-mode/
7171
# config.disable_monkey_patching!
7272
#
7373
# # Many RSpec users commonly either run the entire suite or an individual

0 commit comments

Comments
 (0)