Sha256: fcf1c11f5f20de75fbd06a1c6a0faeaabcdf81139ad4a6d91b88ae6d820bb640

Contents?: true

Size: 716 Bytes

Versions: 24

Compression:

Stored size: 716 Bytes

Contents

require 'rspec_ext'
require 'micon/spec'

rad.mode = :test
rad.logger = Logger.new nil
rad.runtime_path = 'tmp', true

rspec do
  def self.isolate *args
    options = args.extract_options!
    scope = options[:before] || :each
    components = args.first.is_a?(Array) ? args.first : args    
    
    old = {}
    before :all do
      components.each do |name|      
        old[name] = rad[name]      
      end
    end
    
    before scope do
      components.each do |name|
        rad[name] = old[name].deep_clone
      end
    end
    
    after scope do
      components.each do |name|
        rad[name] = old[name].deep_clone
      end
    end
  end
  
  inject environment: :environment, logger: :logger
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
rad_core-0.0.17 lib/rad/spec/environment.rb
rad_core-0.0.16 lib/rad/spec/environment.rb
rad_core-0.0.15 lib/rad/spec/environment.rb
rad_core-0.0.14 lib/rad/spec/environment.rb