minitest-around 0.0.4 → 0.0.5

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: 750b0034f400942958d9a20eaef17f8fec4c05b3
4
- data.tar.gz: 463e65ae5d0fc3e24dcedf8c9bbebb8fa8f187b5
3
+ metadata.gz: e74398d843d7c3801fd2d6daf3b8ac1101592bb7
4
+ data.tar.gz: 37c7b514013ebd08ebc53a0a65a61b84ee7b6dc4
5
5
  SHA512:
6
- metadata.gz: a7ca64012d25787432e33ed4ccaf3ba20348f7e489a6ef1a277efe1d96cd0956355b3461bf45d67138dfafeb9988b5bf49239d257c28ea7ecdcbb346eb93a62b
7
- data.tar.gz: 79b73b807645c0295fccbbec0cd0a109e03908ff857f6b598b611ca7697d57eca3336a8eba751ac36f7af52859ea3e85c1ae82a57b137a35c7bcf1a917546685
6
+ metadata.gz: 2e0264637f8969caaf09efb7aaaa35b21b8b6a4b473a32ff8c1ba4214682417e81c4fde613b2081632323771943eb352656ffcb2a704802012ab59f4c5d96fcf
7
+ data.tar.gz: a41bae9f6bc0aa9f382f911d4e55ff6ec3ca596286b671ca83985d87f1122117cf249fb9e3b05d7f6091e90c62947dcd5329d9acee8be54682b80e76faf356ab
data/README.rdoc CHANGED
@@ -16,6 +16,8 @@ RDoc[http://rubydoc.info/github/splattael/minitest-around/master/file/README.rdo
16
16
 
17
17
  == Usage
18
18
 
19
+ See examples[https://github.com/splattael/minitest-around/tree/master/examples] directory for some example usage..
20
+
19
21
  === Unit tests
20
22
 
21
23
  require 'minitest/autorun'
@@ -46,26 +48,20 @@ RDoc[http://rubydoc.info/github/splattael/minitest-around/master/file/README.rdo
46
48
 
47
49
  require 'minitest/autorun'
48
50
  require 'minitest/around/spec'
49
- require 'thread'
51
+ require 'tmpdir'
50
52
 
51
- describe "Mutex" do
53
+ describe "inside new directory" do
52
54
  around do |test|
53
- Mutex.new.synchronize(&test)
54
- end
55
-
56
- it "synchronized" do
57
- # ...
58
- end
59
-
60
- describe "pass args" do
61
- around do
62
- # No block arg "test",
63
- [ 1, 2 ]
55
+ Dir.mktmpdir do |dir|
56
+ $dir = dir
57
+ Dir.chdir(dir) do
58
+ test.call
59
+ end
64
60
  end
61
+ end
65
62
 
66
- it "passes args" do |a, b|
67
- (a + b).must_equal 3
68
- end
63
+ it "is in new directory" do
64
+ assert_equal $dir, Dir.pwd
69
65
  end
70
66
  end
71
67
 
data/Rakefile CHANGED
@@ -28,3 +28,12 @@ RDoc::Task.new(:rdoc) do |rdoc|
28
28
  rdoc.main = 'README.rdoc'
29
29
  rdoc.rdoc_files.include('README.rdoc', 'LICENSE', 'lib/**/*.rb')
30
30
  end
31
+
32
+ # Examples
33
+ EXAMPLES = FileList["examples/*.rb"]
34
+ desc "Run all examples"
35
+ task :"test:examples" do
36
+ EXAMPLES.each do |example|
37
+ sh "bundle", "exec", "ruby", example
38
+ end
39
+ end
@@ -0,0 +1,18 @@
1
+ require 'minitest/autorun'
2
+ require 'minitest/around/spec'
3
+ require 'tmpdir'
4
+
5
+ describe "inside new directory" do
6
+ around do |test|
7
+ Dir.mktmpdir do |dir|
8
+ $dir = dir
9
+ Dir.chdir(dir) do
10
+ test.call
11
+ end
12
+ end
13
+ end
14
+
15
+ it "is in new directory" do
16
+ assert_equal $dir, Dir.pwd
17
+ end
18
+ end
@@ -4,12 +4,14 @@ require 'minitest/around/version'
4
4
  require 'minitest/around/unit'
5
5
 
6
6
  class MiniTest::Spec
7
- def self.around(&outer)
8
- define_method(:around) do |&inner|
9
- if outer.arity == 1
10
- outer.call(inner)
11
- else
12
- inner.call *outer.call
7
+ module DSL
8
+ def around(&outer)
9
+ define_method(:around) do |&inner|
10
+ if outer.arity == 1
11
+ outer.call(inner)
12
+ else
13
+ inner.call *outer.call
14
+ end
13
15
  end
14
16
  end
15
17
  end
@@ -1,5 +1,5 @@
1
1
  module MiniTest
2
2
  module Around
3
- VERSION = '0.0.4'
3
+ VERSION = '0.0.5'
4
4
  end
5
5
  end
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.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Suschlik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-24 00:00:00.000000000 Z
11
+ date: 2013-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -51,6 +51,7 @@ files:
51
51
  - LICENSE
52
52
  - README.rdoc
53
53
  - Rakefile
54
+ - examples/chdir_spec.rb
54
55
  - examples/mutex_spec.rb
55
56
  - examples/mutex_test.rb
56
57
  - lib/minitest/around.rb
@@ -85,3 +86,4 @@ signing_key:
85
86
  specification_version: 4
86
87
  summary: Around block for minitest.
87
88
  test_files: []
89
+ has_rdoc: