minitest 4.7.2 → 4.7.3

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 CHANGED
Binary file
@@ -1,3 +1,9 @@
1
+ === 4.7.3 / 2013-04-20
2
+
3
+ * 1 bug fix:
4
+
5
+ * Reverted stubbing of module methods change. Stub the user, not the impl. (ab9/tyabe)
6
+
1
7
  === 4.7.2 / 2013-04-18
2
8
 
3
9
  * 2 bug fixes:
@@ -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 = self.class == Module ? self : class << self; self; end
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|
@@ -731,7 +731,7 @@ module MiniTest
731
731
  end
732
732
 
733
733
  class Unit # :nodoc:
734
- VERSION = "4.7.2" # :nodoc:
734
+ VERSION = "4.7.3" # :nodoc:
735
735
 
736
736
  attr_accessor :report, :failures, :errors, :skips # :nodoc:
737
737
  attr_accessor :assertion_count # :nodoc:
@@ -300,18 +300,40 @@ class TestMiniTestStub < MiniTest::Unit::TestCase
300
300
  end
301
301
  end
302
302
 
303
- def test_stub_module
303
+ def test_stub_private_module_method
304
304
  @assertion_count += 1
305
305
 
306
306
  t0 = Time.now
307
307
 
308
- Kernel.stub :sleep, nil do
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: 39
4
+ hash: 37
5
5
  prerelease:
6
6
  segments:
7
7
  - 4
8
8
  - 7
9
- - 2
10
- version: 4.7.2
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-18 00:00:00 Z
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