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.2.6 lib/rad/spec/environment.rb
rad_core-0.2.5 lib/rad/spec/environment.rb
rad_core-0.2.4 lib/rad/spec/environment.rb
rad_core-0.2.3 lib/rad/spec/environment.rb
rad_core-0.2.2 lib/rad/spec/environment.rb
rad_core-0.2.1 lib/rad/spec/environment.rb
rad_core-0.2.0 lib/rad/spec/environment.rb
rad_core-0.0.30 lib/rad/spec/environment.rb
rad_core-0.0.29 lib/rad/spec/environment.rb
rad_core-0.0.28 lib/rad/spec/environment.rb
rad_core-0.0.27 lib/rad/spec/environment.rb
rad_core-0.0.26 lib/rad/spec/environment.rb
rad_core-0.0.25 lib/rad/spec/environment.rb
rad_core-0.0.24 lib/rad/spec/environment.rb
rad_core-0.0.23 lib/rad/spec/environment.rb
rad_core-0.0.22 lib/rad/spec/environment.rb
rad_core-0.0.21 lib/rad/spec/environment.rb
rad_core-0.0.20 lib/rad/spec/environment.rb
rad_core-0.0.19 lib/rad/spec/environment.rb
rad_core-0.0.18 lib/rad/spec/environment.rb