minitest 6.0.2 → 6.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/History.rdoc +12 -0
- data/lib/minitest/assertions.rb +9 -1
- data/lib/minitest/server_plugin.rb +1 -1
- data/lib/minitest.rb +1 -1
- data/test/minitest/test_minitest_assertions.rb +66 -0
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3cef62fc91f5ae9128c4ae7c9b91645b26776921ae38e8cfdec016ebcf211055
|
|
4
|
+
data.tar.gz: 0e690cc45bba5de6d08add5fd0ba898e7b0eaa9dc48ce4f4e8b2042e5989e921
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 92c632765b48431ea163a93dc4ae80440c38c6964cbbfccba861e32ab4f7530ed5651d6d3adcbfa45f126eaad9df7b09b3744229c05de529ff76770965b1c871
|
|
7
|
+
data.tar.gz: 8598ca82c49794072035669c2cc8e9b586c18187d08d1ab53c1d503c09bfdadf58af05f70c02437a6e93df4dc14050b59ff16cf020641ca7684dadd900eaa3ad
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/History.rdoc
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
=== 6.0.4 / 2026-04-14
|
|
2
|
+
|
|
3
|
+
* 1 bug fix:
|
|
4
|
+
|
|
5
|
+
* Fixed refute_predicate to call assert_respond_to w/ include_all:true like assert_predicate does. (jparker)
|
|
6
|
+
|
|
7
|
+
=== 6.0.3 / 2026-03-31
|
|
8
|
+
|
|
9
|
+
* 1 bug fix:
|
|
10
|
+
|
|
11
|
+
* assert_same(nil, value) no longer allowed. Use assert_nil to be explicit. (paddor)
|
|
12
|
+
|
|
1
13
|
=== 6.0.2 / 2026-02-23
|
|
2
14
|
|
|
3
15
|
* 7 bug fixes:
|
data/lib/minitest/assertions.rb
CHANGED
|
@@ -381,6 +381,8 @@ module Minitest
|
|
|
381
381
|
assert o1.__send__(op), msg
|
|
382
382
|
end
|
|
383
383
|
|
|
384
|
+
NO_RE_MSG = "class or module required for rescue clause. Got %p"
|
|
385
|
+
|
|
384
386
|
##
|
|
385
387
|
# Fails unless the block raises one of +exp+. Returns the
|
|
386
388
|
# exception matched so you can check the message, attributes, etc.
|
|
@@ -410,6 +412,9 @@ module Minitest
|
|
|
410
412
|
msg = "#{exp.pop}.\n" if String === exp.last
|
|
411
413
|
exp << StandardError if exp.empty?
|
|
412
414
|
|
|
415
|
+
# TODO: remove this if https://bugs.ruby-lang.org/issues/22007 gets fixed
|
|
416
|
+
raise TypeError, NO_RE_MSG % [exp] unless exp.all? Module
|
|
417
|
+
|
|
413
418
|
begin
|
|
414
419
|
yield
|
|
415
420
|
rescue *exp => e
|
|
@@ -448,6 +453,9 @@ module Minitest
|
|
|
448
453
|
data = [mu_pp(act), act.object_id, mu_pp(exp), exp.object_id]
|
|
449
454
|
"Expected %s (oid=%d) to be the same as %s (oid=%d)" % data
|
|
450
455
|
}
|
|
456
|
+
|
|
457
|
+
refute_nil exp, message { "Use assert_nil if expecting nil" } if exp.nil? # don't count
|
|
458
|
+
|
|
451
459
|
assert exp.equal?(act), msg
|
|
452
460
|
end
|
|
453
461
|
|
|
@@ -759,7 +767,7 @@ module Minitest
|
|
|
759
767
|
# str.wont_be :empty?
|
|
760
768
|
|
|
761
769
|
def refute_predicate o1, op, msg = nil
|
|
762
|
-
assert_respond_to o1, op
|
|
770
|
+
assert_respond_to o1, op, include_all:true
|
|
763
771
|
msg = message(msg) { "Expected #{mu_pp o1} to not be #{op}" }
|
|
764
772
|
refute o1.__send__(op), msg
|
|
765
773
|
end
|
data/lib/minitest.rb
CHANGED
|
@@ -810,6 +810,66 @@ class TestMinitestAssertions < Minitest::Test
|
|
|
810
810
|
end
|
|
811
811
|
end
|
|
812
812
|
|
|
813
|
+
def test_assert_raises__string_msg
|
|
814
|
+
e = assert_raises Minitest::Assertion do
|
|
815
|
+
@tc.assert_raises RuntimeError, "assertion message" do
|
|
816
|
+
raise SomeError, "blah"
|
|
817
|
+
end
|
|
818
|
+
end
|
|
819
|
+
|
|
820
|
+
expected = <<~EOM.chomp
|
|
821
|
+
assertion message.
|
|
822
|
+
[RuntimeError] exception expected, not
|
|
823
|
+
Class: <SomeError>
|
|
824
|
+
Message: <"blah">
|
|
825
|
+
---Backtrace---
|
|
826
|
+
FILE:LINE:in 'block in test_assert_raises__string_msg'
|
|
827
|
+
---------------
|
|
828
|
+
EOM
|
|
829
|
+
|
|
830
|
+
actual = e.message.gsub(/^.+:\d+/, "FILE:LINE")
|
|
831
|
+
actual.gsub! RE_LEVELS, "" unless jruby?
|
|
832
|
+
actual.gsub!(/[`']block in (?:TestMinitestAssertions#)?/, "'block in ")
|
|
833
|
+
|
|
834
|
+
assert_equal expected, actual
|
|
835
|
+
end
|
|
836
|
+
|
|
837
|
+
def test_assert_raises__regexp_err
|
|
838
|
+
@assertion_count = 0
|
|
839
|
+
|
|
840
|
+
e = assert_raises TypeError do
|
|
841
|
+
@tc.assert_raises RuntimeError, %r%does not work%, "assertion message" do
|
|
842
|
+
raise SomeError, "blah"
|
|
843
|
+
end
|
|
844
|
+
end
|
|
845
|
+
|
|
846
|
+
expected = <<~EOM.chomp
|
|
847
|
+
class or module required for rescue clause. Got [RuntimeError, /does not work/]
|
|
848
|
+
EOM
|
|
849
|
+
|
|
850
|
+
actual = e.message
|
|
851
|
+
|
|
852
|
+
assert_equal expected, actual
|
|
853
|
+
end
|
|
854
|
+
|
|
855
|
+
def test_assert_raises__regexp_err_default
|
|
856
|
+
@assertion_count = 0
|
|
857
|
+
|
|
858
|
+
e = assert_raises TypeError do
|
|
859
|
+
@tc.assert_raises %r%does not work% do
|
|
860
|
+
raise "blah"
|
|
861
|
+
end
|
|
862
|
+
end
|
|
863
|
+
|
|
864
|
+
expected = <<~EOM.chomp
|
|
865
|
+
class or module required for rescue clause. Got [/does not work/]
|
|
866
|
+
EOM
|
|
867
|
+
|
|
868
|
+
actual = e.message
|
|
869
|
+
|
|
870
|
+
assert_equal expected, actual
|
|
871
|
+
end
|
|
872
|
+
|
|
813
873
|
def test_assert_raises_subclass
|
|
814
874
|
@tc.assert_raises StandardError do
|
|
815
875
|
raise AnError
|
|
@@ -960,6 +1020,12 @@ class TestMinitestAssertions < Minitest::Test
|
|
|
960
1020
|
end
|
|
961
1021
|
end
|
|
962
1022
|
|
|
1023
|
+
def test_assert_same__does_not_allow_lhs_nil
|
|
1024
|
+
assert_triggered(/Use assert_nil if expecting nil/) do
|
|
1025
|
+
@tc.assert_same nil, nil
|
|
1026
|
+
end
|
|
1027
|
+
end
|
|
1028
|
+
|
|
963
1029
|
def test_assert_silent
|
|
964
1030
|
@assertion_count = 2
|
|
965
1031
|
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
|
Binary file
|