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