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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8b3914f602e535fec077f7b484b71fa9e880cec2
4
- data.tar.gz: f716c84bddca61f1df5a39459279dd20a4c49fb2
3
+ metadata.gz: 1a8358ee9f623d218c7d002d48e8eed812acdfdd
4
+ data.tar.gz: 738e754bdc3cc5c62d449883ea06d497ec74bf79
5
5
  SHA512:
6
- metadata.gz: 6e37deea7fe95ca7808070a0c5d7a78e508501b21354f088708548f7cd53e278a207dad1e9f5ac6a9c922a4b28bff97a42e9b503073357b1420a04f6b68a83ab
7
- data.tar.gz: 36742a8a70f531c38c431b26485bf239b54731601264cfd1c06c3d77c83103fd8967336c2895f36664a374163526639dbc36e2aa65fc6f80912d8c6eb2545556
6
+ metadata.gz: 069a5de757c247e7bc533532b9498d827669b11b753385dd7ca416ef35299cdefd311199d322772b1b77d2fc3ba7a5d2876ed495321800c70c45d1d3ba1cfa09
7
+ data.tar.gz: 65ca2d23349a2f2aca7a8da6ba662cfdbfe7ace06dab6d5c52e9f94726277c1e14d831a6915a05fd7ac402335ef6831c487d668f39a8a09419e07b5646b597ac
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - 2.0.0
5
+ - 2.1
6
+ - ruby-head
7
+
8
+ script: bundle exec rake test
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
@@ -1,2 +1,7 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
1
3
  require "bundler/gem_tasks"
2
4
 
5
+ Rake::TestTask.new do |t|
6
+ t.test_files = Dir.glob('test/**/test_*.rb')
7
+ end
@@ -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 power_assert(&blk)
10
- ::PowerAssert.start(blk, assertion_method: __method__) do |pa|
11
- prc = pa.message_proc
12
- class << prc
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
- assert pa.yield, prc
14
+ else
15
+ super test, msg
16
16
  end
17
17
  end
18
18
  end
@@ -1,5 +1,5 @@
1
1
  module Minitest
2
2
  module PowerAssert
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -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 test_successful
6
- power_assert do
7
- true
8
- end
6
+ def test_power_assert
7
+ assert { true }
9
8
  end
10
9
 
11
- def test_failed
12
- power_assert do
13
- "0".class == "3".to_i.times.map {|i| i + 1 }.class
14
- end
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.1
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