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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 110bedcb87702c276a228936ecffbf361b8c2dd1
4
- data.tar.gz: ae61d0ae9c4afc604a44d5fe4a895a72b8617588
3
+ metadata.gz: 1f97cb07ef6d3f4d55c59c8e29e69a845f70cc8e
4
+ data.tar.gz: 4e9cb4c6e7a50d1da1e8e24f4a7ae6bc4549a344
5
5
  SHA512:
6
- metadata.gz: ad22686c69c645667da669bce0724ceac289421e557eb8be67748ccd5ef7cb5261c5784e345aa99fb1958ddf280c76d0e65b09e1d11b98a6e338cab67b4cc5b8
7
- data.tar.gz: ab35bf6a159f368ab5fc724e25d0e728eba9716e81d84873198c493ca3550997cbe84eff2ddea46741e4a9f4f1e0318636a260639d2300686c7c2aa1931eeb04
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 test = nil, msg = nil, &blk
9
+ def assert(test = nil, msg = nil)
10
10
  if block_given?
11
- ::PowerAssert.start(blk, assertion_method: __method__) do |pa|
12
- # XXX workaround to break inline format with minitest-reporters.
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 test, msg
15
+ super
17
16
  end
18
17
  end
19
18
 
20
- def refute *args
21
- assert args
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
 
@@ -1,5 +1,5 @@
1
1
  module Minitest
2
2
  module PowerAssert
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
@@ -31,12 +31,9 @@ class TestPowerAssert < Minitest::Test
31
31
  end
32
32
 
33
33
  def test_power_refute_failed
34
- refute { "0".each_char.class == "3".to_i.times.map {|i| i + 1 }.class }
34
+ refute { "0".class == String }
35
35
  rescue Minitest::Assertion => e
36
- assert_match(/Array/, e.message)
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".each_char.class == "3".to_i.times.map {|i| i + 1 }.class
44
+ refute "0".class == String
48
45
  rescue Minitest::Assertion => e
49
- assert_match(/Failed assertion, no message given./, e.message)
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.1.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-03-19 00:00:00.000000000 Z
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: