Sha256: ad2f3b3e793459d53be553ab919ec12f4755a6f6b282505182f0e2c57b50e00c

Contents?: true

Size: 511 Bytes

Versions: 5

Compression:

Stored size: 511 Bytes

Contents

module ThorSupport
  # stolen from https://github.com/erikhuda/thor/blob/3241f2fbf1172b6182723b073fd4b390200660e9/spec/helper.rb#L51
  def capture(stream)
    begin
      stream = stream.to_s
      instance_eval "$#{stream} = StringIO.new"
      yield
      result = instance_eval("$#{stream}").string
    ensure
      instance_eval("$#{stream} = #{stream.upcase}")
    end

    result
  end
end

RSpec::Matchers.define :run do |command|
  match do |bot|
    expect(bot).to receive(:run).with command
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
boty-1.0.1 spec/support/thor_support.rb
boty-1.0.0 spec/support/thor_support.rb
boty-0.2.0 spec/support/thor_support.rb
boty-0.1.2 spec/support/thor_support.rb
boty-0.1.1 spec/support/thor_support.rb