minitest-ok 0.3.2 → 0.3.3
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
- data/README.md +7 -2
- data/lib/minitest/ok.rb +11 -10
- data/test/minitest/ok_test.rb +6 -6
- data/test/test_helper.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24fede07b5dfd3ba6329ea3f9eec222be7bbd7448cec333211193f249d182acf
|
4
|
+
data.tar.gz: d6fce3aa578e6ca8abbb828216c52c2316f9b2259693930ccd1af93bbe93e701
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1654cdcdc41ab3a0e8c5947e7566ca2906ef23604c823791d053c669071ff62a03b5c9c6016d88908a0d41035bc783f53b62a2c83f6a8ae57b247c1f50e3936b
|
7
|
+
data.tar.gz: 36b1f25a7fad593a38978931d3dd76e96c1e5279f1262dc508a0f087496ab09ecca848a45769d7585a22731262b55bb98b39224daa269e9c763f5812fe71496a
|
data/README.md
CHANGED
@@ -85,8 +85,8 @@ describe 'Minitest::Ok' do
|
|
85
85
|
ok {123}.truthy? # similar to assert 123
|
86
86
|
ok {0}.truthy? # similar to assert 0
|
87
87
|
ok {""}.truthy? # similar to assert ""
|
88
|
-
ok {false}.
|
89
|
-
ok {nil}.
|
88
|
+
ok {false}.falsy? # similar to refute false
|
89
|
+
ok {nil}.falsy? # similar to refute nil
|
90
90
|
|
91
91
|
## predicates
|
92
92
|
ok {""}.empty? # same as assert_empty? ""
|
@@ -138,6 +138,11 @@ $License: MIT License $
|
|
138
138
|
|
139
139
|
## History
|
140
140
|
|
141
|
+
### 2021-08-02: Release 0.3.3
|
142
|
+
|
143
|
+
* [bugfix] rename 'ok {}.falthy?' to 'ok {}.falsy?'.
|
144
|
+
|
145
|
+
|
141
146
|
### 2021-01-17: Release 0.3.2
|
142
147
|
|
143
148
|
* [bugfix] fix to work on Ruby 3.
|
data/lib/minitest/ok.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
|
3
3
|
###
|
4
|
-
### $Release: 0.3.
|
4
|
+
### $Release: 0.3.3 $
|
5
5
|
### $Copyright: copyright(c) 2015-2018 kuwata-lab.com all rights reserved $
|
6
6
|
### $License: MIT License $
|
7
7
|
###
|
@@ -34,7 +34,7 @@ module Minitest
|
|
34
34
|
## ok {1..9}.include?(5) # same as assert_includes 5, 1..9
|
35
35
|
## ok {1..9}.NOT.include?(0) # same as refute_includes 0, 1..9
|
36
36
|
## ok {""}.truthy? # same as assert true, !!""
|
37
|
-
## ok {nil}.
|
37
|
+
## ok {nil}.falsy? # same as assert false, !!""
|
38
38
|
##
|
39
39
|
## ex = ok { proc { 1 / 0 } }.raise?(ZeroDivisionError, "divided by 0")
|
40
40
|
## p ex #=> #<ZeroDivisionError: divided by 0>
|
@@ -59,7 +59,7 @@ module Minitest
|
|
59
59
|
|
60
60
|
module Ok
|
61
61
|
|
62
|
-
VERSION = '$Release: 0.3.
|
62
|
+
VERSION = '$Release: 0.3.3 $'.split()[1]
|
63
63
|
|
64
64
|
|
65
65
|
class Msg < Proc # :nodoc:
|
@@ -629,14 +629,14 @@ module Minitest
|
|
629
629
|
##
|
630
630
|
## Tests whether actual is false or nil.
|
631
631
|
##
|
632
|
-
## ok {nil}.
|
633
|
-
## ok {false}.
|
634
|
-
## ok {true}.
|
635
|
-
## ok {0}.
|
636
|
-
## ok {""}.
|
637
|
-
## ok {[]}.
|
632
|
+
## ok {nil}.falsy? # Pass
|
633
|
+
## ok {false}.falsy? # Pass
|
634
|
+
## ok {true}.falsy? # Fail
|
635
|
+
## ok {0}.falsy? # Fail
|
636
|
+
## ok {""}.falsy? # Fail
|
637
|
+
## ok {[]}.falsy? # Fail
|
638
638
|
##
|
639
|
-
def
|
639
|
+
def falsy?
|
640
640
|
_mark_as_tested()
|
641
641
|
unless @not
|
642
642
|
@context.refute @actual, Msg.new { "Expected (!! #{@actual.inspect}) == false, but not." }
|
@@ -648,6 +648,7 @@ module Minitest
|
|
648
648
|
ex.backtrace.delete_if {|bt| bt.start_with?(__FILE__) }
|
649
649
|
raise
|
650
650
|
end
|
651
|
+
alias falthy? falsy?
|
651
652
|
|
652
653
|
##
|
653
654
|
## Tests attribute value.
|
data/test/minitest/ok_test.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
|
3
3
|
###
|
4
|
-
### $Release: 0.3.
|
4
|
+
### $Release: 0.3.3 $
|
5
5
|
### $Copyright: copyright(c) 2015-2018 kuwata-lab.com all rights reserved $
|
6
6
|
### $License: MIT License $
|
7
7
|
###
|
@@ -736,18 +736,18 @@ describe Minitest::Ok::AssertionObject do
|
|
736
736
|
end
|
737
737
|
|
738
738
|
|
739
|
-
describe '#
|
739
|
+
describe '#falsy?' do
|
740
740
|
|
741
741
|
it "calles refute()." do
|
742
|
-
should_not_raise { ok {nil}.
|
743
|
-
ex = should_raise { ok {123}.
|
742
|
+
should_not_raise { ok {nil}.falsy? }
|
743
|
+
ex = should_raise { ok {123}.falsy? }
|
744
744
|
msg = 'Expected (!! 123) == false, but not.'
|
745
745
|
assert_equal msg, ex.message
|
746
746
|
end
|
747
747
|
|
748
748
|
it "calles assert() after NOT() called." do
|
749
|
-
should_not_raise { ok {123}.NOT.
|
750
|
-
ex = should_raise { ok {nil}.NOT.
|
749
|
+
should_not_raise { ok {123}.NOT.falsy? }
|
750
|
+
ex = should_raise { ok {nil}.NOT.falsy? }
|
751
751
|
msg = 'Expected (!! nil) == true, but not.'
|
752
752
|
assert_equal msg, ex.message
|
753
753
|
end
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-ok
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- makoto kuwata
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01
|
11
|
+
date: 2021-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|