minitest 4.7.2 → 4.7.3
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 +6 -0
- data/lib/minitest/mock.rb +1 -1
- data/lib/minitest/unit.rb +1 -1
- data/test/minitest/test_minitest_mock.rb +24 -2
- metadata +4 -4
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
data/lib/minitest/mock.rb
CHANGED
@@ -166,7 +166,7 @@ class Object # :nodoc:
|
|
166
166
|
def stub name, val_or_callable, &block
|
167
167
|
new_name = "__minitest_stub__#{name}"
|
168
168
|
|
169
|
-
metaclass =
|
169
|
+
metaclass = class << self; self; end
|
170
170
|
|
171
171
|
if respond_to? name and not methods.map(&:to_s).include? name.to_s then
|
172
172
|
metaclass.send :define_method, name do |*args|
|
data/lib/minitest/unit.rb
CHANGED
@@ -300,18 +300,40 @@ class TestMiniTestStub < MiniTest::Unit::TestCase
|
|
300
300
|
end
|
301
301
|
end
|
302
302
|
|
303
|
-
def
|
303
|
+
def test_stub_private_module_method
|
304
304
|
@assertion_count += 1
|
305
305
|
|
306
306
|
t0 = Time.now
|
307
307
|
|
308
|
-
|
308
|
+
self.stub :sleep, nil do
|
309
309
|
@tc.assert_nil sleep(10)
|
310
310
|
end
|
311
311
|
|
312
312
|
@tc.assert_operator Time.now - t0, :<=, 1
|
313
313
|
end
|
314
314
|
|
315
|
+
def test_stub_private_module_method_indirect
|
316
|
+
@assertion_count += 1
|
317
|
+
|
318
|
+
slow_clapper = Class.new do
|
319
|
+
def slow_clap
|
320
|
+
sleep 3
|
321
|
+
:clap
|
322
|
+
end
|
323
|
+
end.new
|
324
|
+
|
325
|
+
slow_clapper.stub :sleep, nil do |fast_clapper|
|
326
|
+
@tc.assert_equal :clap, fast_clapper.slow_clap # either form works
|
327
|
+
@tc.assert_equal :clap, slow_clapper.slow_clap # yay closures
|
328
|
+
end
|
329
|
+
end
|
330
|
+
|
331
|
+
def test_stub_public_module_method
|
332
|
+
Math.stub(:log10, 42.0) do
|
333
|
+
@tc.assert_in_delta 42.0, Math.log10(1000)
|
334
|
+
end
|
335
|
+
end
|
336
|
+
|
315
337
|
def test_stub_value
|
316
338
|
assert_stub 42
|
317
339
|
end
|
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: 37
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 4
|
8
8
|
- 7
|
9
|
-
-
|
10
|
-
version: 4.7.
|
9
|
+
- 3
|
10
|
+
version: 4.7.3
|
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: 2013-04-
|
39
|
+
date: 2013-04-21 00:00:00 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rdoc
|
metadata.gz.sig
CHANGED
Binary file
|