minitest-power_assert 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +8 -0
- data/README.md +2 -0
- data/Rakefile +5 -0
- data/lib/minitest-power_assert.rb +1 -0
- data/lib/minitest/power_assert.rb +6 -6
- data/lib/minitest/power_assert/version.rb +1 -1
- data/test/test_power_assert.rb +20 -8
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a8358ee9f623d218c7d002d48e8eed812acdfdd
|
4
|
+
data.tar.gz: 738e754bdc3cc5c62d449883ea06d497ec74bf79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 069a5de757c247e7bc533532b9498d827669b11b753385dd7ca416ef35299cdefd311199d322772b1b77d2fc3ba7a5d2876ed495321800c70c45d1d3ba1cfa09
|
7
|
+
data.tar.gz: 65ca2d23349a2f2aca7a8da6ba662cfdbfe7ace06dab6d5c52e9f94726277c1e14d831a6915a05fd7ac402335ef6831c487d668f39a8a09419e07b5646b597ac
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Minitest::PowerAssert
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/minitest-power_assert.png)](https://rubygems.org/gems/minitest-power_assert) [![Build Status](https://travis-ci.org/hsbt/minitest-power_assert.png)](https://travis-ci.org/hsbt/minitest-power_assert)
|
4
|
+
|
3
5
|
Power Assert for Minitest.
|
4
6
|
|
5
7
|
Basic concept is [test-unit-power_assert](https://github.com/k-tsj/test-unit-power_assert).
|
data/Rakefile
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
require 'minitest/power_assert'
|
@@ -6,13 +6,13 @@ require 'power_assert'
|
|
6
6
|
module Minitest
|
7
7
|
module PowerAssert
|
8
8
|
module Assertions
|
9
|
-
def
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
alias to_s call
|
9
|
+
def assert test = nil, msg = nil, &blk
|
10
|
+
if block_given?
|
11
|
+
::PowerAssert.start(blk, assertion_method: __method__) do |pa|
|
12
|
+
super pa.yield, pa.message_proc
|
14
13
|
end
|
15
|
-
|
14
|
+
else
|
15
|
+
super test, msg
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
data/test/test_power_assert.rb
CHANGED
@@ -1,16 +1,28 @@
|
|
1
1
|
require "minitest/autorun"
|
2
2
|
require 'minitest/power_assert'
|
3
|
+
require 'stringio'
|
3
4
|
|
4
5
|
class TestPowerAssert < Minitest::Test
|
5
|
-
def
|
6
|
-
|
7
|
-
true
|
8
|
-
end
|
6
|
+
def test_power_assert
|
7
|
+
assert { true }
|
9
8
|
end
|
10
9
|
|
11
|
-
def
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
def test_power_assert_failed
|
11
|
+
assert { "0".class == "3".to_i.times.map {|i| i + 1 }.class }
|
12
|
+
rescue Minitest::Assertion => e
|
13
|
+
assert_match(/Array/, e.message)
|
14
|
+
assert_match(/\[1, 2, 3\]/, e.message)
|
15
|
+
assert_match(/#<Enumerator: 3:times>/, e.message)
|
16
|
+
assert_match(/String/, e.message)
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_assert
|
20
|
+
assert true
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_assert_failed
|
24
|
+
assert "0".class == "3".to_i.times.map {|i| i + 1 }.class
|
25
|
+
rescue Minitest::Assertion => e
|
26
|
+
assert_match(/Failed assertion, no message given./, e.message)
|
15
27
|
end
|
16
28
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-power_assert
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SHIBATA Hiroshi
|
@@ -74,11 +74,13 @@ extensions: []
|
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
76
|
- ".gitignore"
|
77
|
+
- ".travis.yml"
|
77
78
|
- BSDL
|
78
79
|
- COPYING
|
79
80
|
- Gemfile
|
80
81
|
- README.md
|
81
82
|
- Rakefile
|
83
|
+
- lib/minitest-power_assert.rb
|
82
84
|
- lib/minitest/power_assert.rb
|
83
85
|
- lib/minitest/power_assert/version.rb
|
84
86
|
- minitest-power_assert.gemspec
|