test-unit-power_assert 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 781d13728d229c93a474c7d8b01c18f11fd7ba51
4
- data.tar.gz: 3447b6f5c7b5fea606648e38ac2d1ce0ccb6adf4
3
+ metadata.gz: d8e16b7c9e80dfc75395dea5f7458eea9686b888
4
+ data.tar.gz: efe8b62dbc50c8c6ccb53253044bc07b20990a1f
5
5
  SHA512:
6
- metadata.gz: a8cfe5316ca44d2ddd6097aaf561b911c700599fe14b7e3e0f14666ce37871d2aa8d7a85fff0a82f12b8fecb5f730536957a3f37dee42ef580d5675e9acaa7cc
7
- data.tar.gz: fbff2784be4fc583556a2e6172740b92c4235772039d892163034df19b34662c22085b619e576ad40e3311aac036852f7d80f5c3fdb286b8b021f060fcff23cc
6
+ metadata.gz: 3490cc805cfcfb4cdf700e3fec724d3d6601ce05fd37ad9ec5c58f5832ba8992137396d4665fb3f70de6b224c89eb98cf2bbf9b204b577fb3f0b32650cda3a86
7
+ data.tar.gz: 63bc36c8c5299f2b19468d6d623abadcfc3f6cae446d1f493a96127db8475b582ec6a0afc13c4a401a7f6310d82d87d0a48e1c328d7194b51e57ad7c53934959
data/.travis.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 2.0.0
4
- - 2.1.1
4
+ - 2.1.2
5
5
  - ruby-head
data/README.rdoc CHANGED
@@ -20,7 +20,7 @@ or
20
20
  require 'test/unit/power_assert'
21
21
  class MyTest < Test::Unit::TestCase
22
22
  def test_failed
23
- power_assert do
23
+ assert do
24
24
  "0".class == "3".to_i.times.map {|i| i + 1 }.class
25
25
  end
26
26
  end
@@ -31,13 +31,15 @@ Note: It is recommended to require test/unit/power_assert before _loading_ test
31
31
  === Result
32
32
  Failure:
33
33
 
34
- "0".class == "3".to_i.times.map {|i| i + 1 }.class
35
- | | | | |
36
- | | | | Array
37
- | | | [1, 2, 3]
38
- | | #<Enumerator: 3:times>
39
- | 3
40
- String
34
+ Failure:
35
+ "0".class == "3".to_i.times.map {|i| i + 1 }.class
36
+ | | | | | |
37
+ | | | | | Array
38
+ | | | | [1, 2, 3]
39
+ | | | #<Enumerator: 3:times>
40
+ | | 3
41
+ | false
42
+ String
41
43
  test_failed(MyTest)
42
44
 
43
45
  == Travis Build Status {<img src="https://secure.travis-ci.org/k-tsj/test-unit-power_assert.png"/>}[http://travis-ci.org/k-tsj/test-unit-power_assert]
@@ -7,24 +7,24 @@ require 'test/unit/power_assert/version'
7
7
  require 'test/unit'
8
8
  require 'power_assert'
9
9
 
10
- module Test::Unit
11
- module PowerAssert
12
- module Assertions
13
- def power_assert(&blk)
14
- ::PowerAssert.start(blk, assertion_method: __method__) do |pa|
15
- prc = pa.message_proc
16
- class << prc
17
- alias to_s call
18
- end
19
- assert_block(prc) do
20
- pa.yield
21
- end
10
+ module Test::Unit::Assertions
11
+ alias __assert_orig__ assert
12
+
13
+ def assert(boolean = nil, message = nil, &blk)
14
+ if blk
15
+ ::PowerAssert.start(blk, assertion_method: __callee__) do |pa|
16
+ prc = pa.message_proc
17
+ class << prc
18
+ alias to_s call
19
+ end
20
+ assert_block(prc) do
21
+ pa.yield
22
22
  end
23
23
  end
24
+ else
25
+ __assert_orig__(boolean, message)
24
26
  end
25
27
  end
26
28
 
27
- class TestCase
28
- include PowerAssert::Assertions
29
- end
29
+ alias power_assert assert
30
30
  end
@@ -1,7 +1,7 @@
1
1
  module Test
2
2
  module Unit
3
3
  module PowerAssert
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
6
6
  end
7
7
  end
@@ -3,12 +3,23 @@ require 'test/unit/power_assert'
3
3
 
4
4
  class TestPowerAssert < Test::Unit::TestCase
5
5
  def test_successful
6
+ assert do
7
+ true
8
+ end
9
+ assert(true)
6
10
  power_assert do
7
11
  true
8
12
  end
9
13
  end
10
14
 
11
- def test_failed
15
+ def test_assert_failed
16
+ return unless ENV['DEMO']
17
+ assert do
18
+ "0".class == "3".to_i.times.map {|i| i + 1 }.class
19
+ end
20
+ end
21
+
22
+ def test_power_assert_failed
12
23
  return unless ENV['DEMO']
13
24
  power_assert do
14
25
  "0".class == "3".to_i.times.map {|i| i + 1 }.class
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test-unit-power_assert
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kazuki Tsujimoto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-31 00:00:00.000000000 Z
11
+ date: 2014-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-unit