minitest 2.5.0 → 2.5.1
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.
- data.tar.gz.sig +0 -0
- data/History.txt +7 -0
- data/lib/minitest/autorun.rb +7 -0
- data/lib/minitest/spec.rb +26 -5
- data/lib/minitest/unit.rb +1 -1
- data/test/test_minitest_spec.rb +37 -0
- metadata +8 -8
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
=== 2.5.1 / 2011-08-27
|
2
|
+
|
3
|
+
* 2 minor enhancements:
|
4
|
+
|
5
|
+
* Added gem activation for minitest in minitest/autoload to help out 1.9 users
|
6
|
+
* Extended Spec.register_spec_type to allow for procs instead of just regexps.
|
7
|
+
|
1
8
|
=== 2.5.0 / 2011-08-18
|
2
9
|
|
3
10
|
* 4 minor enhancements:
|
data/lib/minitest/autorun.rb
CHANGED
data/lib/minitest/spec.rb
CHANGED
@@ -88,11 +88,27 @@ class MiniTest::Spec < MiniTest::Unit::TestCase
|
|
88
88
|
TYPES = [[//, MiniTest::Spec]]
|
89
89
|
|
90
90
|
##
|
91
|
-
# Register a new type of spec that matches the spec's description.
|
91
|
+
# Register a new type of spec that matches the spec's description.
|
92
|
+
# This method can take either a Regexp and a spec class or a spec
|
93
|
+
# class and a block that takes the description and returns true if
|
94
|
+
# it matches.
|
92
95
|
#
|
93
|
-
#
|
96
|
+
# Eg:
|
97
|
+
#
|
98
|
+
# register_spec_type(/Controller$/, MiniTest::Spec::Rails)
|
99
|
+
#
|
100
|
+
# or:
|
101
|
+
#
|
102
|
+
# register_spec_type(MiniTest::Spec::RailsModel) do |desc|
|
103
|
+
# desc.superclass == ActiveRecord::Base
|
104
|
+
# end
|
94
105
|
|
95
|
-
def self.register_spec_type
|
106
|
+
def self.register_spec_type(*args, &block)
|
107
|
+
if block then
|
108
|
+
matcher, klass = block, args.first
|
109
|
+
else
|
110
|
+
matcher, klass = *args
|
111
|
+
end
|
96
112
|
TYPES.unshift [matcher, klass]
|
97
113
|
end
|
98
114
|
|
@@ -102,8 +118,13 @@ class MiniTest::Spec < MiniTest::Unit::TestCase
|
|
102
118
|
# spec_type("BlahController") # => MiniTest::Spec::Rails
|
103
119
|
|
104
120
|
def self.spec_type desc
|
105
|
-
|
106
|
-
|
121
|
+
TYPES.find { |matcher, klass|
|
122
|
+
if matcher.respond_to? :call then
|
123
|
+
matcher.call desc
|
124
|
+
else
|
125
|
+
matcher === desc.to_s
|
126
|
+
end
|
127
|
+
}.last
|
107
128
|
end
|
108
129
|
|
109
130
|
@@describe_stack = []
|
data/lib/minitest/unit.rb
CHANGED
data/test/test_minitest_spec.rb
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
require 'minitest/autorun'
|
2
2
|
require 'stringio'
|
3
3
|
|
4
|
+
class MiniSpecA < MiniTest::Spec; end
|
5
|
+
class MiniSpecB < MiniTest::Spec; end
|
6
|
+
class ExampleA; end
|
7
|
+
class ExampleB < ExampleA; end
|
8
|
+
|
4
9
|
describe MiniTest::Spec do
|
5
10
|
before do
|
6
11
|
@assertion_count = 4
|
@@ -273,6 +278,38 @@ class TestMeta < MiniTest::Unit::TestCase
|
|
273
278
|
return x, y, z, before_list, after_list
|
274
279
|
end
|
275
280
|
|
281
|
+
def test_register_spec_type
|
282
|
+
original_types = MiniTest::Spec::TYPES.dup
|
283
|
+
|
284
|
+
assert_equal [[//, MiniTest::Spec]], MiniTest::Spec::TYPES
|
285
|
+
|
286
|
+
MiniTest::Spec.register_spec_type(/woot/, TestMeta)
|
287
|
+
|
288
|
+
p = lambda do |x| true end
|
289
|
+
MiniTest::Spec.register_spec_type TestMeta, &p
|
290
|
+
|
291
|
+
keys = MiniTest::Spec::TYPES.map(&:first)
|
292
|
+
|
293
|
+
assert_includes keys, /woot/
|
294
|
+
assert_includes keys, p
|
295
|
+
ensure
|
296
|
+
MiniTest::Spec::TYPES.replace original_types
|
297
|
+
end
|
298
|
+
|
299
|
+
def test_spec_type
|
300
|
+
original_types = MiniTest::Spec::TYPES.dup
|
301
|
+
|
302
|
+
MiniTest::Spec.register_spec_type(/A$/, MiniSpecA)
|
303
|
+
MiniTest::Spec.register_spec_type MiniSpecB do |desc|
|
304
|
+
desc.superclass == ExampleA
|
305
|
+
end
|
306
|
+
|
307
|
+
assert_equal MiniSpecA, MiniTest::Spec.spec_type(ExampleA)
|
308
|
+
assert_equal MiniSpecB, MiniTest::Spec.spec_type(ExampleB)
|
309
|
+
ensure
|
310
|
+
MiniTest::Spec::TYPES.replace original_types
|
311
|
+
end
|
312
|
+
|
276
313
|
def test_structure
|
277
314
|
x, y, z, * = util_structure
|
278
315
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 2.5.
|
9
|
+
- 1
|
10
|
+
version: 2.5.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ryan Davis
|
@@ -36,7 +36,7 @@ cert_chain:
|
|
36
36
|
FBHgymkyj/AOSqKRIpXPhjC6
|
37
37
|
-----END CERTIFICATE-----
|
38
38
|
|
39
|
-
date: 2011-08-
|
39
|
+
date: 2011-08-27 00:00:00 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: hoe
|
@@ -46,11 +46,11 @@ dependencies:
|
|
46
46
|
requirements:
|
47
47
|
- - ~>
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
hash:
|
49
|
+
hash: 27
|
50
50
|
segments:
|
51
51
|
- 2
|
52
|
-
-
|
53
|
-
version: "2.
|
52
|
+
- 12
|
53
|
+
version: "2.12"
|
54
54
|
type: :development
|
55
55
|
version_requirements: *id001
|
56
56
|
description: |-
|
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
139
|
requirements: []
|
140
140
|
|
141
141
|
rubyforge_project: bfts
|
142
|
-
rubygems_version: 1.8.
|
142
|
+
rubygems_version: 1.8.9
|
143
143
|
signing_key:
|
144
144
|
specification_version: 3
|
145
145
|
summary: minitest provides a complete suite of testing facilities supporting TDD, BDD, mocking, and benchmarking
|
metadata.gz.sig
CHANGED
Binary file
|