Sha256: 14fc512608be25f6dd2224a501b0261685f91088da5f5bcbe0f3e9b345d354c4

Contents?: true

Size: 937 Bytes

Versions: 3

Compression:

Stored size: 937 Bytes

Contents

require 'rubygems'
require 'ruby-debug'
require 'spec'
require 'spec-i18n'

$:.unshift(File.dirname(__FILE__), '../lib')

def with_sandboxed_options
  attr_reader :options
  
  before(:each) do
    @original_rspec_options = ::Spec::Runner.options
    ::Spec::Runner.use(@options = ::Spec::Runner::Options.new(StringIO.new, StringIO.new))
  end

  after(:each) do
    ::Spec::Runner.use(@original_rspec_options)
  end
  
  yield
end

def with_sandboxed_config
  attr_reader :config
  
  before(:each) do
    @config = ::Spec::Runner::Configuration.new
    @original_configuration = ::Spec::Runner.configuration
    spec_configuration = @config
    ::Spec::Runner.instance_eval {@configuration = spec_configuration}
  end
  
  after(:each) do
    original_configuration = @original_configuration
    ::Spec::Runner.instance_eval {@configuration = original_configuration}
    ::Spec::Example::ExampleGroupFactory.reset
  end
  
  yield
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rspec-i18n-0.2.1 spec/spec_helper.rb
rspec-i18n-0.2.0 spec/spec_helper.rb
rspec-i18n-0.1.0 spec/spec_helper.rb