TheProlog / prolog_minitest_matchers

Custom Minitest matcher(s) we've developed for our own use, and which others may find useful.
MIT License
0 stars 0 forks source link

Implement `assert_requires_static_call_param` and `must_require_static_call_param` #2

Closed jdickey closed 8 years ago

jdickey commented 8 years ago

This should be reversible, but see Issue #1.

This will allow us to write an expectation such as

    let(:params) { { param1: true, param2: 42 } }
    # ...
    expect(SomeClass).must_require_static_call_param params, :param1

which would have the same effect as

    let(:params) { { param1: true, param2: 42 } }
    # ...
    params.delete :param1
    error = expect { SomeClass.call params }.must_raise ArgumentError
    expect(error.message).must_match 'Key :param1 not found in {param2: 42}!'