Sha256: aa38f1d69f89a9367bb9a506b2d8e9889762366e71e1c2e5e07a4c1b3224f8db
Contents?: true
Size: 1.85 KB
Versions: 3
Compression:
Stored size: 1.85 KB
Contents
module KeywordArgsTest class OptionalKeywordArgsTest < Minitest::Test def setup skip unless RUBY_VERSION >= '2.0' end def test_overriding_optional_keyword_argument actual = Invokr.invoke( method: :optional_keyword_argument, on: TestMethodBank, with: { album: 'billy_breathes' }, ) assert_equal 'billy_breathes', actual end def test_using_default_optional_keyword_argument actual = Invokr.invoke( method: :optional_keyword_argument, on: TestMethodBank, with: {}, ) assert_equal 'pitcher_of_nectar', actual end def test_querying_optional_keyword_argument method = Invokr.query_method TestMethodBank.method :optional_keyword_argument assert_equal [:album], method.optional_dependencies end end class RequiredKeywordArgsTest < Minitest::Test def setup skip unless RUBY_VERSION >= '2.1' end def test_supplying_required_keyword_argument actual = Invokr.invoke( method: :required_keyword_argument, on: TestMethodBank, with: { album: 'pitcher_of_nectar' }, ) assert_equal 'pitcher_of_nectar', actual end def test_failing_to_supply_a_required_keyword_argument error = assert_raises Invokr::MissingArgumentsError do Invokr.invoke( method: :required_keyword_argument, on: TestMethodBank, with: {}, ) end assert_equal( "missing required argument(s) `album' when invoking method `required_keyword_argument' on #<TestMethodBank:0xdeadbeef>", error.message, ) end def test_querying_required_keyword_argument method = Invokr.query_method TestMethodBank.method :required_keyword_argument assert_equal [:album], method.required_dependencies end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
invokr-0.0.4 | test/keyword_args_test.rb |
invokr-0.0.2 | test/keyword_args_test.rb |
invokr-0.0.1 | test/keyword_args_test.rb |