Sha256: 8e46d0b16db6f4ce422a667c873d2f21eb254a5c21298cead061c4f2c3c58bc2

Contents?: true

Size: 1.05 KB

Versions: 14

Compression:

Stored size: 1.05 KB

Contents

require 'bacon'
require 'bacon/bits'
require 'mocha-on-bacon'
require 'hirb'
include Hirb

module TestHelpers
  # 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
    View.instance_eval "@config = nil"
  end
end

class Bacon::Context
  include TestHelpers
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

14 entries across 13 versions & 3 rubygems

Version Path
hirber-0.8.2 test/test_helper.rb
hirber-0.8.1 test/test_helper.rb
hirber-0.8.0 test/test_helper.rb
hirb-0.7.3 test/test_helper.rb
climine-0.0.7 vendor/bundle/ruby/2.0.0/gems/hirb-0.7.1/test/test_helper.rb
climine-0.0.7 vendor/bundle/ruby/2.1.0/gems/hirb-0.7.1/test/test_helper.rb
hirb-0.7.2 test/test_helper.rb
climine-0.0.6 vendor/bundle/ruby/2.0.0/gems/hirb-0.7.1/test/test_helper.rb
climine-0.0.5 vendor/bundle/ruby/2.0.0/gems/hirb-0.7.1/test/test_helper.rb
climine-0.0.4 vendor/bundle/ruby/2.0.0/gems/hirb-0.7.1/test/test_helper.rb
climine-0.0.3 vendor/bundle/ruby/2.0.0/gems/hirb-0.7.1/test/test_helper.rb
climine-0.0.2 vendor/bundle/ruby/2.0.0/gems/hirb-0.7.1/test/test_helper.rb
climine-0.0.1 vendor/bundle/ruby/2.0.0/gems/hirb-0.7.1/test/test_helper.rb
hirb-0.7.1 test/test_helper.rb