Sha256: 2f5afb41de54229fe9204850d93256ea558189bb00728b2b661fe576ffa19cc4

Contents?: true

Size: 887 Bytes

Versions: 4

Compression:

Stored size: 887 Bytes

Contents

require 'rubygems'
require 'test/unit'
require 'shoulda'
require 'mocha'

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'soca'

class Test::Unit::TestCase

  def setup
    @log = StringIO.new
    Soca.logger = Logger.new(@log)
    @test_app_dir = File.expand_path(File.join(File.dirname(__FILE__), 'testapp')) + '/'
    @new_app_dir  = File.expand_path(File.join(File.dirname(__FILE__), '..', 'tmp', 'newapp'))
    FileUtils.rm_rf(@new_app_dir) if File.directory?(@new_app_dir)
    FileUtils.mkdir_p(@new_app_dir)
  end

  # stolen from the thor specs
  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
  alias :silence :capture

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
soca-0.2.0 test/helper.rb
soca-0.1.2 test/helper.rb
soca-0.1.1 test/helper.rb
soca-0.1.0 test/helper.rb