minitest-power_assert 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/minitest/power_assert.rb +21 -7
- data/lib/minitest/power_assert/version.rb +1 -1
- data/test/test_power_assert.rb +4 -7
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f97cb07ef6d3f4d55c59c8e29e69a845f70cc8e
|
4
|
+
data.tar.gz: 4e9cb4c6e7a50d1da1e8e24f4a7ae6bc4549a344
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4f278ececcb7dec40dcc70a14466ec468387cbc47cc548be6c201ae0d63a1b3ff303b7321900805db40e7f971027163ad2691dfd4833ffca4da7bb291965e4c
|
7
|
+
data.tar.gz: 843e37951d4e60a9c79019b1163ae3377c6fdf413e40f25ab0a5bfad7b6f0a53df4ef0bbc485c4fc98fa1262892726a7a3e664c7fa97f5526bd806ba479c5375
|
@@ -6,20 +6,34 @@ require 'power_assert'
|
|
6
6
|
module Minitest
|
7
7
|
module PowerAssert
|
8
8
|
module Assertions
|
9
|
-
def assert
|
9
|
+
def assert(test = nil, msg = nil)
|
10
10
|
if block_given?
|
11
|
-
::PowerAssert.start(
|
12
|
-
|
13
|
-
super pa.yield, "\n#{pa.message_proc.call}"
|
11
|
+
::PowerAssert.start(Proc.new, assertion_method: __method__) do |pa|
|
12
|
+
super pa.yield, pa.extend(ContextExtension)
|
14
13
|
end
|
15
14
|
else
|
16
|
-
super
|
15
|
+
super
|
17
16
|
end
|
18
17
|
end
|
19
18
|
|
20
|
-
def refute
|
21
|
-
|
19
|
+
def refute(test = nil, msg = nil)
|
20
|
+
if block_given?
|
21
|
+
::PowerAssert.start(Proc.new, assertion_method: __method__) do |pa|
|
22
|
+
super pa.yield, pa.extend(ContextExtension)
|
23
|
+
end
|
24
|
+
else
|
25
|
+
super
|
26
|
+
end
|
22
27
|
end
|
28
|
+
|
29
|
+
|
30
|
+
module ContextExtension
|
31
|
+
def to_s
|
32
|
+
message
|
33
|
+
end
|
34
|
+
end
|
35
|
+
private_constant :ContextExtension
|
36
|
+
|
23
37
|
end
|
24
38
|
end
|
25
39
|
|
data/test/test_power_assert.rb
CHANGED
@@ -31,12 +31,9 @@ class TestPowerAssert < Minitest::Test
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def test_power_refute_failed
|
34
|
-
refute { "0".
|
34
|
+
refute { "0".class == String }
|
35
35
|
rescue Minitest::Assertion => e
|
36
|
-
assert_match(/
|
37
|
-
assert_match(/\[1, 2, 3\]/, e.message)
|
38
|
-
assert_match(/#<Enumerator: 3:times>/, e.message)
|
39
|
-
assert_match(/#<Enumerator: \"0\":each_char>"/, e.message)
|
36
|
+
assert_match(/String/, e.message)
|
40
37
|
end
|
41
38
|
|
42
39
|
def test_refute
|
@@ -44,8 +41,8 @@ class TestPowerAssert < Minitest::Test
|
|
44
41
|
end
|
45
42
|
|
46
43
|
def test_refute_failed
|
47
|
-
refute "0".
|
44
|
+
refute "0".class == String
|
48
45
|
rescue Minitest::Assertion => e
|
49
|
-
assert_match(/Failed
|
46
|
+
assert_match(/Failed refutation, no message given/, e.message)
|
50
47
|
end
|
51
48
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-power_assert
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SHIBATA Hiroshi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -111,3 +111,4 @@ specification_version: 4
|
|
111
111
|
summary: Power Assert for Minitest.
|
112
112
|
test_files:
|
113
113
|
- test/test_power_assert.rb
|
114
|
+
has_rdoc:
|