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
I use minitest with spec syntax.
I have a complex stubbing method that invokes such methods as assert_equal, assert_operator, etc. I want to reuse it in another tests file so I need to put it in some common place to require, but usual def elsewhere will not find those assertion methods. What is the way/place to define the asserting helpers at? Maybe some Minitest class that I have to extend?
The text was updated successfully, but these errors were encountered:
Such a pain, no? Always bites me. 2 easy (cheat?) ways I know of... go ahead and shove it in Minitest::Test (or Spec) or include Minitest::Assertions in your module.
If it is app/lib specific, then I usually put em in a Test/Spec subclass of their own that I subclass from. For specs you can "register" this new spec type:
Minitest::Spec.register_spec_type(/XTest$/,MyCustomTest)# orMinitest::Spec.register_spec_type(MyCustomTest)do |desc|
desc.superclass.is_a?Something# or whateverend
I use minitest with spec syntax.
I have a complex stubbing method that invokes such methods as
assert_equal
,assert_operator
, etc. I want to reuse it in another tests file so I need to put it in some common place to require, but usualdef
elsewhere will not find those assertion methods. What is the way/place to define the asserting helpers at? Maybe some Minitest class that I have to extend?The text was updated successfully, but these errors were encountered: