minitest 2.6.2 → 2.7.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.
- data.tar.gz.sig +0 -0
- data/History.txt +12 -0
- data/README.txt +1 -3
- data/lib/minitest/benchmark.rb +14 -14
- data/lib/minitest/mock.rb +1 -1
- data/lib/minitest/pride.rb +1 -1
- data/lib/minitest/spec.rb +0 -9
- data/lib/minitest/unit.rb +6 -1
- data/test/test_minitest_mock.rb +12 -0
- data/test/test_minitest_unit.rb +13 -3
- metadata +4 -4
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
=== 2.7.0 / 2011-10-25
|
2
|
+
|
3
|
+
* 2 minor enhancements:
|
4
|
+
|
5
|
+
* Include failed values in the expected arg output in MockExpectationError. (nono)
|
6
|
+
* Make minitest/pride work with other 256 color capable terms. (sunaku)
|
7
|
+
|
8
|
+
* 2 bug fixes:
|
9
|
+
|
10
|
+
* Clarified the documentation of minitest/benchmark (eregon)
|
11
|
+
* Fixed using expectations in regular unit tests. (sunaku)
|
12
|
+
|
1
13
|
=== 2.6.2 / 2011-10-19
|
2
14
|
|
3
15
|
* 1 minor enhancement:
|
data/README.txt
CHANGED
@@ -129,9 +129,7 @@ benchmarks won't run.
|
|
129
129
|
# Override self.bench_range or default range is [1, 10, 100, 1_000, 10_000]
|
130
130
|
def bench_my_algorithm
|
131
131
|
assert_performance_linear 0.9999 do |n| # n is a range value
|
132
|
-
n
|
133
|
-
@obj.my_algorithm
|
134
|
-
end
|
132
|
+
@obj.my_algorithm(n)
|
135
133
|
end
|
136
134
|
end
|
137
135
|
end
|
data/lib/minitest/benchmark.rb
CHANGED
@@ -77,8 +77,8 @@ class MiniTest::Unit
|
|
77
77
|
#
|
78
78
|
# def bench_algorithm
|
79
79
|
# validation = proc { |x, y| ... }
|
80
|
-
# assert_performance validation do |
|
81
|
-
# @obj.algorithm
|
80
|
+
# assert_performance validation do |n|
|
81
|
+
# @obj.algorithm(n)
|
82
82
|
# end
|
83
83
|
# end
|
84
84
|
|
@@ -121,8 +121,8 @@ class MiniTest::Unit
|
|
121
121
|
# Eg:
|
122
122
|
#
|
123
123
|
# def bench_algorithm
|
124
|
-
# assert_performance_constant 0.9999 do |
|
125
|
-
# @obj.algorithm
|
124
|
+
# assert_performance_constant 0.9999 do |n|
|
125
|
+
# @obj.algorithm(n)
|
126
126
|
# end
|
127
127
|
# end
|
128
128
|
|
@@ -147,8 +147,8 @@ class MiniTest::Unit
|
|
147
147
|
# Eg:
|
148
148
|
#
|
149
149
|
# def bench_algorithm
|
150
|
-
# assert_performance_exponential 0.9999 do |
|
151
|
-
# @obj.algorithm
|
150
|
+
# assert_performance_exponential 0.9999 do |n|
|
151
|
+
# @obj.algorithm(n)
|
152
152
|
# end
|
153
153
|
# end
|
154
154
|
|
@@ -167,8 +167,8 @@ class MiniTest::Unit
|
|
167
167
|
# Eg:
|
168
168
|
#
|
169
169
|
# def bench_algorithm
|
170
|
-
# assert_performance_linear 0.9999 do |
|
171
|
-
# @obj.algorithm
|
170
|
+
# assert_performance_linear 0.9999 do |n|
|
171
|
+
# @obj.algorithm(n)
|
172
172
|
# end
|
173
173
|
# end
|
174
174
|
|
@@ -323,8 +323,8 @@ class MiniTest::Spec
|
|
323
323
|
# Create a benchmark that verifies that the performance is linear.
|
324
324
|
#
|
325
325
|
# describe "my class" do
|
326
|
-
# bench_performance_linear "fast_algorithm", 0.9999 do
|
327
|
-
# @obj.fast_algorithm
|
326
|
+
# bench_performance_linear "fast_algorithm", 0.9999 do |n|
|
327
|
+
# @obj.fast_algorithm(n)
|
328
328
|
# end
|
329
329
|
# end
|
330
330
|
|
@@ -338,8 +338,8 @@ class MiniTest::Spec
|
|
338
338
|
# Create a benchmark that verifies that the performance is constant.
|
339
339
|
#
|
340
340
|
# describe "my class" do
|
341
|
-
# bench_performance_constant "zoom_algorithm!" do
|
342
|
-
# @obj.zoom_algorithm!
|
341
|
+
# bench_performance_constant "zoom_algorithm!" do |n|
|
342
|
+
# @obj.zoom_algorithm!(n)
|
343
343
|
# end
|
344
344
|
# end
|
345
345
|
|
@@ -353,8 +353,8 @@ class MiniTest::Spec
|
|
353
353
|
# Create a benchmark that verifies that the performance is exponential.
|
354
354
|
#
|
355
355
|
# describe "my class" do
|
356
|
-
# bench_performance_exponential "algorithm" do
|
357
|
-
# @obj.algorithm
|
356
|
+
# bench_performance_exponential "algorithm" do |n|
|
357
|
+
# @obj.algorithm(n)
|
358
358
|
# end
|
359
359
|
# end
|
360
360
|
|
data/lib/minitest/mock.rb
CHANGED
data/lib/minitest/pride.rb
CHANGED
@@ -89,5 +89,5 @@ class PrideLOL < PrideIO # inspired by lolcat, but massively cleaned up
|
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
92
|
-
klass = ENV['TERM'] =~ /^xterm
|
92
|
+
klass = ENV['TERM'] =~ /^xterm|-256color$/ ? PrideLOL : PrideIO
|
93
93
|
MiniTest::Unit.output = klass.new(MiniTest::Unit.output)
|
data/lib/minitest/spec.rb
CHANGED
@@ -132,10 +132,6 @@ class MiniTest::Spec < MiniTest::Unit::TestCase
|
|
132
132
|
@@describe_stack
|
133
133
|
end
|
134
134
|
|
135
|
-
def self.current # :nodoc:
|
136
|
-
@@current_spec
|
137
|
-
end
|
138
|
-
|
139
135
|
##
|
140
136
|
# Returns the children of this spec.
|
141
137
|
|
@@ -143,11 +139,6 @@ class MiniTest::Spec < MiniTest::Unit::TestCase
|
|
143
139
|
@children ||= []
|
144
140
|
end
|
145
141
|
|
146
|
-
def initialize name # :nodoc:
|
147
|
-
super
|
148
|
-
@@current_spec = self
|
149
|
-
end
|
150
|
-
|
151
142
|
def self.nuke_test_methods! # :nodoc:
|
152
143
|
self.public_instance_methods.grep(/^test_/).each do |name|
|
153
144
|
self.send :undef_method, name
|
data/lib/minitest/unit.rb
CHANGED
@@ -645,7 +645,7 @@ module MiniTest
|
|
645
645
|
end
|
646
646
|
|
647
647
|
class Unit
|
648
|
-
VERSION = "2.
|
648
|
+
VERSION = "2.7.0" # :nodoc:
|
649
649
|
|
650
650
|
attr_accessor :report, :failures, :errors, :skips # :nodoc:
|
651
651
|
attr_accessor :test_count, :assertion_count # :nodoc:
|
@@ -997,6 +997,11 @@ module MiniTest
|
|
997
997
|
@__name__ = name
|
998
998
|
@__io__ = nil
|
999
999
|
@passed = nil
|
1000
|
+
@@current = self
|
1001
|
+
end
|
1002
|
+
|
1003
|
+
def self.current # :nodoc:
|
1004
|
+
@@current
|
1000
1005
|
end
|
1001
1006
|
|
1002
1007
|
def io
|
data/test/test_minitest_mock.rb
CHANGED
@@ -141,6 +141,18 @@ class TestMiniTestMock < MiniTest::Unit::TestCase
|
|
141
141
|
util_verify_bad
|
142
142
|
end
|
143
143
|
|
144
|
+
def test_verify_shows_the_actual_arguments_in_the_message
|
145
|
+
mock = MiniTest::Mock.new
|
146
|
+
mock.expect :capitalized, true, ["Foobar"]
|
147
|
+
mock.capitalized "foobaz"
|
148
|
+
e = assert_raises MockExpectationError do
|
149
|
+
mock.verify
|
150
|
+
end
|
151
|
+
|
152
|
+
expected = "expected capitalized, {:retval=>true, :args=>[\"Foobar\"]}, got [{:retval=>true, :args=>[\"foobaz\"]}]"
|
153
|
+
assert_equal expected, e.message
|
154
|
+
end
|
155
|
+
|
144
156
|
def util_verify_bad
|
145
157
|
assert_raises MockExpectationError do
|
146
158
|
@mock.verify
|
data/test/test_minitest_unit.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
require 'stringio'
|
2
2
|
require 'pathname'
|
3
|
-
require 'minitest/
|
4
|
-
|
5
|
-
MiniTest::Unit.autorun
|
3
|
+
require 'minitest/autorun'
|
6
4
|
|
7
5
|
module MyModule; end
|
8
6
|
class AnError < StandardError; include MyModule; end
|
@@ -1204,6 +1202,18 @@ FILE:LINE:in `test_assert_raises_triggered_subclass'
|
|
1204
1202
|
assert_equal [ATestCase], MiniTest::Unit::TestCase.test_suites
|
1205
1203
|
end
|
1206
1204
|
|
1205
|
+
def test_expectation
|
1206
|
+
@assertion_count = 2
|
1207
|
+
|
1208
|
+
@tc.assert_equal true, 1.must_equal(1)
|
1209
|
+
end
|
1210
|
+
|
1211
|
+
def test_expectation_triggered
|
1212
|
+
util_assert_triggered "Expected: 2\n Actual: 1" do
|
1213
|
+
1.must_equal 2
|
1214
|
+
end
|
1215
|
+
end
|
1216
|
+
|
1207
1217
|
def test_flunk
|
1208
1218
|
util_assert_triggered 'Epic Fail!' do
|
1209
1219
|
@tc.flunk
|
metadata
CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 2.
|
8
|
+
- 7
|
9
|
+
- 0
|
10
|
+
version: 2.7.0
|
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-10-
|
39
|
+
date: 2011-10-26 00:00:00 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: hoe
|
metadata.gz.sig
CHANGED
Binary file
|