Module: TLDR::Assertions::MinitestCompatibility
- Defined in:
- lib/tldr/assertions/minitest_compatibility.rb
Instance Method Summary collapse
- #assert_includes(actual, expected, message = nil) ⇒ Object
- #assert_send(receiver_method_args, message = nil) ⇒ Object
- #capture_io(&blk) ⇒ Object
- #mu_pp(obj) ⇒ Object
- #refute_includes(actual, expected, message = nil) ⇒ Object
Instance Method Details
#assert_includes(actual, expected, message = nil) ⇒ Object
19 20 21 |
# File 'lib/tldr/assertions/minitest_compatibility.rb', line 19 def assert_includes actual, expected, = nil assert_include? expected, actual, end |
#assert_send(receiver_method_args, message = nil) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/tldr/assertions/minitest_compatibility.rb', line 27 def assert_send receiver_method_args, = nil warn "DEPRECATED: assert_send. From #{TLDR.filter_backtrace(caller).first}" receiver, method, *args = receiver_method_args = Assertions.msg() { "Expected #{Assertions.h(receiver)}.#{method}(*#{Assertions.h(args)}) to return true" } assert receiver.__send__(method, *args), end |
#capture_io(&blk) ⇒ Object
37 38 39 |
# File 'lib/tldr/assertions/minitest_compatibility.rb', line 37 def capture_io &blk Assertions.capture_io(&blk) end |
#mu_pp(obj) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/tldr/assertions/minitest_compatibility.rb', line 41 def mu_pp obj s = obj.inspect.encode(Encoding.default_external) if String === obj && (obj.encoding != Encoding.default_external || !obj.valid_encoding?) enc = "# encoding: #{obj.encoding}" val = "# valid: #{obj.valid_encoding?}" "#{enc}\n#{val}\n#{s}" else s end end |
#refute_includes(actual, expected, message = nil) ⇒ Object
23 24 25 |
# File 'lib/tldr/assertions/minitest_compatibility.rb', line 23 def refute_includes actual, expected, = nil refute_include? expected, actual, end |