diff options
Diffstat (limited to 'spec/support/rspec.rb')
-rw-r--r-- | spec/support/rspec.rb | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/spec/support/rspec.rb b/spec/support/rspec.rb index 30e48b3baf1..6795d2f6d2a 100644 --- a/spec/support/rspec.rb +++ b/spec/support/rspec.rb @@ -1,22 +1,26 @@ # frozen_string_literal: true +require_relative "rspec_order" +require_relative "system_exit_detected" require_relative "helpers/stub_configuration" require_relative "helpers/stub_metrics" require_relative "helpers/stub_object_storage" require_relative "helpers/stub_env" require_relative "helpers/fast_rails_root" -# so we need to load rubocop here due to the rubocop support file loading cop_helper -# which monkey patches class Cop -# if cop helper is loaded before rubocop (where class Cop is defined as class Cop < Base) -# we get a `superclass mismatch for class Cop` error when running a rspec for a locally defined -# rubocop cop - therefore we need rubocop required first since it had an inheritance added to the Cop class -require 'rubocop' -require 'rubocop/rspec/support' - RSpec::Expectations.configuration.on_potential_false_positives = :raise RSpec.configure do |config| + # Re-run failures locally with `--only-failures` + config.example_status_persistence_file_path = ENV.fetch('RSPEC_LAST_RUN_RESULTS_FILE', './spec/examples.txt') + + unless ENV['CI'] + # Allow running `:focus` examples locally, + # falling back to all tests when there is no `:focus` example. + config.filter_run focus: true + config.run_all_when_everything_filtered = true + end + config.mock_with :rspec do |mocks| mocks.verify_doubled_constant_names = true end @@ -28,10 +32,4 @@ RSpec.configure do |config| config.include StubObjectStorage config.include StubENV config.include FastRailsRoot - - config.include RuboCop::RSpec::ExpectOffense, type: :rubocop - - config.define_derived_metadata(file_path: %r{spec/rubocop}) do |metadata| - metadata[:type] = :rubocop - end end |