You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's bad when code to support your testing has bugs that give an unearned green bar when you invoke them with a typo.
Such is the case with the current MiniTest::Assertions::AssertRequiresInitializeParameterasserter class which we use to verify that a class requires specific named parameters to its #initialise method.
Given a class
classFoodefinitialise(foo:,bar:)# ...end# ...end
we can write a MiniTest::Spec assertion such as
# ...let(:params){{foo: foo,bar: bar}}# ...it'requires a :bar parameter for initialisation'doexpect(Foo).must_require_initialize_parameterparams,:barend
and get a legitimate green bar.
Writing the test with a typo, such as
# ...let(:params){{foo: foo,bar: bar}}# ...it'requires a :bar parameter for initialisation'doexpect(Foo).must_require_initialize_parameterparams,:bearend
will give an illegitimate green bar; the asserter deletes the entry specified by the second parameter from (a copy of) the Hash specified by the first, and attempts to instantiate the class with the result. In the code as of Commit 376ca33, deleting the nonexistent key silently has no effect, and the instantiation, receiving valid parameters, succeeds.
The implementation extracted to the new prolog_minitest_matchers Gem solves this (and therefore conflicts with the current implementation in this Gem). The prolog-use_cases implementation should be removed and the prolog_minitest_matchers Gem added as a development dependency instead.
The text was updated successfully, but these errors were encountered:
It's bad when code to support your testing has bugs that give an unearned green bar when you invoke them with a typo.
Such is the case with the current
MiniTest::Assertions::AssertRequiresInitializeParameter
asserter class which we use to verify that a class requires specific named parameters to its#initialise
method.Given a class
we can write a MiniTest::Spec assertion such as
and get a legitimate green bar.
Writing the test with a typo, such as
will give an illegitimate green bar; the asserter deletes the entry specified by the second parameter from (a copy of) the Hash specified by the first, and attempts to instantiate the class with the result. In the code as of Commit 376ca33, deleting the nonexistent key silently has no effect, and the instantiation, receiving valid parameters, succeeds.
The implementation extracted to the new
prolog_minitest_matchers
Gem solves this (and therefore conflicts with the current implementation in this Gem). Theprolog-use_cases
implementation should be removed and theprolog_minitest_matchers
Gem added as a development dependency instead.The text was updated successfully, but these errors were encountered: