Sha256: 1b0cf6c77d3654a2a8f75f6676c2d4f11fd81c7af8a68717748509d9e327ac10

Contents?: true

Size: 1.03 KB

Versions: 20

Compression:

Stored size: 1.03 KB

Contents

require 'rubygems'
require 'test/unit'
require 'shoulda'
require 'mocha'
require 'fileutils'
require 'redgreen' if RUBY_VERSION < "1.9"

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

class Test::Unit::TestCase
  def capture_stdout
    ios = StringIO.new
    stdout = $stdout
    $stdout = ios

    begin
      yield
    ensure
      $stdout = stdout
      ios
    end
  end

  def capture_stderr
    ios = StringIO.new
    stderr = $stderr
    $stderr = ios

    begin
      yield
    ensure
      $stderr = stderr
      ios
    end
  end

  def with_jars(jars = "JsTestDriver-1.0b.jar", dir = "data")
    FileUtils.rm_rf(dir)
    Dir.mkdir(dir)

    [jars].flatten.each do |lib|
      File.open(File.join(dir, lib), "w") { |f| f.puts "" }
    end

    begin
      yield dir
    ensure
      FileUtils.rm_rf(dir)
    end
  end

  def with_env(name, value)
    env = ENV[name]
    ENV[name] = value

    begin
      yield
    ensure
      ENV[name] = value
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
jstdutil-0.3.13 test/test_helper.rb
jstdutil-0.3.12 test/test_helper.rb
jstdutil-0.3.11 test/test_helper.rb
jstdutil-0.3.10 test/test_helper.rb
jstdutil-0.3.9 test/test_helper.rb
jstdutil-0.3.8 test/test_helper.rb
jstdutil-0.3.7 test/test_helper.rb
jstdutil-0.3.6 test/test_helper.rb
jstdutil-0.3.5 test/test_helper.rb
jstdutil-0.3.4 test/test_helper.rb
jstdutil-0.3.3 test/test_helper.rb
jstdutil-0.3.2 test/test_helper.rb
jstdutil-0.3.1 test/test_helper.rb
jstdutil-0.3.0 test/test_helper.rb
jstdutil-0.2.2 test/test_helper.rb
jstdutil-0.2.1 test/test_helper.rb
jstdutil-0.2.0 test/test_helper.rb
jstdutil-0.1.2 test/test_helper.rb
jstdutil-0.1.1 test/test_helper.rb
jstdutil-0.1.0 test/test_helper.rb