minitest-around 0.0.6.pre → 0.1.0.pre

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ca243b78a6f51d47c77b3e940c09f5e1bb3adc3d
4
+ data.tar.gz: 8147c9a4cc679184b664a68f55c21a05948d8953
5
+ SHA512:
6
+ metadata.gz: a2b8692b18209e4e66f1ad2c017f8d724f993a4d24dc091f188e40dcd17b0d3bd94e69a10a8a235b81f774c52a0a6708f8b0295fea91767b5740e402a12b630b
7
+ data.tar.gz: b4228a83aea16b0febc1106cccffa46bfc556bcfc2634a9c7a4d7b20cc6d6ee82256fbf572b6f76c4f3d976dcc1f112c2b60828c6cef6a033b2440fd2c5a1b17
data/.gitignore CHANGED
@@ -3,4 +3,3 @@
3
3
  Gemfile.lock
4
4
  pkg
5
5
  rdoc
6
- .rvmrc
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm @minitest-around --create
data/.travis.yml CHANGED
@@ -1,9 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
- - ree
4
3
  - 1.9.3
5
4
  - 2.0.0
6
- - jruby-18mode
7
5
  - jruby-19mode
8
- - rbx-18mode
9
6
  - rbx-19mode
data/README.rdoc CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
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
4
 
5
- Around block for minitest 4.7.X.
5
+ Around block for minitest 5.
6
6
 
7
7
  Alternative for setup/teardown dance.
8
8
 
@@ -16,15 +16,13 @@ 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
-
21
19
  === Unit tests
22
20
 
23
21
  require 'minitest/autorun'
24
22
  require 'minitest/around/unit'
25
23
  require 'thread'
26
24
 
27
- class MutexTest < MiniTest::Unit::TestCase
25
+ class MutexTest < Minitest::Test
28
26
  def around(&block)
29
27
  Mutex.new.synchronize(&block)
30
28
  end
@@ -34,7 +32,7 @@ See examples[https://github.com/splattael/minitest-around/tree/master/examples]
34
32
  end
35
33
  end
36
34
 
37
- class PassArgsTest < MiniTest::Unit::TestCase
35
+ class PassArgsTest < Minitest::Test
38
36
  def around
39
37
  yield 1, 2
40
38
  end
@@ -48,20 +46,26 @@ See examples[https://github.com/splattael/minitest-around/tree/master/examples]
48
46
 
49
47
  require 'minitest/autorun'
50
48
  require 'minitest/around/spec'
51
- require 'tmpdir'
49
+ require 'thread'
52
50
 
53
- describe "inside new directory" do
51
+ describe "Mutex" do
54
52
  around do |test|
55
- Dir.mktmpdir do |dir|
56
- $dir = dir
57
- Dir.chdir(dir) do
58
- test.call
59
- end
60
- end
53
+ Mutex.new.synchronize(&test)
61
54
  end
62
55
 
63
- it "is in new directory" do
64
- assert_equal $dir, Dir.pwd
56
+ it "synchronized" do
57
+ # ...
58
+ end
59
+
60
+ describe "pass args" do
61
+ around do
62
+ # No block arg "test",
63
+ [ 1, 2 ]
64
+ end
65
+
66
+ it "passes args" do |a, b|
67
+ (a + b).must_equal 3
68
+ end
65
69
  end
66
70
  end
67
71
 
@@ -69,9 +73,9 @@ See examples[https://github.com/splattael/minitest-around/tree/master/examples]
69
73
 
70
74
  Test bodies won't be run if you don't *yield* inside +around+.
71
75
 
72
- === Minitest 4.7.X only
76
+ === Minitest 5.X only
73
77
 
74
- +minitest-around+ currently supports only +minitest+ 4.7.X.
78
+ +minitest-around+ currently supports only +minitest+ 5.X.
75
79
 
76
80
  === Nesting
77
81
 
data/Rakefile CHANGED
@@ -4,18 +4,9 @@ desc 'Default: run unit tests.'
4
4
  task :default => :test
5
5
 
6
6
  # Test
7
- TEST_FILES = FileList.new('test/*_{test,spec}.rb')
8
-
9
- desc "Run all tests"
10
- task :test do
11
- TEST_FILES.each do |test_file|
12
- sh "bundle", "exec", "rake", "test:isolated", "TEST=#{test_file}"
13
- end
14
- end
15
-
16
7
  require 'rake/testtask'
17
- Rake::TestTask.new(:"test:isolated") do |test|
18
- test.test_files = TEST_FILES
8
+ Rake::TestTask.new(:test) do |test|
9
+ test.test_files = FileList.new('test/*_{test,spec}.rb')
19
10
  test.libs << 'test'
20
11
  test.verbose = true
21
12
  end
@@ -28,12 +19,3 @@ RDoc::Task.new(:rdoc) do |rdoc|
28
19
  rdoc.main = 'README.rdoc'
29
20
  rdoc.rdoc_files.include('README.rdoc', 'LICENSE', 'lib/**/*.rb')
30
21
  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
@@ -2,7 +2,7 @@ require 'minitest/autorun'
2
2
  require 'minitest/around'
3
3
  require 'thread'
4
4
 
5
- class MutexTest < MiniTest::Unit::TestCase
5
+ class MutexTest < Minitest::Test
6
6
  def around(&block)
7
7
  Mutex.new.synchronize(&block)
8
8
  end
@@ -12,7 +12,7 @@ class MutexTest < MiniTest::Unit::TestCase
12
12
  end
13
13
  end
14
14
 
15
- class PassArgsTest < MiniTest::Unit::TestCase
15
+ class PassArgsTest < Minitest::Test
16
16
  def around
17
17
  yield 1, 2
18
18
  end
@@ -1,17 +1,12 @@
1
1
  require 'minitest/spec'
2
2
 
3
- require 'minitest/around/version'
4
- require 'minitest/around/unit'
5
-
6
- class MiniTest::Spec
7
- module DSL
8
- def around(&outer)
9
- define_method(:around) do |&inner|
10
- if outer.arity == 1
11
- super() { outer.call(inner) }
12
- else
13
- inner.call *outer.call
14
- end
3
+ class Minitest::Spec
4
+ def self.around(&outer)
5
+ define_method(:around) do |&inner|
6
+ if outer.arity == 1
7
+ outer.call(inner)
8
+ else
9
+ inner.call *outer.call
15
10
  end
16
11
  end
17
12
  end
@@ -1,12 +1,11 @@
1
1
  require 'minitest/unit'
2
- require 'minitest/around/version'
3
2
 
4
- class MiniTest::Unit::TestCase
5
- def run_test(name)
6
- around { |*args| __send__(name, *args) }
7
- end
8
-
9
- def around(*args)
10
- yield *args
3
+ class Minitest::Test
4
+ def send(name)
5
+ if defined?(around) && name.start_with?('test')
6
+ around { |*args| super(name, *args) }
7
+ else
8
+ super(name)
9
+ end
11
10
  end
12
11
  end
@@ -1,5 +1,5 @@
1
1
  module MiniTest
2
2
  module Around
3
- VERSION = '0.0.6.pre'
3
+ VERSION = '0.1.0.pre'
4
4
  end
5
5
  end
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
20
  s.require_paths = ["lib"]
21
21
 
22
- s.add_dependency 'minitest', '~> 4.7.5'
22
+ s.add_dependency 'minitest', '~> 5.0.8'
23
23
 
24
24
  s.add_development_dependency 'rdoc'
25
25
  end
data/test/around_spec.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'minitest/autorun'
2
- require 'minitest/around/spec'
2
+ require 'minitest/around'
3
3
 
4
4
  describe "MiniTest Around" do
5
5
  describe "without around" do
data/test/around_test.rb CHANGED
@@ -1,13 +1,13 @@
1
1
  require 'minitest/autorun'
2
- require 'minitest/around/unit'
2
+ require 'minitest/around'
3
3
 
4
- class TestWithoutAround < MiniTest::Unit::TestCase
4
+ class TestWithoutAround < Minitest::Test
5
5
  def test_no_around_defined
6
6
  assert true
7
7
  end
8
8
  end
9
9
 
10
- class TestWithoutArgs < MiniTest::Unit::TestCase
10
+ class TestWithoutArgs < Minitest::Test
11
11
  def around
12
12
  $before = true
13
13
  yield
@@ -19,7 +19,7 @@ class TestWithoutArgs < MiniTest::Unit::TestCase
19
19
  end
20
20
  end
21
21
 
22
- class TestWithSingleArg < MiniTest::Unit::TestCase
22
+ class TestWithSingleArg < Minitest::Test
23
23
  def around
24
24
  yield "string"
25
25
  end
@@ -29,7 +29,7 @@ class TestWithSingleArg < MiniTest::Unit::TestCase
29
29
  end
30
30
  end
31
31
 
32
- class TestWithMultipleArgs < MiniTest::Unit::TestCase
32
+ class TestWithMultipleArgs < Minitest::Test
33
33
  def around
34
34
  yield 1, 2
35
35
  end
metadata CHANGED
@@ -1,46 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-around
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6.pre
5
- prerelease: 6
4
+ version: 0.1.0.pre
6
5
  platform: ruby
7
6
  authors:
8
7
  - Peter Suschlik
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-10-17 00:00:00.000000000 Z
11
+ date: 2013-09-23 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: minitest
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
21
- version: 4.7.5
19
+ version: 5.0.8
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
29
- version: 4.7.5
26
+ version: 5.0.8
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rdoc
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  description: Alternative for setup/teardown dance.
@@ -51,12 +46,12 @@ extensions: []
51
46
  extra_rdoc_files: []
52
47
  files:
53
48
  - .gitignore
49
+ - .rvmrc
54
50
  - .travis.yml
55
51
  - Gemfile
56
52
  - LICENSE
57
53
  - README.rdoc
58
54
  - Rakefile
59
- - examples/chdir_spec.rb
60
55
  - examples/mutex_spec.rb
61
56
  - examples/mutex_test.rb
62
57
  - lib/minitest/around.rb
@@ -66,33 +61,28 @@ files:
66
61
  - minitest-around.gemspec
67
62
  - test/around_spec.rb
68
63
  - test/around_test.rb
69
- - test/nested_spec.rb
70
64
  homepage: https://github.com/splattael/minitest-around
71
65
  licenses:
72
66
  - MIT
67
+ metadata: {}
73
68
  post_install_message:
74
69
  rdoc_options: []
75
70
  require_paths:
76
71
  - lib
77
72
  required_ruby_version: !ruby/object:Gem::Requirement
78
- none: false
79
73
  requirements:
80
- - - ! '>='
74
+ - - '>='
81
75
  - !ruby/object:Gem::Version
82
76
  version: '0'
83
- segments:
84
- - 0
85
- hash: 995209263
86
77
  required_rubygems_version: !ruby/object:Gem::Requirement
87
- none: false
88
78
  requirements:
89
- - - ! '>'
79
+ - - '>'
90
80
  - !ruby/object:Gem::Version
91
81
  version: 1.3.1
92
82
  requirements: []
93
83
  rubyforge_project: minitest-around
94
- rubygems_version: 1.8.24
84
+ rubygems_version: 2.0.3
95
85
  signing_key:
96
- specification_version: 3
86
+ specification_version: 4
97
87
  summary: Around block for minitest.
98
88
  test_files: []
@@ -1,18 +0,0 @@
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
data/test/nested_spec.rb DELETED
@@ -1,36 +0,0 @@
1
- require 'minitest/autorun'
2
- require 'minitest/around'
3
-
4
- $var = []
5
-
6
- describe 'Outer' do
7
- before do
8
- $var << :before
9
- end
10
- after do
11
- $var << :after
12
- $var.must_equal [:before, :ibefore, :begin, :ibegin, :during, :iend, :end, :iafter, :after]
13
- end
14
- around do |test|
15
- $var << :begin
16
- test.call
17
- $var << :end
18
- end
19
-
20
- describe 'Inner' do
21
- before do
22
- $var << :ibefore
23
- end
24
- after do
25
- $var << :iafter
26
- end
27
- around do |test|
28
- $var << :ibegin
29
- test.call
30
- $var << :iend
31
- end
32
- it 'testing' do
33
- $var << :during
34
- end
35
- end
36
- end