Sha256: 8eb4a868fbd2a1a0a1b0d31943152596c8a215aa21f2f292d5afb289cbff3b27

Contents?: true

Size: 635 Bytes

Versions: 2

Compression:

Stored size: 635 Bytes

Contents

class InvokrTest < Minitest::Test
  def test_supplying_proc
    my_proc = ->a,b{a+b}

    result = Invokr.invoke proc: my_proc, with: { a: 1, b: 4 }

    assert_equal 5, result
  end

  def test_using_keyword_overrides_extra_arguments_error
    my_proc = ->a,b{a**b}

    result = Invokr.invoke proc: my_proc, using: { a: 2, b: 3, c: nil }

    assert_equal 8, result
  end

  def test_incorrectly_invoking
    error = assert_raises Invokr::InputError do
      Invokr.invoke
    end

    assert_equal(
      "cannot invoke; missing required arguments: `method', `on' and either `with' or `using'",
      error.message,
    )
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
invokr-0.9.7 test/invokr_test.rb
invokr-0.9.6 test/invokr_test.rb