Sha256: bf5791cff62c7a0b20a7217c4f7feb28366a532c445f132bafdbcf5179fd20be

Contents?: true

Size: 1.27 KB

Versions: 6

Compression:

Stored size: 1.27 KB

Contents

require 'blazing'

ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"

#
# Stuff borrowed from carlhuda/bundler
#
RSpec.configure do |config|

  #
  # Reset Logger
  #
  Logging.appenders.reset
  Logging.appenders.string_io(
    'string_io',
    :layout => Logging.layouts.pattern(
      :pattern => ' ------> [blazing] %-5l: %m\n',
      :color_scheme => 'bright'
    )
  )

  Logging.logger.root.appenders = 'string_io'

  def capture(stream)
    begin
      stream = stream.to_s
      eval "$#{stream} = StringIO.new"
      yield
      result = eval("$#{stream}").string
    ensure
      eval("$#{stream} = #{stream.upcase}")
    end

    result
  end

  def setup_sandbox
    @blazing_root = Dir.pwd
    @sandbox_directory = File.join('/tmp/blazing_sandbox')

    # Sometimes, when specs failed, the sandbox would stick around
    FileUtils.rm_rf(@sandbox_directory) if File.exists?(@sandbox_directory)

    # Setup Sandbox and cd into it
    Dir.mkdir(@sandbox_directory)
    Dir.chdir(@sandbox_directory)
    `git init .`
  end

  def teardown_sandbox
    # Teardown Sandbox
    Dir.chdir(@blazing_root)
    FileUtils.rm_rf(@sandbox_directory)
  end

  def destination_root
    File.join(File.dirname(__FILE__), 'sandbox')
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
blazing-0.2.7 spec/spec_helper.rb
blazing-0.2.6 spec/spec_helper.rb
blazing-0.2.5 spec/spec_helper.rb
blazing-0.2.4 spec/spec_helper.rb
blazing-0.2.3 spec/spec_helper.rb
blazing-0.2.2 spec/spec_helper.rb