main
1# frozen_string_literal: true
2
3# This file is copied to spec/ when you run 'rails generate rspec:install'
4require 'spec_helper'
5ENV['RAILS_ENV'] ||= 'test'
6require File.expand_path('../config/environment', __dir__)
7# Prevent database truncation if the environment is production
8if Rails.env.production?
9 abort("The Rails environment is running in production mode!")
10end
11require 'rspec/rails'
12# Add additional requires below this line. Rails is not loaded until this point!
13
14# Requires supporting ruby files with custom matchers and macros, etc, in
15# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
16# run as spec files by default. This means that files in spec/support that end
17# in _spec.rb will both be required and run as specs, causing the specs to be
18# run twice. It is recommended that you do not name files matching this glob to
19# end with _spec.rb. You can configure this pattern with the --pattern
20# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
21#
22# The following line is provided for convenience purposes. It has the downside
23# of increasing the boot-up time by auto-requiring all files in the support
24# directory. Alternatively, in the individual `*_spec.rb` files, manually
25# require only the support files necessary.
26#
27Dir[Rails.root.join('spec', 'support', '**', '*.rb')].sort.each { |f| require f }
28# Checks for pending migrations and applies them before tests are run.
29# If you are not using ActiveRecord, you can remove this line.
30ActiveRecord::Migration.maintain_test_schema!
31
32RSpec.configure do |config|
33 # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
34 config.fixture_path = "#{::Rails.root}/spec/fixtures"
35
36 # If you're not using ActiveRecord, or you'd prefer not to run each of your
37 # examples within a transaction, remove the following line or assign false
38 # instead of true.
39 config.use_transactional_fixtures = true
40
41 # RSpec Rails can automatically mix in different behaviours to your tests
42 # based on their file location, for example enabling you to call `get` and
43 # `post` in specs under `spec/controllers`.
44 #
45 # You can disable this behaviour by removing the line below, and instead
46 # explicitly tag your specs with their type, e.g.:
47 #
48 # RSpec.describe UsersController, :type => :controller do
49 # # ...
50 # end
51 #
52 # The different available types are documented in the features, such as in
53 # https://relishapp.com/rspec/rspec-rails/docs
54 config.infer_spec_type_from_file_location!
55
56 # Filter lines from Rails gems in backtraces.
57 config.filter_rails_from_backtrace!
58 # arbitrary gems may also be filtered via:
59 # config.filter_gems_from_backtrace("gem name")
60end