Sha256: 51c185d9ef2d57a5b715274354723e1545b32d949061d272ee221ca6c2dab072

Contents?: true

Size: 1.03 KB

Versions: 4

Compression:

Stored size: 1.03 KB

Contents

require 'rubygems'
require 'test/unit'
require 'context' #gem install jeremymcanally-context -s http://gems.github.com
require 'matchy' #gem install jeremymcanally-matchy -s http://gems.github.com
require 'mocha'
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'hirb'

class Test::Unit::TestCase
  # set these to avoid invoking stty multiple times which doubles test suite running time
  ENV["LINES"] = ENV["COLUMNS"] = "20"
  def reset_terminal_size
    ENV["LINES"] = ENV["COLUMNS"] = "20"
  end

  def capture_stdout(&block)
    original_stdout = $stdout
    $stdout = fake = StringIO.new
    begin
      yield
    ensure
      $stdout = original_stdout
    end
    fake.string
  end

  def reset_config
    Hirb::View.instance_eval "@config = nil"
  end
end

class String
  def unindent(num=nil)
    regex = num ? /^\s{#{num}}/ : /^\s*/
    gsub(regex, '').chomp
  end
end

# mocks IRB for View + Pager
module ::IRB
  class Irb
    def initialize(context)
      @context = context
    end
    def output_value; end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
Chrononaut-hirb-0.2.1 test/test_helper.rb
Chrononaut-hirb-0.2.3 test/test_helper.rb
cldwalker-hirb-0.2.0 test/test_helper.rb
cldwalker-hirb-0.2.1 test/test_helper.rb