Sha256: 2125375d8cc2f09306456978db93a2bd617af3d3a917a798295e9a17f14829c4

Contents?: true

Size: 904 Bytes

Versions: 6

Compression:

Stored size: 904 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

6 entries across 6 versions & 1 rubygems

Version Path
doit-1.0.9 test/doit_test.rb
doit-1.0.8 test/doit_test.rb
doit-1.0.7 test/doit_test.rb
doit-1.0.5 test/doit_test.rb
doit-1.0.4 test/doit_test.rb
doit-1.0.3 test/doit_test.rb