minitest-sugar 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -3
- data/lib/minitest/sugar/version.rb +1 -1
- data/lib/minitest/sugar.rb +50 -0
- data/test/all.rb +8 -0
- metadata +3 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f1ff7eac1580a87aced2704c0e008554ef1d111
|
4
|
+
data.tar.gz: b3715fe5651385dbfc18ecacb67d5a93f2cc3659
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87d94211efbba0cb9dc319c42589417ea8d962a1c8a782c4febac65a6cf59bb53eb700a19dbb507275ad61b1392ac2628e8fbbd9334b1166ddd949d56b19f404
|
7
|
+
data.tar.gz: b041b27b34c27ec80632cebd6b072d040c1222079b20b12efa9abd7b0d49e843080675a793a13cead4604183ed5c1684375bed63e2335667b14834ea84dad9d9
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
minitest-sugar
|
2
2
|
==============
|
3
3
|
|
4
|
-
|
4
|
+
Useful helpers for Minitest 5+.
|
5
5
|
|
6
6
|
Usage
|
7
7
|
-----
|
@@ -11,9 +11,19 @@ require "minitest/autorun"
|
|
11
11
|
require "minitest/sugar"
|
12
12
|
|
13
13
|
class TruthTest < Minitest::Test
|
14
|
-
#
|
14
|
+
# Adds support for `setup` and `teardown` callbacks:
|
15
|
+
setup do
|
16
|
+
@truth = true
|
17
|
+
end
|
18
|
+
|
19
|
+
teardown do
|
20
|
+
@truth = nil
|
21
|
+
end
|
22
|
+
|
23
|
+
# Define a test method using a String. Instead of
|
24
|
+
# `def test_assert_the_truth`, do:
|
15
25
|
test "assert the truth" do
|
16
|
-
assert
|
26
|
+
assert @truth
|
17
27
|
end
|
18
28
|
end
|
19
29
|
```
|
data/lib/minitest/sugar.rb
CHANGED
@@ -22,6 +22,56 @@ module Minitest
|
|
22
22
|
|
23
23
|
define_method(test_name, &block)
|
24
24
|
end
|
25
|
+
|
26
|
+
# Public: Helper to define a +setup+ method.
|
27
|
+
#
|
28
|
+
# Examples
|
29
|
+
#
|
30
|
+
# require "minitest/autorun"
|
31
|
+
# require "minitest/sugar"
|
32
|
+
#
|
33
|
+
# class TruthTest < Minitest::Test
|
34
|
+
# setup do
|
35
|
+
# @truth = true
|
36
|
+
# end
|
37
|
+
#
|
38
|
+
# test "assert the truth" do
|
39
|
+
# assert @truth
|
40
|
+
# end
|
41
|
+
# end
|
42
|
+
#
|
43
|
+
def setup(&block)
|
44
|
+
define_method(:setup) do
|
45
|
+
super(); instance_exec(&block)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# Public: Helper to define a +teardown+ method.
|
50
|
+
#
|
51
|
+
# Examples
|
52
|
+
#
|
53
|
+
# require "minitest/autorun"
|
54
|
+
# require "minitest/sugar"
|
55
|
+
#
|
56
|
+
# class TruthTest < Minitest::Test
|
57
|
+
# setup do
|
58
|
+
# @truth = true
|
59
|
+
# end
|
60
|
+
#
|
61
|
+
# teardown do
|
62
|
+
# @truth = nil
|
63
|
+
# end
|
64
|
+
#
|
65
|
+
# test "assert the truth" do
|
66
|
+
# assert @truth
|
67
|
+
# end
|
68
|
+
# end
|
69
|
+
#
|
70
|
+
def teardown(&block)
|
71
|
+
define_method(:teardown) do
|
72
|
+
instance_exec(&block); super()
|
73
|
+
end
|
74
|
+
end
|
25
75
|
end
|
26
76
|
|
27
77
|
Test.extend(Sugar)
|
data/test/all.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-sugar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Francesco Rodriguez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '5.0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '10.0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '10.0'
|
41
27
|
description: Enough sugar for your minitest diet
|
42
28
|
email: frodsan@protonmail.ch
|
43
29
|
executables: []
|
@@ -72,6 +58,6 @@ rubyforge_project:
|
|
72
58
|
rubygems_version: 2.5.0
|
73
59
|
signing_key:
|
74
60
|
specification_version: 4
|
75
|
-
summary:
|
61
|
+
summary: Useful helpers for Minitest 5+
|
76
62
|
test_files:
|
77
63
|
- test/all.rb
|