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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c4c6e618f1321602f212a6a74d42590649dd9db1
4
- data.tar.gz: 04ccac75a393d971061a94f1d74ce47d49d65d73
3
+ metadata.gz: 4f1ff7eac1580a87aced2704c0e008554ef1d111
4
+ data.tar.gz: b3715fe5651385dbfc18ecacb67d5a93f2cc3659
5
5
  SHA512:
6
- metadata.gz: d6be56a1135d391e998dbd5253dd496415bd37dfbf8045ee735090899919539a6b005bed12cd722d1955ff37134544230ca5f570a9955101c31a2012006513e8
7
- data.tar.gz: 58454a1ae48311ba97d9df9547d694d57065bb77bef887c5d6fba54d004f55d19a1723e2dc39b3ae7a8901817480e997b3413a6288b817159518245571d7049e
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
- Define a Minitest 5+ test using a String.
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
- # instead of `def test_assert_the_truth` do:
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 true
26
+ assert @truth
17
27
  end
18
28
  end
19
29
  ```
@@ -1,5 +1,5 @@
1
1
  module Minitest
2
2
  module Sugar
3
- VERSION = "2.0.0"
3
+ VERSION = "2.1.0"
4
4
  end
5
5
  end
@@ -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
@@ -15,4 +15,12 @@ class MinitestSugarTest < Minitest::Test
15
15
  self.class.test("name") { }
16
16
  end
17
17
  end
18
+
19
+ setup do
20
+ @bar = "bar"
21
+ end
22
+
23
+ teardown do
24
+ assert_equal("bar", @bar)
25
+ end
18
26
  end
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.0.0
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-23 00:00:00.000000000 Z
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: Helper to define a test method using a String
61
+ summary: Useful helpers for Minitest 5+
76
62
  test_files:
77
63
  - test/all.rb