Sha256: 9497e412ef5939d2cf0369034594165bfd56a3ad05ec2d3288fa7a32eb6ec8dd

Contents?: true

Size: 961 Bytes

Versions: 5

Compression:

Stored size: 961 Bytes

Contents

require 'rib/test'
require 'rib/runner'

describe Rib::Runner do
  paste :rib

  before do
    mock(Rib).shell{ shell }.times(2)
  end

  def input *args
    args.each{ |item| mock(shell).get_input{ item } }
    mock(shell).get_input{}
  end

  def output *args
    args.each{ |item| mock(shell).puts("=> #{item}"){} }
    mock(shell).puts{}
  end

  would '-e' do
     input('a')
    output('1')

    expect(Rib::Runner.run(%w[-ea=1])).eq shell
  end

  would '-e nothing' do
     input
    output

    expect(Rib::Runner.run(%w[-e])).eq shell
  end

  def verify_app_e argv
     input('a')
    output('1')
    conf = {:name => 'rib'}
    min  = 'rib-min'

    mock(Rib::Runner).which_bin(min){ min }
    mock(Rib::Runner).load(min){ Rib::Runner.run(argv) }
    stub(Rib).config{ conf }

    expect(Rib::Runner.run(argv)).eq shell
  end

  would 'min -e' do
    verify_app_e(%w[min -ea=1])
  end

  would '-e min' do
    verify_app_e(%w[-ea=1 min])
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rib-1.6.1 test/test_runner.rb
rib-1.6.0 test/test_runner.rb
rib-1.5.4 test/test_runner.rb
rib-1.5.3 test/test_runner.rb
rib-1.5.2 test/test_runner.rb