minitest-around 0.2.0.pre3 → 0.2.0
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 +4 -4
- data/README.md +109 -0
- data/Rakefile +7 -3
- data/lib/minitest/around/version.rb +1 -1
- data/minitest-around.gemspec +1 -0
- metadata +19 -5
- data/README.rdoc +0 -99
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0bc83c4224a6092d7207e66f08f9dda67b7240a6
|
|
4
|
+
data.tar.gz: 1e482a21ee33f0e63648dad403f63b639e645d96
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d3eadf7b8b3da623847ea41c396556dbaef0adb5fa35ef77794b20f97b1f3bd94edb34017cb7fc44fe3c95b96938f2a518e58daba4a0f8d49b24650645602680
|
|
7
|
+
data.tar.gz: 12538c05bbddcbd7aa49fe0470ce87fb4a50b85d859d508f17548c43a5cfd399cef6f106c9d0350816455413b16b7b83c0923133d4ba8dfce7c90f6180e166db
|
data/README.md
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# minitest-around
|
|
2
|
+
|
|
3
|
+
[](https://travis-ci.org/splattael/minitest-around) [](http://inch-pages.github.io/github/splattael/minitest-around)
|
|
4
|
+
|
|
5
|
+
Around block for minitest 5.X.
|
|
6
|
+
|
|
7
|
+
Alternative for setup/teardown dance.
|
|
8
|
+
|
|
9
|
+
[Gem](https://rubygems.org/gems/minitest-around) |
|
|
10
|
+
[Source](https://github.com/splattael/minitest-around) |
|
|
11
|
+
[RDoc](http://rubydoc.info/github/splattael/minitest-around/master/file/README.md)
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```Bash
|
|
16
|
+
gem install minitest-around
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
See [examples](/examples) directory for some example usage..
|
|
22
|
+
|
|
23
|
+
### Unit tests
|
|
24
|
+
|
|
25
|
+
```Ruby
|
|
26
|
+
require 'minitest/autorun'
|
|
27
|
+
require 'minitest/around/unit'
|
|
28
|
+
require 'thread'
|
|
29
|
+
|
|
30
|
+
class MutexTest < Minitest::Test
|
|
31
|
+
def around(&block)
|
|
32
|
+
Mutex.new.synchronize(&block)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def test_synchronized
|
|
36
|
+
# ...
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Spec
|
|
42
|
+
|
|
43
|
+
```Ruby
|
|
44
|
+
require 'minitest/autorun'
|
|
45
|
+
require 'minitest/around/spec'
|
|
46
|
+
require 'tmpdir'
|
|
47
|
+
|
|
48
|
+
describe "inside new directory" do
|
|
49
|
+
around do |test|
|
|
50
|
+
Dir.mktmpdir do |dir|
|
|
51
|
+
$dir = dir
|
|
52
|
+
Dir.chdir(dir) do
|
|
53
|
+
test.call
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
it "is in new directory" do
|
|
59
|
+
assert_equal $dir, Dir.pwd
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Caveats
|
|
65
|
+
|
|
66
|
+
- Test bodies won't be run if you don't test.call inside +around+.
|
|
67
|
+
- around runs inside a Fiber, so use `Thread.get_thread_local` / `set_thread_local` instead of `Thread.current.[]`
|
|
68
|
+
|
|
69
|
+
### Minitest 5.X only
|
|
70
|
+
|
|
71
|
+
`minitest-around` currently supports only `minitest` 5.X.
|
|
72
|
+
|
|
73
|
+
Please see the [mt4](https://github.com/splattael/minitest-around/tree/mt4) branch
|
|
74
|
+
for `minitest` 4.7.X support.
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
## License
|
|
78
|
+
|
|
79
|
+
[MIT License](http://www.opensource.org/licenses/mit-license.php)
|
|
80
|
+
|
|
81
|
+
## Authors
|
|
82
|
+
|
|
83
|
+
* [Peter Suschlik](https://github.com/splattael)
|
|
84
|
+
|
|
85
|
+
## [Contributors](https://github.com/splattael/minitest-around/graphs/contributors)
|
|
86
|
+
|
|
87
|
+
* [Michael Grosser](https://github.com/grosser)
|
|
88
|
+
* [Rick Martínez](https://github.com/rickmzp)
|
|
89
|
+
* [Philip Nelson](https://github.com/pnelson)
|
|
90
|
+
|
|
91
|
+
## Contributing
|
|
92
|
+
|
|
93
|
+
1. Fork it
|
|
94
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
95
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
|
96
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
97
|
+
5. Create new Pull Request
|
|
98
|
+
|
|
99
|
+
## Test
|
|
100
|
+
|
|
101
|
+
```Bash
|
|
102
|
+
bundle exec rake test
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Release
|
|
106
|
+
|
|
107
|
+
```Bash
|
|
108
|
+
rake bump:patch && rake release
|
|
109
|
+
```
|
data/Rakefile
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
require 'bundler/setup'
|
|
1
2
|
require 'bundler/gem_tasks'
|
|
3
|
+
require 'bump/tasks'
|
|
2
4
|
|
|
3
5
|
desc 'Default: run unit tests.'
|
|
4
6
|
task :default => :test
|
|
@@ -22,11 +24,13 @@ end
|
|
|
22
24
|
|
|
23
25
|
# RDoc
|
|
24
26
|
require 'rdoc/task'
|
|
25
|
-
RDoc::Task.new
|
|
27
|
+
RDoc::Task.new do |rdoc|
|
|
26
28
|
rdoc.rdoc_dir = 'rdoc'
|
|
27
29
|
rdoc.title = 'mintest-around'
|
|
28
|
-
rdoc.main = 'README.
|
|
29
|
-
rdoc.rdoc_files.include('README.
|
|
30
|
+
rdoc.main = 'README.md'
|
|
31
|
+
rdoc.rdoc_files.include('README.md', 'LICENSE', 'lib/**/*.rb')
|
|
32
|
+
rdoc.options << "--all"
|
|
33
|
+
rdoc.options << "--markup markdown"
|
|
30
34
|
end
|
|
31
35
|
|
|
32
36
|
# Examples
|
data/minitest-around.gemspec
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: minitest-around
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.0
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Peter Suschlik
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-
|
|
11
|
+
date: 2014-03-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: minitest
|
|
@@ -52,6 +52,20 @@ dependencies:
|
|
|
52
52
|
- - ">="
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: '0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: bump
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
55
69
|
description: Alternative for setup/teardown dance.
|
|
56
70
|
email:
|
|
57
71
|
- peter-minitest-around@suschlik.de
|
|
@@ -63,7 +77,7 @@ files:
|
|
|
63
77
|
- ".travis.yml"
|
|
64
78
|
- Gemfile
|
|
65
79
|
- LICENSE
|
|
66
|
-
- README.
|
|
80
|
+
- README.md
|
|
67
81
|
- Rakefile
|
|
68
82
|
- examples/chdir_spec.rb
|
|
69
83
|
- lib/minitest/around.rb
|
|
@@ -91,9 +105,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
91
105
|
version: '0'
|
|
92
106
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
107
|
requirements:
|
|
94
|
-
- - "
|
|
108
|
+
- - ">="
|
|
95
109
|
- !ruby/object:Gem::Version
|
|
96
|
-
version:
|
|
110
|
+
version: '0'
|
|
97
111
|
requirements: []
|
|
98
112
|
rubyforge_project:
|
|
99
113
|
rubygems_version: 2.2.2
|
data/README.rdoc
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
= minitest-around
|
|
2
|
-
|
|
3
|
-
{<img src="https://secure.travis-ci.org/splattael/minitest-around.png?branch=master" alt="Build Status" />}[http://travis-ci.org/splattael/minitest-around] {<img src="https://badge.fury.io/rb/minitest-around.png" alt="Gem Version" />}[http://badge.fury.io/rb/minitest-around] {<img src="https://codeclimate.com/github/splattael/minitest-around.png" />}[https://codeclimate.com/github/splattael/minitest-around]
|
|
4
|
-
|
|
5
|
-
Around block for minitest 5.X.
|
|
6
|
-
|
|
7
|
-
Alternative for setup/teardown dance.
|
|
8
|
-
|
|
9
|
-
Gem[https://rubygems.org/gems/minitest-around] |
|
|
10
|
-
Source[https://github.com/splattael/minitest-around] |
|
|
11
|
-
RDoc[http://rubydoc.info/github/splattael/minitest-around/master/file/README.rdoc]
|
|
12
|
-
|
|
13
|
-
== Installation
|
|
14
|
-
|
|
15
|
-
gem install minitest-around
|
|
16
|
-
|
|
17
|
-
== Usage
|
|
18
|
-
|
|
19
|
-
See examples[https://github.com/splattael/minitest-around/tree/master/examples] directory for some example usage..
|
|
20
|
-
|
|
21
|
-
=== Unit tests
|
|
22
|
-
|
|
23
|
-
require 'minitest/autorun'
|
|
24
|
-
require 'minitest/around/unit'
|
|
25
|
-
require 'thread'
|
|
26
|
-
|
|
27
|
-
class MutexTest < Minitest::Test
|
|
28
|
-
def around(&block)
|
|
29
|
-
Mutex.new.synchronize(&block)
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def test_synchronized
|
|
33
|
-
# ...
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
=== Spec
|
|
38
|
-
|
|
39
|
-
require 'minitest/autorun'
|
|
40
|
-
require 'minitest/around/spec'
|
|
41
|
-
require 'tmpdir'
|
|
42
|
-
|
|
43
|
-
describe "inside new directory" do
|
|
44
|
-
around do |test|
|
|
45
|
-
Dir.mktmpdir do |dir|
|
|
46
|
-
$dir = dir
|
|
47
|
-
Dir.chdir(dir) do
|
|
48
|
-
test.call
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
it "is in new directory" do
|
|
54
|
-
assert_equal $dir, Dir.pwd
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
== Caveats
|
|
59
|
-
|
|
60
|
-
Test bodies won't be run if you don't *yield* inside +around+.
|
|
61
|
-
|
|
62
|
-
=== Minitest 5.X only
|
|
63
|
-
|
|
64
|
-
+minitest-around+ currently supports only +minitest+ 5.X.
|
|
65
|
-
|
|
66
|
-
Please see the mt4[https://github.com/splattael/minitest-around/tree/mt4] branch
|
|
67
|
-
for +minitest+ 4.7.X support.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
== License
|
|
71
|
-
|
|
72
|
-
MIT License[http://www.opensource.org/licenses/mit-license.php]
|
|
73
|
-
|
|
74
|
-
== Authors
|
|
75
|
-
|
|
76
|
-
* Peter Suschlik (https://github.com/splattael)
|
|
77
|
-
|
|
78
|
-
== Contributors[https://github.com/splattael/minitest-around/graphs/contributors]
|
|
79
|
-
|
|
80
|
-
* Michael Grosser (https://github.com/grosser)
|
|
81
|
-
* Rick Martínez (https://github.com/rickmzp)
|
|
82
|
-
* Philip Nelson (https://github.com/pnelson)
|
|
83
|
-
|
|
84
|
-
== Contributing
|
|
85
|
-
|
|
86
|
-
1. Fork it
|
|
87
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
88
|
-
3. Commit your changes (`git commit -am 'Added some feature'`)
|
|
89
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
|
90
|
-
5. Create new Pull Request
|
|
91
|
-
|
|
92
|
-
== Test
|
|
93
|
-
|
|
94
|
-
bundle exec rake test
|
|
95
|
-
|
|
96
|
-
== Release
|
|
97
|
-
|
|
98
|
-
edit lib/minitest/around/version.rb
|
|
99
|
-
rake release
|