From dc21c31f9d4ce39e213547fa0bad3188a61323ed Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Fri, 14 Jun 2024 18:21:16 +0200 Subject: [PATCH] Reorder includes for `spec_helper` and `rails_helper` --- spec/rails_helper.rb | 5 ++++- spec/spec_helper.rb | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 35dd1296..405ec16a 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -5,11 +5,14 @@ ENV['RAILS_ENV'] ||= 'test' require 'spec_helper' require 'support/prometheus_client_stub' 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? + +# Add additional requires below this line. Rails is not loaded until this point! require 'rspec/rails' require 'pundit/rspec' -# Add additional requires below this line. Rails is not loaded until this point! +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 7710f8a3..1cb686f2 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -24,7 +24,10 @@ unless RUBY_PLATFORM == 'java' || ENV.fetch('RUBYMINE_SIMPLECOV_COVERAGE_PATH', SimpleCov.start('rails') end -require 'webmock/rspec' +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 +RSpec::Matchers.define_negated_matcher :not_eql, :eql RSpec.configure do |config| # rspec-expectations config goes here. You can use an alternate