From ffbad1c305e068737cb54bd143e392fdf3df4256 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Fri, 14 Jun 2024 18:21:02 +0200 Subject: [PATCH] Reorder includes for `spec_helper` and `rails_helper` --- spec/rails_helper.rb | 6 +++++- spec/spec_helper.rb | 3 --- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 4154880cd..3c7445a8d 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -4,10 +4,14 @@ ENV['RAILS_ENV'] ||= 'test' require 'spec_helper' require File.expand_path('../config/environment', __dir__) + # Prevent database truncation if the environment is production abort('The Rails environment is running in production mode!') if Rails.env.production? -require 'rspec/rails' + # Add additional requires below this line. Rails is not loaded until this point! +require 'rspec/rails' +require 'pundit/matchers' +require 'webmock/rspec' # Requires supporting ruby files with custom matchers and macros, etc, in # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index bf274365e..0d174b3bb 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -24,9 +24,6 @@ SimpleCov.start('rails') end -require 'webmock/rspec' -require 'pundit/matchers' - RSpec::Matchers.define_negated_matcher :avoid_change, :change RSpec::Matchers.define_negated_matcher :not_include, :include RSpec::Matchers.define_negated_matcher :not_have_attributes, :have_attributes