minitest 2.7.0 → 2.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/History.txt +12 -0
- data/lib/minitest/spec.rb +1 -1
- data/lib/minitest/unit.rb +12 -26
- data/test/test_minitest_mock.rb +6 -3
- data/test/test_minitest_unit.rb +33 -1
- metadata +21 -6
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
=== 2.8.0 / 2011-11-08
|
2
|
+
|
3
|
+
* 2 minor enhancements:
|
4
|
+
|
5
|
+
* Add a method so that code can be run around a particular test case (tenderlove)
|
6
|
+
* Turn off backtrace filtering if we're running inside a ruby checkout. (drbrain)
|
7
|
+
|
8
|
+
* 2 bug fixes:
|
9
|
+
|
10
|
+
* Fixed 2 typos and 2 doc glitches. (splattael)
|
11
|
+
* Remove unused block arguments to avoid creating Proc objects. (k-tsj)
|
12
|
+
|
1
13
|
=== 2.7.0 / 2011-10-25
|
2
14
|
|
3
15
|
* 2 minor enhancements:
|
data/lib/minitest/spec.rb
CHANGED
@@ -6,7 +6,7 @@ class Module # :nodoc:
|
|
6
6
|
def infect_an_assertion meth, new_name, dont_flip = false # :nodoc:
|
7
7
|
# warn "%-22p -> %p %p" % [meth, new_name, dont_flip]
|
8
8
|
self.class_eval <<-EOM
|
9
|
-
def #{new_name} *args
|
9
|
+
def #{new_name} *args
|
10
10
|
return MiniTest::Spec.current.#{meth}(*args, &self) if
|
11
11
|
Proc === self
|
12
12
|
return MiniTest::Spec.current.#{meth}(args.first, self) if
|
data/lib/minitest/unit.rb
CHANGED
@@ -18,22 +18,6 @@ module MiniTest
|
|
18
18
|
|
19
19
|
class Skip < Assertion; end
|
20
20
|
|
21
|
-
file = if RUBY_VERSION >= '1.9.0' then # bt's expanded, but __FILE__ isn't :(
|
22
|
-
File.expand_path __FILE__
|
23
|
-
elsif __FILE__ =~ /^[^\.]/ then # assume both relative
|
24
|
-
require 'pathname'
|
25
|
-
pwd = Pathname.new Dir.pwd
|
26
|
-
pn = Pathname.new File.expand_path(__FILE__)
|
27
|
-
relpath = pn.relative_path_from(pwd) rescue pn
|
28
|
-
pn = File.join ".", relpath unless pn.relative?
|
29
|
-
pn.to_s
|
30
|
-
else # assume both are expanded
|
31
|
-
__FILE__
|
32
|
-
end
|
33
|
-
|
34
|
-
# './lib' in project dir, or '/usr/local/blahblah' if installed
|
35
|
-
MINI_DIR = File.dirname(File.dirname(file)) # :nodoc:
|
36
|
-
|
37
21
|
def self.filter_backtrace bt # :nodoc:
|
38
22
|
return ["No backtrace"] unless bt
|
39
23
|
|
@@ -41,11 +25,11 @@ module MiniTest
|
|
41
25
|
|
42
26
|
unless $DEBUG then
|
43
27
|
bt.each do |line|
|
44
|
-
break if line
|
28
|
+
break if line =~ /lib\/minitest/
|
45
29
|
new_bt << line
|
46
30
|
end
|
47
31
|
|
48
|
-
new_bt = bt.reject { |line| line
|
32
|
+
new_bt = bt.reject { |line| line =~ /lib\/minitest/ } if new_bt.empty?
|
49
33
|
new_bt = bt.dup if new_bt.empty?
|
50
34
|
else
|
51
35
|
new_bt = bt.dup
|
@@ -645,7 +629,7 @@ module MiniTest
|
|
645
629
|
end
|
646
630
|
|
647
631
|
class Unit
|
648
|
-
VERSION = "2.
|
632
|
+
VERSION = "2.8.0" # :nodoc:
|
649
633
|
|
650
634
|
attr_accessor :report, :failures, :errors, :skips # :nodoc:
|
651
635
|
attr_accessor :test_count, :assertion_count # :nodoc:
|
@@ -971,7 +955,7 @@ module MiniTest
|
|
971
955
|
@passed = nil
|
972
956
|
self.setup
|
973
957
|
self.run_setup_hooks
|
974
|
-
self.
|
958
|
+
self.run_test self.__name__
|
975
959
|
result = "." unless io?
|
976
960
|
@passed = true
|
977
961
|
rescue *PASSTHROUGH_EXCEPTIONS
|
@@ -993,6 +977,8 @@ module MiniTest
|
|
993
977
|
result
|
994
978
|
end
|
995
979
|
|
980
|
+
alias :run_test :__send__
|
981
|
+
|
996
982
|
def initialize name # :nodoc:
|
997
983
|
@__name__ = name
|
998
984
|
@__io__ = nil
|
@@ -1093,17 +1079,17 @@ module MiniTest
|
|
1093
1079
|
# The argument can be any object that responds to #call or a block.
|
1094
1080
|
# That means that this call,
|
1095
1081
|
#
|
1096
|
-
# MiniTest::TestCase.add_setup_hook { puts "foo" }
|
1082
|
+
# MiniTest::Unit::TestCase.add_setup_hook { puts "foo" }
|
1097
1083
|
#
|
1098
1084
|
# ... is equivalent to:
|
1099
1085
|
#
|
1100
1086
|
# module MyTestSetup
|
1101
|
-
# def call
|
1087
|
+
# def self.call
|
1102
1088
|
# puts "foo"
|
1103
1089
|
# end
|
1104
1090
|
# end
|
1105
1091
|
#
|
1106
|
-
# MiniTest::TestCase.add_setup_hook MyTestSetup
|
1092
|
+
# MiniTest::Unit::TestCase.add_setup_hook MyTestSetup
|
1107
1093
|
#
|
1108
1094
|
# The blocks passed to +add_setup_hook+ take an optional parameter that
|
1109
1095
|
# will be the TestCase instance that is executing the block.
|
@@ -1142,17 +1128,17 @@ module MiniTest
|
|
1142
1128
|
# The argument can be any object that responds to #call or a block.
|
1143
1129
|
# That means that this call,
|
1144
1130
|
#
|
1145
|
-
# MiniTest::TestCase.add_teardown_hook { puts "foo" }
|
1131
|
+
# MiniTest::Unit::TestCase.add_teardown_hook { puts "foo" }
|
1146
1132
|
#
|
1147
1133
|
# ... is equivalent to:
|
1148
1134
|
#
|
1149
1135
|
# module MyTestTeardown
|
1150
|
-
# def call
|
1136
|
+
# def self.call
|
1151
1137
|
# puts "foo"
|
1152
1138
|
# end
|
1153
1139
|
# end
|
1154
1140
|
#
|
1155
|
-
# MiniTest::TestCase.add_teardown_hook MyTestTeardown
|
1141
|
+
# MiniTest::Unit::TestCase.add_teardown_hook MyTestTeardown
|
1156
1142
|
#
|
1157
1143
|
# The blocks passed to +add_teardown_hook+ take an optional parameter
|
1158
1144
|
# that will be the TestCase instance that is executing the block.
|
data/test/test_minitest_mock.rb
CHANGED
@@ -143,13 +143,16 @@ class TestMiniTestMock < MiniTest::Unit::TestCase
|
|
143
143
|
|
144
144
|
def test_verify_shows_the_actual_arguments_in_the_message
|
145
145
|
mock = MiniTest::Mock.new
|
146
|
-
mock.expect :capitalized, true, ["
|
147
|
-
mock.capitalized "
|
146
|
+
mock.expect :capitalized, true, ["a"]
|
147
|
+
mock.capitalized "b"
|
148
148
|
e = assert_raises MockExpectationError do
|
149
149
|
mock.verify
|
150
150
|
end
|
151
151
|
|
152
|
-
|
152
|
+
a = {:retval=>true, :args=>["a"]}
|
153
|
+
b = {:retval=>true, :args=>["b"]}
|
154
|
+
|
155
|
+
expected = "expected capitalized, #{a.inspect}, got [#{b.inspect}]"
|
153
156
|
assert_equal expected, e.message
|
154
157
|
end
|
155
158
|
|
data/test/test_minitest_unit.rb
CHANGED
@@ -8,7 +8,7 @@ class ImmutableString < String; def inspect; super.freeze; end; end
|
|
8
8
|
|
9
9
|
class TestMiniTestUnit < MiniTest::Unit::TestCase
|
10
10
|
pwd = Pathname.new(File.expand_path(Dir.pwd))
|
11
|
-
basedir = Pathname.new(File.expand_path(
|
11
|
+
basedir = Pathname.new(File.expand_path("lib/minitest")) + 'mini'
|
12
12
|
basedir = basedir.relative_path_from(pwd).to_s
|
13
13
|
MINITEST_BASE_DIR = basedir[/\A\./] ? basedir : "./#{basedir}"
|
14
14
|
BT_MIDDLE = ["#{MINITEST_BASE_DIR}/test.rb:161:in `each'",
|
@@ -182,6 +182,38 @@ Finished tests in 0.00
|
|
182
182
|
assert_equal ex, fu
|
183
183
|
end
|
184
184
|
|
185
|
+
def test_run_test
|
186
|
+
tc = Class.new(MiniTest::Unit::TestCase) do
|
187
|
+
attr_reader :foo
|
188
|
+
|
189
|
+
def run_test name
|
190
|
+
@foo = "hi mom!"
|
191
|
+
super
|
192
|
+
@foo = "okay"
|
193
|
+
end
|
194
|
+
|
195
|
+
def test_something
|
196
|
+
assert_equal "hi mom!", foo
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
Object.const_set(:ATestCase, tc)
|
201
|
+
|
202
|
+
@tu.run %w[--seed 42]
|
203
|
+
|
204
|
+
expected = "Run options: --seed 42
|
205
|
+
|
206
|
+
# Running tests:
|
207
|
+
|
208
|
+
.
|
209
|
+
|
210
|
+
Finished tests in 0.00
|
211
|
+
|
212
|
+
1 tests, 1 assertions, 0 failures, 0 errors, 0 skips
|
213
|
+
"
|
214
|
+
assert_report expected
|
215
|
+
end
|
216
|
+
|
185
217
|
def test_run_error
|
186
218
|
tc = Class.new(MiniTest::Unit::TestCase) do
|
187
219
|
def test_something
|
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: 47
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
|
-
-
|
8
|
+
- 8
|
9
9
|
- 0
|
10
|
-
version: 2.
|
10
|
+
version: 2.8.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ryan Davis
|
@@ -36,12 +36,27 @@ cert_chain:
|
|
36
36
|
FBHgymkyj/AOSqKRIpXPhjC6
|
37
37
|
-----END CERTIFICATE-----
|
38
38
|
|
39
|
-
date: 2011-
|
39
|
+
date: 2011-11-09 00:00:00 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rdoc
|
43
43
|
prerelease: false
|
44
44
|
requirement: &id001 !ruby/object:Gem::Requirement
|
45
|
+
none: false
|
46
|
+
requirements:
|
47
|
+
- - ~>
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
hash: 21
|
50
|
+
segments:
|
51
|
+
- 3
|
52
|
+
- 9
|
53
|
+
version: "3.9"
|
54
|
+
type: :development
|
55
|
+
version_requirements: *id001
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: hoe
|
58
|
+
prerelease: false
|
59
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
45
60
|
none: false
|
46
61
|
requirements:
|
47
62
|
- - ~>
|
@@ -52,7 +67,7 @@ dependencies:
|
|
52
67
|
- 12
|
53
68
|
version: "2.12"
|
54
69
|
type: :development
|
55
|
-
version_requirements: *
|
70
|
+
version_requirements: *id002
|
56
71
|
description: "minitest provides a complete suite of testing facilities supporting\n\
|
57
72
|
TDD, BDD, mocking, and benchmarking.\n\n \"I had a class with Jim Weirich on testing last week and we were\n allowed to choose our testing frameworks. Kirk Haines and I were\n paired up and we cracked open the code for a few test\n frameworks...\n\n I MUST say that mintiest is *very* readable / understandable\n compared to the 'other two' options we looked at. Nicely done and\n thank you for helping us keep our mental sanity.\"\n\n -- Wayne E. Seguin\n\n\
|
58
73
|
minitest/unit is a small and incredibly fast unit testing framework.\n\
|
metadata.gz.sig
CHANGED
Binary file
|