Sha256: db04168e6708a33d1bdf45da5173c9a7edbec0337193a13325ecd3ceaded8959

Contents?: true

Size: 1022 Bytes

Versions: 2

Compression:

Stored size: 1022 Bytes

Contents

# encoding: utf-8

if RUBY_ENGINE == 'ruby' && RUBY_VERSION >= '2.3'
  require 'simplecov'
  SimpleCov.start
end

begin
  require 'byebug'
rescue LoadError; end

SPEC_ROOT = Pathname(__FILE__).dirname

Dir[SPEC_ROOT.join('support/*.rb').to_s].each { |f| require f }
Dir[SPEC_ROOT.join('shared/*.rb').to_s].each { |f| require f }

require 'dry/system/container'
require 'dry/system/stubs'

module TestNamespace
  def remove_constants
    constants.each do |name|
      remove_const(name)
    end
  end
end

RSpec.configure do |config|
  config.disable_monkey_patching!

  config.before do
    @load_paths = $LOAD_PATH.dup
    @loaded_features = $LOADED_FEATURES.dup
    Object.const_set(:Test, Module.new { |m| m.extend(TestNamespace) })
  end

  config.after do
    ($LOAD_PATH - @load_paths).each do |path|
      $LOAD_PATH.delete(path)
    end
    ($LOADED_FEATURES - @loaded_features).each do |file|
      $LOADED_FEATURES.delete(file)
    end

    Test.remove_constants
    Object.send(:remove_const, :Test)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dry-system-0.7.3 spec/spec_helper.rb
dry-system-0.7.2 spec/spec_helper.rb