How to use without_diff method of MyModule Package

Best Minitest_ruby code snippet using MyModule.without_diff

test_minitest_assertions.rb

Source:test_minitest_assertions.rb Github

copy

Full Screen

...121 @tc.assert_equal h1, h2122 end123 end124 def test_assert_equal_different_diff_deactivated125 without_diff do126 assert_triggered util_msg("haha" * 10, "blah" * 10) do127 o1 = "haha" * 10128 o2 = "blah" * 10129 @tc.assert_equal o1, o2130 end131 end132 end133 def test_assert_equal_different_message134 assert_triggered "whoops.\nExpected: 1\n Actual: 2" do135 @tc.assert_equal 1, 2, message { "whoops" }136 end137 end138 def test_assert_equal_different_lambda139 assert_triggered "whoops.\nExpected: 1\n Actual: 2" do140 @tc.assert_equal 1, 2, lambda { "whoops" }141 end142 end143 def test_assert_equal_different_hex144 c = Class.new do145 def initialize s; @name = s; end146 end147 o1 = c.new "a"148 o2 = c.new "b"149 msg = clean <<-EOS150 --- expected151 +++ actual152 @@ -1 +1 @@153 -#<#<Class:0xXXXXXX>:0xXXXXXX @name=\"a\">154 +#<#<Class:0xXXXXXX>:0xXXXXXX @name=\"b\">155 EOS156 assert_triggered msg do157 @tc.assert_equal o1, o2158 end159 end160 def test_assert_equal_different_hex_invisible161 o1 = Object.new162 o2 = Object.new163 msg = "No visible difference in the Object#inspect output.164 You should look at the implementation of #== on Object or its members.165 #<Object:0xXXXXXX>".gsub(/^ +/, "")166 assert_triggered msg do167 @tc.assert_equal o1, o2168 end169 end170 def test_assert_equal_different_long171 msg = "--- expected172 +++ actual173 @@ -1 +1 @@174 -\"hahahahahahahahahahahahahahahahahahahaha\"175 +\"blahblahblahblahblahblahblahblahblahblah\"176 ".gsub(/^ +/, "")177 assert_triggered msg do178 o1 = "haha" * 10179 o2 = "blah" * 10180 @tc.assert_equal o1, o2181 end182 end183 def test_assert_equal_different_long_invisible184 msg = "No visible difference in the String#inspect output.185 You should look at the implementation of #== on String or its members.186 \"blahblahblahblahblahblahblahblahblahblah\"".gsub(/^ +/, "")187 assert_triggered msg do188 o1 = "blah" * 10189 o2 = "blah" * 10190 def o1.== _191 false192 end193 @tc.assert_equal o1, o2194 end195 end196 def test_assert_equal_different_long_msg197 msg = "message.198 --- expected199 +++ actual200 @@ -1 +1 @@201 -\"hahahahahahahahahahahahahahahahahahahaha\"202 +\"blahblahblahblahblahblahblahblahblahblah\"203 ".gsub(/^ +/, "")204 assert_triggered msg do205 o1 = "haha" * 10206 o2 = "blah" * 10207 @tc.assert_equal o1, o2, "message"208 end209 end210 def test_assert_equal_different_short211 assert_triggered util_msg(1, 2) do212 @tc.assert_equal 1, 2213 end214 end215 def test_assert_equal_different_short_msg216 assert_triggered util_msg(1, 2, "message") do217 @tc.assert_equal 1, 2, "message"218 end219 end220 def test_assert_equal_different_short_multiline221 msg = "--- expected\n+++ actual\n@@ -1,2 +1,2 @@\n \"a\n-b\"\n+c\"\n"222 assert_triggered msg do223 @tc.assert_equal "a\nb", "a\nc"224 end225 end226 def test_assert_equal_does_not_allow_lhs_nil227 if Minitest::VERSION =~ /^6/ then228 warn "Time to strip the MT5 test"229 @assertion_count += 1230 assert_triggered(/Use assert_nil if expecting nil/) do231 @tc.assert_equal nil, nil232 end233 else234 err_re = /Use assert_nil if expecting nil from .*test_minitest_\w+.rb/235 err_re = "" if $-w.nil?236 assert_output "", err_re do237 @tc.assert_equal nil, nil238 end239 end240 end241 def test_assert_equal_does_not_allow_lhs_nil_triggered242 assert_triggered "Expected: nil\n Actual: false" do243 @tc.assert_equal nil, false244 end245 end246 def test_assert_equal_string_bug791247 exp = <<-'EOF'.gsub(/^ {10}/, "") # note single quotes248 --- expected249 +++ actual250 @@ -1,2 +1 @@251 -"\\n252 -"253 +"\\\"254 EOF255 exp = "Expected: \"\\\\n\"\n Actual: \"\\\\\""256 assert_triggered exp do257 @tc.assert_equal "\\n", "\\"258 end259 end260 def test_assert_equal_string_both_escaped_unescaped_newlines261 msg = <<-EOM.gsub(/^ {10}/, "")262 --- expected263 +++ actual264 @@ -1,2 +1 @@265 -\"A\\n266 -B\"267 +\"A\\n\\\\nB\"268 EOM269 assert_triggered msg do270 exp = "A\\nB"271 act = "A\n\\nB"272 @tc.assert_equal exp, act273 end274 end275 def test_assert_equal_string_encodings276 msg = <<-EOM.gsub(/^ {10}/, "")277 --- expected278 +++ actual279 @@ -1,3 +1,3 @@280 -# encoding: UTF-8281 -# valid: false282 +# encoding: ASCII-8BIT283 +# valid: true284 "bad-utf8-\\xF1.txt"285 EOM286 assert_triggered msg do287 x = "bad-utf8-\xF1.txt"288 y = x.dup.force_encoding "binary" # TODO: switch to .b when 1.9 dropped289 @tc.assert_equal x, y290 end291 end unless RUBY18292 def test_assert_equal_string_encodings_both_different293 msg = <<-EOM.gsub(/^ {10}/, "")294 --- expected295 +++ actual296 @@ -1,3 +1,3 @@297 -# encoding: US-ASCII298 -# valid: false299 +# encoding: ASCII-8BIT300 +# valid: true301 "bad-utf8-\\xF1.txt"302 EOM303 assert_triggered msg do304 x = "bad-utf8-\xF1.txt".force_encoding "ASCII"305 y = x.dup.force_encoding "binary" # TODO: switch to .b when 1.9 dropped306 @tc.assert_equal x, y307 end308 end unless RUBY18309 def test_assert_equal_unescape_newlines310 msg = <<-'EOM'.gsub(/^ {10}/, "") # NOTE single quotes on heredoc311 --- expected312 +++ actual313 @@ -1,2 +1,2 @@314 -"hello315 +"hello\n316 world"317 EOM318 assert_triggered msg do319 exp = "hello\nworld"320 act = 'hello\nworld' # notice single quotes321 @tc.assert_equal exp, act322 end323 end324 def test_assert_in_delta325 @tc.assert_in_delta 0.0, 1.0 / 1000, 0.1326 end327 def test_assert_in_delta_triggered328 x = maglev? ? "9.999999xxxe-07" : "1.0e-06"329 assert_triggered "Expected |0.0 - 0.001| (0.001) to be <= #{x}." do330 @tc.assert_in_delta 0.0, 1.0 / 1000, 0.000001331 end332 end333 def test_assert_in_epsilon334 @assertion_count = 10335 @tc.assert_in_epsilon 10_000, 9991336 @tc.assert_in_epsilon 9991, 10_000337 @tc.assert_in_epsilon 1.0, 1.001338 @tc.assert_in_epsilon 1.001, 1.0339 @tc.assert_in_epsilon 10_000, 9999.1, 0.0001340 @tc.assert_in_epsilon 9999.1, 10_000, 0.0001341 @tc.assert_in_epsilon 1.0, 1.0001, 0.0001342 @tc.assert_in_epsilon 1.0001, 1.0, 0.0001343 @tc.assert_in_epsilon(-1, -1)344 @tc.assert_in_epsilon(-10_000, -9991)345 end346 def test_assert_in_epsilon_triggered347 assert_triggered "Expected |10000 - 9990| (10) to be <= 9.99." do348 @tc.assert_in_epsilon 10_000, 9990349 end350 end351 def test_assert_in_epsilon_triggered_negative_case352 x = (RUBY18 and not maglev?) ? "0.1" : "0.100000xxx"353 y = maglev? ? "0.100000xxx" : "0.1"354 assert_triggered "Expected |-1.1 - -1| (#{x}) to be <= #{y}." do355 @tc.assert_in_epsilon(-1.1, -1, 0.1)356 end357 end358 def test_assert_includes359 @assertion_count = 2360 @tc.assert_includes [true], true361 end362 def test_assert_includes_triggered363 @assertion_count = 3364 e = @tc.assert_raises Minitest::Assertion do365 @tc.assert_includes [true], false366 end367 expected = "Expected [true] to include false."368 assert_equal expected, e.message369 end370 def test_assert_instance_of371 @tc.assert_instance_of String, "blah"372 end373 def test_assert_instance_of_triggered374 assert_triggered 'Expected "blah" to be an instance of Array, not String.' do375 @tc.assert_instance_of Array, "blah"376 end377 end378 def test_assert_kind_of379 @tc.assert_kind_of String, "blah"380 end381 def test_assert_kind_of_triggered382 assert_triggered 'Expected "blah" to be a kind of Array, not String.' do383 @tc.assert_kind_of Array, "blah"384 end385 end386 def test_assert_match387 @assertion_count = 2388 @tc.assert_match(/\w+/, "blah blah blah")389 end390 def test_assert_match_matchee_to_str391 @assertion_count = 2392 obj = Object.new393 def obj.to_str; "blah" end394 @tc.assert_match "blah", obj395 end396 def test_assert_match_matcher_object397 @assertion_count = 2398 pattern = Object.new399 def pattern.=~ _; true end400 @tc.assert_match pattern, 5401 end402 def test_assert_match_object_triggered403 @assertion_count = 2404 pattern = Object.new405 def pattern.=~ _; false end406 def pattern.inspect; "[Object]" end407 assert_triggered "Expected [Object] to match 5." do408 @tc.assert_match pattern, 5409 end410 end411 def test_assert_match_triggered412 @assertion_count = 2413 assert_triggered 'Expected /\d+/ to match "blah blah blah".' do414 @tc.assert_match(/\d+/, "blah blah blah")415 end416 end417 def test_assert_nil418 @tc.assert_nil nil419 end420 def test_assert_nil_triggered421 assert_triggered "Expected 42 to be nil." do422 @tc.assert_nil 42423 end424 end425 def test_assert_operator426 @tc.assert_operator 2, :>, 1427 end428 def test_assert_operator_bad_object429 bad = Object.new430 def bad.== _; true end431 @tc.assert_operator bad, :equal?, bad432 end433 def test_assert_operator_triggered434 assert_triggered "Expected 2 to be < 1." do435 @tc.assert_operator 2, :<, 1436 end437 end438 def test_assert_output_both439 @assertion_count = 2440 @tc.assert_output "yay", "blah" do441 print "yay"442 $stderr.print "blah"443 end444 end445 def test_assert_output_both_regexps446 @assertion_count = 4447 @tc.assert_output(/y.y/, /bl.h/) do448 print "yay"449 $stderr.print "blah"450 end451 end452 def test_assert_output_err453 @tc.assert_output nil, "blah" do454 $stderr.print "blah"455 end456 end457 def test_assert_output_neither458 @assertion_count = 0459 @tc.assert_output do460 # do nothing461 end462 end463 def test_assert_output_out464 @tc.assert_output "blah" do465 print "blah"466 end467 end468 def test_assert_output_triggered_both469 assert_triggered util_msg("blah", "blah blah", "In stderr") do470 @tc.assert_output "yay", "blah" do471 print "boo"472 $stderr.print "blah blah"473 end474 end475 end476 def test_assert_output_triggered_err477 assert_triggered util_msg("blah", "blah blah", "In stderr") do478 @tc.assert_output nil, "blah" do479 $stderr.print "blah blah"480 end481 end482 end483 def test_assert_output_triggered_out484 assert_triggered util_msg("blah", "blah blah", "In stdout") do485 @tc.assert_output "blah" do486 print "blah blah"487 end488 end489 end490 def test_assert_output_without_block491 assert_triggered "assert_output requires a block to capture output." do492 @tc.assert_output "blah"493 end494 end495 def test_assert_predicate496 @tc.assert_predicate "", :empty?497 end498 def test_assert_predicate_triggered499 assert_triggered 'Expected "blah" to be empty?.' do500 @tc.assert_predicate "blah", :empty?501 end502 end503 def test_assert_raises504 @tc.assert_raises RuntimeError do505 raise "blah"506 end507 end508 def test_assert_raises_default509 @tc.assert_raises do510 raise StandardError, "blah"511 end512 end513 def test_assert_raises_default_triggered514 e = assert_raises Minitest::Assertion do515 @tc.assert_raises do516 raise SomeError, "blah"517 end518 end519 expected = clean <<-EOM.chomp520 [StandardError] exception expected, not521 Class: <SomeError>522 Message: <\"blah\">523 ---Backtrace---524 FILE:LINE:in \`test_assert_raises_default_triggered\'525 ---------------526 EOM527 actual = e.message.gsub(/^.+:\d+/, "FILE:LINE")528 actual.gsub!(/block \(\d+ levels\) in /, "") if RUBY_VERSION >= "1.9.0"529 assert_equal expected, actual530 end531 def test_assert_raises_exit532 @tc.assert_raises SystemExit do533 exit 1534 end535 end536 def test_assert_raises_module537 @tc.assert_raises MyModule do538 raise AnError539 end540 end541 def test_assert_raises_signals542 @tc.assert_raises SignalException do543 raise SignalException, :INT544 end545 end546 ##547 # *sigh* This is quite an odd scenario, but it is from real (albeit548 # ugly) test code in ruby-core:549 # http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=29259550 def test_assert_raises_skip551 @assertion_count = 0552 assert_triggered "skipped", Minitest::Skip do553 @tc.assert_raises ArgumentError do554 begin555 raise "blah"556 rescue557 skip "skipped"558 end559 end560 end561 end562 def test_assert_raises_subclass563 @tc.assert_raises StandardError do564 raise AnError565 end566 end567 def test_assert_raises_subclass_triggered568 e = assert_raises Minitest::Assertion do569 @tc.assert_raises SomeError do570 raise AnError, "some message"571 end572 end573 expected = clean <<-EOM574 [SomeError] exception expected, not575 Class: <AnError>576 Message: <\"some message\">577 ---Backtrace---578 FILE:LINE:in \`test_assert_raises_subclass_triggered\'579 ---------------580 EOM581 actual = e.message.gsub(/^.+:\d+/, "FILE:LINE")582 actual.gsub!(/block \(\d+ levels\) in /, "") if RUBY_VERSION >= "1.9.0"583 assert_equal expected.chomp, actual584 end585 def test_assert_raises_triggered_different586 e = assert_raises Minitest::Assertion do587 @tc.assert_raises RuntimeError do588 raise SyntaxError, "icky"589 end590 end591 expected = clean <<-EOM.chomp592 [RuntimeError] exception expected, not593 Class: <SyntaxError>594 Message: <\"icky\">595 ---Backtrace---596 FILE:LINE:in \`test_assert_raises_triggered_different\'597 ---------------598 EOM599 actual = e.message.gsub(/^.+:\d+/, "FILE:LINE")600 actual.gsub!(/block \(\d+ levels\) in /, "") if RUBY_VERSION >= "1.9.0"601 assert_equal expected, actual602 end603 def test_assert_raises_triggered_different_msg604 e = assert_raises Minitest::Assertion do605 @tc.assert_raises RuntimeError, "XXX" do606 raise SyntaxError, "icky"607 end608 end609 expected = clean <<-EOM610 XXX.611 [RuntimeError] exception expected, not612 Class: <SyntaxError>613 Message: <\"icky\">614 ---Backtrace---615 FILE:LINE:in \`test_assert_raises_triggered_different_msg\'616 ---------------617 EOM618 actual = e.message.gsub(/^.+:\d+/, "FILE:LINE")619 actual.gsub!(/block \(\d+ levels\) in /, "") if RUBY_VERSION >= "1.9.0"620 assert_equal expected.chomp, actual621 end622 def test_assert_raises_triggered_none623 e = assert_raises Minitest::Assertion do624 @tc.assert_raises Minitest::Assertion do625 # do nothing626 end627 end628 expected = "Minitest::Assertion expected but nothing was raised."629 assert_equal expected, e.message630 end631 def test_assert_raises_triggered_none_msg632 e = assert_raises Minitest::Assertion do633 @tc.assert_raises Minitest::Assertion, "XXX" do634 # do nothing635 end636 end637 expected = "XXX.\nMinitest::Assertion expected but nothing was raised."638 assert_equal expected, e.message639 end640 def test_assert_raises_without_block641 assert_triggered "assert_raises requires a block to capture errors." do642 @tc.assert_raises StandardError643 end644 end645 def test_assert_respond_to646 @tc.assert_respond_to "blah", :empty?647 end648 def test_assert_respond_to_triggered649 assert_triggered 'Expected "blah" (String) to respond to #rawr!.' do650 @tc.assert_respond_to "blah", :rawr!651 end652 end653 def test_assert_same654 @assertion_count = 3655 o = "blah"656 @tc.assert_same 1, 1657 @tc.assert_same :blah, :blah658 @tc.assert_same o, o659 end660 def test_assert_same_triggered661 @assertion_count = 2662 assert_triggered "Expected 2 (oid=N) to be the same as 1 (oid=N)." do663 @tc.assert_same 1, 2664 end665 s1 = "blah"666 s2 = "blah"667 assert_triggered 'Expected "blah" (oid=N) to be the same as "blah" (oid=N).' do668 @tc.assert_same s1, s2669 end670 end671 def test_assert_send672 assert_deprecated :assert_send do673 @tc.assert_send [1, :<, 2]674 end675 end676 def test_assert_send_bad677 assert_deprecated :assert_send do678 assert_triggered "Expected 1.>(*[2]) to return true." do679 @tc.assert_send [1, :>, 2]680 end681 end682 end683 def test_assert_silent684 @assertion_count = 2685 @tc.assert_silent do686 # do nothing687 end688 end689 def test_assert_silent_triggered_err690 assert_triggered util_msg("", "blah blah", "In stderr") do691 @tc.assert_silent do692 $stderr.print "blah blah"693 end694 end695 end696 def test_assert_silent_triggered_out697 @assertion_count = 2698 assert_triggered util_msg("", "blah blah", "In stdout") do699 @tc.assert_silent do700 print "blah blah"701 end702 end703 end704 def test_assert_throws705 @tc.assert_throws :blah do706 throw :blah707 end708 end709 def test_assert_throws_argument_exception710 @tc.assert_raises ArgumentError do711 @tc.assert_throws :blah do712 raise ArgumentError713 end714 end715 end716 def test_assert_throws_different717 assert_triggered "Expected :blah to have been thrown, not :not_blah." do718 @tc.assert_throws :blah do719 throw :not_blah720 end721 end722 end723 def test_assert_throws_name_error724 @tc.assert_raises NameError do725 @tc.assert_throws :blah do726 raise NameError727 end728 end729 end730 def test_assert_throws_unthrown731 assert_triggered "Expected :blah to have been thrown." do732 @tc.assert_throws :blah do733 # do nothing734 end735 end736 end737 def test_capture_io738 @assertion_count = 0739 non_verbose do740 out, err = capture_io do741 puts "hi"742 $stderr.puts "bye!"743 end744 assert_equal "hi\n", out745 assert_equal "bye!\n", err746 end747 end748 def test_capture_subprocess_io749 @assertion_count = 0750 non_verbose do751 out, err = capture_subprocess_io do752 system("echo hi")753 system("echo bye! 1>&2")754 end755 assert_equal "hi\n", out756 assert_equal "bye!", err.strip757 end758 end759 def test_class_asserts_match_refutes760 @assertion_count = 0761 methods = Minitest::Assertions.public_instance_methods762 methods.map!(&:to_s) if Symbol === methods.first763 # These don't have corresponding refutes _on purpose_. They're764 # useless and will never be added, so don't bother.765 ignores = %w[assert_output assert_raises assert_send766 assert_silent assert_throws assert_mock]767 # These are test/unit methods. I'm not actually sure why they're still here768 ignores += %w[assert_no_match assert_not_equal assert_not_nil769 assert_not_same assert_nothing_raised770 assert_nothing_thrown assert_raise]771 asserts = methods.grep(/^assert/).sort - ignores772 refutes = methods.grep(/^refute/).sort - ignores773 assert_empty refutes.map { |n| n.sub(/^refute/, "assert") } - asserts774 assert_empty asserts.map { |n| n.sub(/^assert/, "refute") } - refutes775 end776 def test_delta_consistency777 @assertion_count = 2778 @tc.assert_in_delta 0, 1, 1779 assert_triggered "Expected |0 - 1| (1) to not be <= 1." do780 @tc.refute_in_delta 0, 1, 1781 end782 end783 def test_epsilon_consistency784 @assertion_count = 2785 @tc.assert_in_epsilon 1.0, 1.001786 msg = "Expected |1.0 - 1.001| (0.000999xxx) to not be <= 0.001."787 assert_triggered msg do788 @tc.refute_in_epsilon 1.0, 1.001789 end790 end791 def test_flunk792 assert_triggered "Epic Fail!" do793 @tc.flunk794 end795 end796 def test_flunk_message797 assert_triggered @zomg do798 @tc.flunk @zomg799 end800 end801 def test_pass802 @tc.pass803 end804 def test_refute805 @assertion_count = 2806 @tc.assert_equal false, @tc.refute(false), "returns false on success"807 end808 def test_refute_empty809 @assertion_count = 2810 @tc.refute_empty [1]811 end812 def test_refute_empty_triggered813 @assertion_count = 2814 assert_triggered "Expected [] to not be empty." do815 @tc.refute_empty []816 end817 end818 def test_refute_equal819 @tc.refute_equal "blah", "yay"820 end821 def test_refute_equal_triggered822 assert_triggered 'Expected "blah" to not be equal to "blah".' do823 @tc.refute_equal "blah", "blah"824 end825 end826 def test_refute_in_delta827 @tc.refute_in_delta 0.0, 1.0 / 1000, 0.000001828 end829 def test_refute_in_delta_triggered830 x = maglev? ? "0.100000xxx" : "0.1"831 assert_triggered "Expected |0.0 - 0.001| (0.001) to not be <= #{x}." do832 @tc.refute_in_delta 0.0, 1.0 / 1000, 0.1833 end834 end835 def test_refute_in_epsilon836 @tc.refute_in_epsilon 10_000, 9990-1837 end838 def test_refute_in_epsilon_triggered839 assert_triggered "Expected |10000 - 9990| (10) to not be <= 10.0." do840 @tc.refute_in_epsilon 10_000, 9990841 flunk842 end843 end844 def test_refute_includes845 @assertion_count = 2846 @tc.refute_includes [true], false847 end848 def test_refute_includes_triggered849 @assertion_count = 3850 e = @tc.assert_raises Minitest::Assertion do851 @tc.refute_includes [true], true852 end853 expected = "Expected [true] to not include true."854 assert_equal expected, e.message855 end856 def test_refute_instance_of857 @tc.refute_instance_of Array, "blah"858 end859 def test_refute_instance_of_triggered860 assert_triggered 'Expected "blah" to not be an instance of String.' do861 @tc.refute_instance_of String, "blah"862 end863 end864 def test_refute_kind_of865 @tc.refute_kind_of Array, "blah"866 end867 def test_refute_kind_of_triggered868 assert_triggered 'Expected "blah" to not be a kind of String.' do869 @tc.refute_kind_of String, "blah"870 end871 end872 def test_refute_match873 @assertion_count = 2874 @tc.refute_match(/\d+/, "blah blah blah")875 end876 def test_refute_match_matcher_object877 @assertion_count = 2878 pattern = Object.new879 def pattern.=~ _; false end880 @tc.refute_match pattern, 5881 end882 def test_refute_match_object_triggered883 @assertion_count = 2884 pattern = Object.new885 def pattern.=~ _; true end886 def pattern.inspect; "[Object]" end887 assert_triggered "Expected [Object] to not match 5." do888 @tc.refute_match pattern, 5889 end890 end891 def test_refute_match_triggered892 @assertion_count = 2893 assert_triggered 'Expected /\w+/ to not match "blah blah blah".' do894 @tc.refute_match(/\w+/, "blah blah blah")895 end896 end897 def test_refute_nil898 @tc.refute_nil 42899 end900 def test_refute_nil_triggered901 assert_triggered "Expected nil to not be nil." do902 @tc.refute_nil nil903 end904 end905 def test_refute_operator906 @tc.refute_operator 2, :<, 1907 end908 def test_refute_operator_bad_object909 bad = Object.new910 def bad.== _; true end911 @tc.refute_operator true, :equal?, bad912 end913 def test_refute_operator_triggered914 assert_triggered "Expected 2 to not be > 1." do915 @tc.refute_operator 2, :>, 1916 end917 end918 def test_refute_predicate919 @tc.refute_predicate "42", :empty?920 end921 def test_refute_predicate_triggered922 assert_triggered 'Expected "" to not be empty?.' do923 @tc.refute_predicate "", :empty?924 end925 end926 def test_refute_respond_to927 @tc.refute_respond_to "blah", :rawr!928 end929 def test_refute_respond_to_triggered930 assert_triggered 'Expected "blah" to not respond to empty?.' do931 @tc.refute_respond_to "blah", :empty?932 end933 end934 def test_refute_same935 @tc.refute_same 1, 2936 end937 def test_refute_same_triggered938 assert_triggered "Expected 1 (oid=N) to not be the same as 1 (oid=N)." do939 @tc.refute_same 1, 1940 end941 end942 def test_skip943 @assertion_count = 0944 assert_triggered "haha!", Minitest::Skip do945 @tc.skip "haha!"946 end947 end948 def util_msg exp, act, msg = nil949 s = "Expected: #{exp.inspect}\n Actual: #{act.inspect}"950 s = "#{msg}.\n#{s}" if msg951 s952 end953 def without_diff954 old_diff = Minitest::Assertions.diff955 Minitest::Assertions.diff = nil956 yield957 ensure958 Minitest::Assertions.diff = old_diff959 end960end961class TestMinitestAssertionHelpers < Minitest::Test962 def assert_mu_pp exp, input, raw = false963 act = mu_pp input964 if String === input && !raw then965 assert_equal "\"#{exp}\"", act966 else967 assert_equal exp, act...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Minitest_ruby automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful