Sha256: 0d9c2886a9f51b47c5f2d592522ff764600baf96ad7f7860ff2404713a5860e0

Contents?: true

Size: 726 Bytes

Versions: 2

Compression:

Stored size: 726 Bytes

Contents

require 'rspec_ext'

RSpec::Core::ExampleGroup.class_eval do
  def self.swap_metadata    
    old_metadata = nil
    
    before :all do
      old_metadata = Micon.metadata
      Micon.swap_metadata old_metadata.deep_clone
    end
    
    after :all do
      Micon.swap_metadata old_metadata
    end
  end
  
  def self.with_environment environment = :test
    swap_metadata
    
    before :each do    
      crystal.clear
      crystal[:config].environment = environment
    end

    after :each do
      crystal.clear      
    end    
  end
  
  inject(
    :config => :config, 
    :logger => :logger
  )
  
  def silence_logger!
    self.logger = Logger.new nil
  end  
end

# Spec::Runner.configure do |config|  
# end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
crystal-0.0.13 lib/crystal/spec/environment.rb
crystal-0.0.12 lib/crystal/spec/environment.rb