Sha256: bcae485b9bd00564d8bd22f24381ff24c12419e91410a7da9d39f84c0c90dbd2

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 KB

Contents

# frozen_string_literal: true

require 'bundler/setup'
require 'mongoid-embedded-errors'
require 'database_cleaner'

current_path = File.dirname(__FILE__)
SPEC_MODELS_PATH = File.join(current_path, 'support/**/*.rb').freeze
Dir[SPEC_MODELS_PATH].each { |f| require f }

Mongoid.load! File.join(current_path, 'support/mongoid.yml'), :test

RSpec.configure do |config|
  config.run_all_when_everything_filtered = true
  config.filter_run :focus
  config.filter_run_excluding :skip

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

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

  config.before(:suite) do
    DatabaseCleaner.strategy = :truncation
  end

  config.around do |example|
    DatabaseCleaner.cleaning { example.run }
  end

  config.before do
    # Need to manually reload spec models for mutant to work as expected
    if ENV['MUTANT']
      Dir[SPEC_MODELS_PATH].each do |filename|
        Object.send(:remove_const, File.basename(filename, '.rb').capitalize)
        load filename
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mongoid-embedded-errors-3.0.1 spec/spec_helper.rb