minitest 3.5.0 → 4.0.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 +16 -0
- data/lib/minitest/mock.rb +10 -2
- data/lib/minitest/pride.rb +1 -1
- data/lib/minitest/unit.rb +3 -5
- data/test/minitest/test_minitest_mock.rb +26 -0
- data/test/minitest/test_minitest_unit.rb +2 -2
- metadata +5 -5
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
=== 4.0.0 / 2012-09-28
|
2
|
+
|
3
|
+
* 1 major enhancement:
|
4
|
+
|
5
|
+
* The names of a privately-used undocumented constants are Super Important™.
|
6
|
+
|
7
|
+
* 1 minor enhancement:
|
8
|
+
|
9
|
+
* Support stubbing methods that would be handled via method_missing. (jhsu)
|
10
|
+
|
11
|
+
* 3 bug fixes:
|
12
|
+
|
13
|
+
* Add include_private param to MiniTest::Mock#respond_to? (rf-)
|
14
|
+
* Fixed use of minitest/pride with --help. (zw963)
|
15
|
+
* Made 'No visible difference.' message more clear. (ckrailo)
|
16
|
+
|
1
17
|
=== 3.5.0 / 2012-09-21
|
2
18
|
|
3
19
|
* 1 minor enhancement:
|
data/lib/minitest/mock.rb
CHANGED
@@ -120,9 +120,9 @@ module MiniTest
|
|
120
120
|
retval
|
121
121
|
end
|
122
122
|
|
123
|
-
def respond_to?(sym) # :nodoc:
|
123
|
+
def respond_to?(sym, include_private = false) # :nodoc:
|
124
124
|
return true if @expected_calls.has_key?(sym.to_sym)
|
125
|
-
return __respond_to?(sym)
|
125
|
+
return __respond_to?(sym, include_private)
|
126
126
|
end
|
127
127
|
end
|
128
128
|
end
|
@@ -148,7 +148,15 @@ class Object # :nodoc:
|
|
148
148
|
new_name = "__minitest_stub__#{name}"
|
149
149
|
|
150
150
|
metaclass = class << self; self; end
|
151
|
+
|
152
|
+
if respond_to? name and not methods.map(&:to_s).include? name.to_s then
|
153
|
+
metaclass.send :define_method, name do |*args|
|
154
|
+
super(*args)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
151
158
|
metaclass.send :alias_method, new_name, name
|
159
|
+
|
152
160
|
metaclass.send :define_method, name do |*args|
|
153
161
|
if val_or_callable.respond_to? :call then
|
154
162
|
val_or_callable.call(*args)
|
data/lib/minitest/pride.rb
CHANGED
data/lib/minitest/unit.rb
CHANGED
@@ -61,14 +61,12 @@ module MiniTest
|
|
61
61
|
"UNDEFINED" # again with the rdoc bugs... :(
|
62
62
|
end
|
63
63
|
|
64
|
-
WINDOZE = RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ # :nodoc:
|
65
|
-
|
66
64
|
##
|
67
65
|
# Returns the diff command to use in #diff. Tries to intelligently
|
68
66
|
# figure out what diff to use.
|
69
67
|
|
70
68
|
def self.diff
|
71
|
-
@diff = if
|
69
|
+
@diff = if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ then
|
72
70
|
"diff.exe -u"
|
73
71
|
else
|
74
72
|
if system("gdiff", __FILE__, __FILE__)
|
@@ -129,7 +127,7 @@ module MiniTest
|
|
129
127
|
if result.empty? then
|
130
128
|
klass = exp.class
|
131
129
|
result = [
|
132
|
-
"No visible difference.",
|
130
|
+
"No visible difference in the #{klass}#inspect output.",
|
133
131
|
"You should look at your implementation of #{klass}#==.",
|
134
132
|
expect
|
135
133
|
].join "\n"
|
@@ -696,7 +694,7 @@ module MiniTest
|
|
696
694
|
end
|
697
695
|
|
698
696
|
class Unit # :nodoc:
|
699
|
-
VERSION = "
|
697
|
+
VERSION = "4.0.0" # :nodoc:
|
700
698
|
|
701
699
|
attr_accessor :report, :failures, :errors, :skips # :nodoc:
|
702
700
|
attr_accessor :test_count, :assertion_count # :nodoc:
|
@@ -96,6 +96,7 @@ class TestMiniTestMock < MiniTest::Unit::TestCase
|
|
96
96
|
|
97
97
|
def test_respond_appropriately
|
98
98
|
assert @mock.respond_to?(:foo)
|
99
|
+
assert @mock.respond_to?(:foo, true)
|
99
100
|
assert @mock.respond_to?('foo')
|
100
101
|
assert !@mock.respond_to?(:bar)
|
101
102
|
end
|
@@ -271,4 +272,29 @@ class TestMiniTestStub < MiniTest::Unit::TestCase
|
|
271
272
|
|
272
273
|
@tc.assert_equal "bar", val
|
273
274
|
end
|
275
|
+
|
276
|
+
def test_dynamic_method
|
277
|
+
@assertion_count = 2
|
278
|
+
|
279
|
+
dynamic = Class.new do
|
280
|
+
def self.respond_to?(meth)
|
281
|
+
meth == :found
|
282
|
+
end
|
283
|
+
|
284
|
+
def self.method_missing(meth, *args, &block)
|
285
|
+
if meth == :found
|
286
|
+
false
|
287
|
+
else
|
288
|
+
super
|
289
|
+
end
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
293
|
+
val = dynamic.stub(:found, true) do |s|
|
294
|
+
s.found
|
295
|
+
end
|
296
|
+
|
297
|
+
@tc.assert_equal true, val
|
298
|
+
@tc.assert_equal false, dynamic.found
|
299
|
+
end
|
274
300
|
end
|
@@ -660,7 +660,7 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
|
|
660
660
|
o1 = Object.new
|
661
661
|
o2 = Object.new
|
662
662
|
|
663
|
-
msg = "No visible difference.
|
663
|
+
msg = "No visible difference in the Object#inspect output.
|
664
664
|
You should look at your implementation of Object#==.
|
665
665
|
#<Object:0xXXXXXX>".gsub(/^ +/, "")
|
666
666
|
|
@@ -686,7 +686,7 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
|
|
686
686
|
end
|
687
687
|
|
688
688
|
def test_assert_equal_different_long_invisible
|
689
|
-
msg = "No visible difference.
|
689
|
+
msg = "No visible difference in the String#inspect output.
|
690
690
|
You should look at your implementation of String#==.
|
691
691
|
\"blahblahblahblahblahblahblahblahblahblah\"".gsub(/^ +/, "")
|
692
692
|
|
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: 63
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
|
-
-
|
8
|
-
- 5
|
7
|
+
- 4
|
9
8
|
- 0
|
10
|
-
|
9
|
+
- 0
|
10
|
+
version: 4.0.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: 2012-09-
|
39
|
+
date: 2012-09-29 00:00:00 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rdoc
|
metadata.gz.sig
CHANGED
Binary file
|