Sha256: 1f2249d4c006cb77b062308d55152c4af02164d96cb1f6da0086d2651a211f62

Contents?: true

Size: 1.21 KB

Versions: 16

Compression:

Stored size: 1.21 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 capture_stderr(&block)
    original_stderr = $stderr
    $stderr = fake = StringIO.new
    begin
      yield
    ensure
      $stderr = original_stderr
    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

16 entries across 16 versions & 2 rubygems

Version Path
cldwalker-hirb-0.2.2 test/test_helper.rb
cldwalker-hirb-0.2.3 test/test_helper.rb
cldwalker-hirb-0.2.4 test/test_helper.rb
cldwalker-hirb-0.2.5 test/test_helper.rb
cldwalker-hirb-0.2.6 test/test_helper.rb
hirb-0.3.1 test/test_helper.rb
hirb-0.3.0 test/test_helper.rb
hirb-0.2.10 test/test_helper.rb
hirb-0.2.9 test/test_helper.rb
hirb-0.2.8 test/test_helper.rb
hirb-0.2.7 test/test_helper.rb
hirb-0.2.6 test/test_helper.rb
hirb-0.2.2 test/test_helper.rb
hirb-0.2.3 test/test_helper.rb
hirb-0.2.4 test/test_helper.rb
hirb-0.2.5 test/test_helper.rb