Sha256: 3963e6eef6cd5e40ed093f8f2dd9321bb884ba4e458d45476f568770e6910eb7

Contents?: true

Size: 906 Bytes

Versions: 4

Compression:

Stored size: 906 Bytes

Contents

require 'test_helper'

describe Doit do

  before do
    Doit.start({})
  end

  it 'start' do
    out = noop {}
    assert_equal '', out
  end

  it 'options' do
    assert_equal({}, Doit.options)
  end

  it 'list' do
    out = noop {
      Doit.list
    }
    assert_match(/\/\.doit/, out)
  end

  it 'execute' do
    out, _err = capture_io do
      Doit.execute('hello')
    end
    assert_match(/\nHello\n/, out)
  end

  it 'execute with unknown script' do
    out, _err = capture_io do
      Doit.execute('______unknown______')
    end
    assert_match(/not found/, out)
  end

  it 'tests option --each' do
    out = noop(each: true) {
      Doit.execute('hello')
    }
    assert_match(/doit hello -r/, out)
  end

  it 'coverage: list; option -lv' do
    out = noop(verbose: true, list: true) {
      Doit.start(verbose: true, list: true)
    }
    assert_match(/just a test\n/, out)
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
doit-1.0.2 test/doit_test.rb
doit-1.0.1 test/doit_test.rb
doit-0.3.9 test/doit_test.rb
doit-0.3.6 test/doit_test.rb