Module: Minitest::Assertions
- Defined in:
- lib/minitest/holdify_plugin.rb
Overview
Reopen the minitest module
Instance Method Summary collapse
-
#assert_hold(actual, *args, inspect: false) ⇒ Object
Main assertion.
-
#assert_hold! ⇒ Object
Force store the current value.
-
#assert_hold? ⇒ Boolean
Print to STDERR the actual value.
Instance Method Details
#assert_hold(actual, *args, inspect: false) ⇒ Object
Main assertion
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/minitest/holdify_plugin.rb', line 77 def assert_hold(actual, *args, inspect: false, **) @hold ||= Holdify::Hold.new(self) assertion, = args assertion, = , assertion unless assertion.nil? || assertion.is_a?(Symbol) expected = @hold.(actual, **) begin if inspect = ['[HOLDIFY] Inspect actual value (Remove the "?" suffix to pass the test)', ].compact.join(' ') flunk() elsif actual.nil? assert_nil expected, else send(assertion || :assert_equal, expected, actual, ) end rescue Minitest::Assertion => e feedback = @hold.feedback(e.location, expected, actual, ) raise(Minitest::Assertion, feedback) end expected end |
#assert_hold! ⇒ Object
Force store the current value
101 |
# File 'lib/minitest/holdify_plugin.rb', line 101 def assert_hold!(*, **) = assert_hold(*, **, force: true) |
#assert_hold? ⇒ Boolean
Print to STDERR the actual value
104 |
# File 'lib/minitest/holdify_plugin.rb', line 104 def assert_hold?(*, **) = assert_hold(*, **, inspect: true) |