Sha256: 360b62a7fee53134aed2eb1926fea1e126c0110606b6f0c1dc774577206ad82f

Contents?: true

Size: 930 Bytes

Versions: 4

Compression:

Stored size: 930 Bytes

Contents

require 'test_helper'
require 'my'

describe What do

  it 'is robust against empty params' do
    What.init('')
    assert_equal [Dir.pwd], What.where
    assert_equal [{}], What.matrix
  end

  it "#to_env({}) must be ''" do
    assert_equal '', What.to_env({})
  end

  it 'to_env converts variable to uppercase' do
    assert_equal 'A=1', What.to_env(a: 1)
  end

  it 'coverage: #info' do
    Doit.stub :options, verbose: true do
      _out, _err = capture_io do
        What.init('')
        What.info
      end
    end
  end

  it 'builds simple matrix' do
    What.init("a: 1\n")
    assert_equal [{ 'a' => 1 }], What.matrix
  end

  it 'builds matrix' do
    What.init("a:\n - 1\n - 2\n")
    assert_equal [{ 'a' => 1 }, { 'a' => 2 }], What.matrix
  end

  it 'builds product matrix' do
    What.init("a:\n - 1\nb:\n - 3\n - 4\n")
    assert_equal [{ 'a' => 1, 'b' => 3 }, { 'a' => 1, 'b' => 4 }], What.matrix
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

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