mhenrixon/stub_requests

View on GitHub
spec/spec_helper.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

require "bundler/setup"

if RUBY_ENGINE == "ruby" && RUBY_VERSION >= "2.5.1"
  require "simplecov" unless %w[false 0].include?(ENV["COV"])
  begin
    require "pry"
  rescue StandardError
    LoadError
  end
end

require "stub_requests"
StubRequests.logger = Logger.new("/dev/null")

require "rspec/its"
require "rspec/subject_as_lambda"

Dir[File.join(File.dirname(__FILE__), "support", "**", "*.rb")].each { |f| require f }

RSpec.configure do |config|
  config.after do
    StubRequests::ServiceRegistry.instance.reset
    StubRequests::CallbackRegistry.instance.reset
    StubRequests::EndpointRegistry.instance.reset
  end

  config.define_derived_metadata do |meta|
    meta[:aggregate_failures] = true
  end

  config.expect_with :rspec do |expectations|
    expectations.include_chain_clauses_in_custom_matcher_descriptions = true
  end

  config.mock_with :rspec do |mocks|
    mocks.verify_partial_doubles = true
  end

  config.shared_context_metadata_behavior = :apply_to_host_groups
  config.filter_run_when_matching :focus
  config.run_all_when_everything_filtered = true
  config.example_status_persistence_file_path = ".rspec_status"
  config.disable_monkey_patching!
  config.warnings = true
  config.default_formatter = "doc" if config.files_to_run.one?
  # config.profile_examples = 10
  config.order = :random
  Kernel.srand config.seed
end