mocha 0.12.10 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. data/.yardopts +22 -0
  2. data/COPYING.md +3 -0
  3. data/{MIT-LICENSE.rdoc → MIT-LICENSE.md} +0 -0
  4. data/README.md +230 -0
  5. data/{RELEASE.rdoc → RELEASE.md} +61 -56
  6. data/Rakefile +45 -37
  7. data/build-matrix.rb +16 -4
  8. data/lib/mocha.rb +6 -2
  9. data/lib/mocha/api.rb +13 -16
  10. data/lib/mocha/class_method.rb +7 -3
  11. data/lib/mocha/class_methods.rb +63 -0
  12. data/lib/mocha/debug.rb +11 -0
  13. data/lib/mocha/deprecation.rb +1 -1
  14. data/lib/mocha/exception_raiser.rb +1 -1
  15. data/lib/mocha/expectation_error.rb +5 -0
  16. data/lib/mocha/expectation_error_factory.rb +19 -0
  17. data/lib/mocha/hooks.rb +43 -0
  18. data/lib/mocha/integration.rb +6 -38
  19. data/lib/mocha/integration/assertion_counter.rb +13 -0
  20. data/lib/mocha/integration/mini_test.rb +42 -60
  21. data/lib/mocha/integration/mini_test/adapter.rb +54 -0
  22. data/lib/mocha/integration/mini_test/exception_translation.rb +0 -6
  23. data/lib/mocha/integration/mini_test/nothing.rb +19 -0
  24. data/lib/mocha/integration/mini_test/version_13.rb +32 -25
  25. data/lib/mocha/integration/mini_test/version_140.rb +32 -26
  26. data/lib/mocha/integration/mini_test/version_141.rb +40 -34
  27. data/lib/mocha/integration/mini_test/version_142_to_172.rb +40 -34
  28. data/lib/mocha/integration/mini_test/version_200.rb +41 -35
  29. data/lib/mocha/integration/mini_test/version_201_to_222.rb +41 -35
  30. data/lib/mocha/integration/mini_test/version_2110_to_2111.rb +49 -43
  31. data/lib/mocha/integration/mini_test/version_2112_to_320.rb +53 -47
  32. data/lib/mocha/integration/mini_test/version_230_to_2101.rb +43 -37
  33. data/lib/mocha/integration/monkey_patcher.rb +18 -0
  34. data/lib/mocha/integration/test_unit.rb +38 -45
  35. data/lib/mocha/integration/test_unit/adapter.rb +51 -0
  36. data/lib/mocha/integration/test_unit/gem_version_200.rb +36 -29
  37. data/lib/mocha/integration/test_unit/gem_version_201_to_202.rb +36 -29
  38. data/lib/mocha/integration/test_unit/gem_version_203_to_220.rb +36 -29
  39. data/lib/mocha/integration/test_unit/gem_version_230_to_250.rb +65 -0
  40. data/lib/mocha/integration/test_unit/nothing.rb +19 -0
  41. data/lib/mocha/integration/test_unit/ruby_version_185_and_below.rb +36 -29
  42. data/lib/mocha/integration/test_unit/ruby_version_186_and_above.rb +37 -30
  43. data/lib/mocha/method_matcher.rb +1 -1
  44. data/lib/mocha/module_methods.rb +14 -0
  45. data/lib/mocha/{object.rb → object_methods.rb} +0 -83
  46. data/lib/mocha/setup.rb +10 -0
  47. data/lib/mocha/standalone.rb +3 -0
  48. data/lib/mocha/version.rb +1 -1
  49. data/lib/mocha_standalone.rb +3 -1
  50. data/mocha.gemspec +16 -9
  51. data/test/acceptance/bug_18914_test.rb +1 -1
  52. data/test/acceptance/bug_21465_test.rb +1 -1
  53. data/test/acceptance/bug_21563_test.rb +1 -1
  54. data/test/acceptance/exception_rescue_test.rb +1 -1
  55. data/test/acceptance/expectations_on_multiple_methods_test.rb +1 -1
  56. data/test/acceptance/expected_invocation_count_test.rb +1 -1
  57. data/test/acceptance/failure_messages_test.rb +1 -1
  58. data/test/acceptance/issue_65_test.rb +1 -1
  59. data/test/acceptance/issue_70_test.rb +1 -1
  60. data/test/acceptance/mocha_example_test.rb +1 -1
  61. data/test/acceptance/mocha_test_result_test.rb +1 -1
  62. data/test/acceptance/mock_test.rb +1 -1
  63. data/test/acceptance/mock_with_initializer_block_test.rb +1 -1
  64. data/test/acceptance/mocked_methods_dispatch_test.rb +1 -1
  65. data/test/acceptance/multiple_expectations_failure_message_test.rb +1 -1
  66. data/test/acceptance/optional_parameters_test.rb +1 -1
  67. data/test/acceptance/parameter_matcher_test.rb +1 -1
  68. data/test/acceptance/partial_mocks_test.rb +1 -1
  69. data/test/acceptance/raise_exception_test.rb +1 -1
  70. data/test/acceptance/return_value_test.rb +1 -1
  71. data/test/acceptance/sequence_test.rb +1 -1
  72. data/test/acceptance/states_test.rb +1 -1
  73. data/test/acceptance/stub_any_instance_method_test.rb +1 -1
  74. data/test/acceptance/stub_class_method_defined_on_active_record_association_proxy_test.rb +1 -1
  75. data/test/acceptance/stub_class_method_defined_on_class_test.rb +1 -1
  76. data/test/acceptance/stub_class_method_defined_on_module_test.rb +1 -1
  77. data/test/acceptance/stub_class_method_defined_on_superclass_test.rb +1 -1
  78. data/test/acceptance/stub_everything_test.rb +1 -1
  79. data/test/acceptance/stub_instance_method_defined_on_active_record_association_proxy_test.rb +1 -1
  80. data/test/acceptance/stub_instance_method_defined_on_class_and_aliased_test.rb +1 -1
  81. data/test/acceptance/stub_instance_method_defined_on_class_test.rb +1 -1
  82. data/test/acceptance/stub_instance_method_defined_on_kernel_module_test.rb +1 -1
  83. data/test/acceptance/stub_instance_method_defined_on_module_test.rb +1 -1
  84. data/test/acceptance/stub_instance_method_defined_on_object_class_test.rb +1 -1
  85. data/test/acceptance/stub_instance_method_defined_on_singleton_class_test.rb +1 -1
  86. data/test/acceptance/stub_instance_method_defined_on_superclass_test.rb +1 -1
  87. data/test/acceptance/stub_module_method_test.rb +1 -1
  88. data/test/acceptance/stub_test.rb +1 -1
  89. data/test/acceptance/stubba_example_test.rb +1 -1
  90. data/test/acceptance/stubba_test_result_test.rb +1 -1
  91. data/test/acceptance/stubbing_error_backtrace_test.rb +1 -1
  92. data/test/acceptance/stubbing_frozen_object_test.rb +1 -1
  93. data/test/acceptance/stubbing_method_accepting_block_parameter_test.rb +1 -1
  94. data/test/acceptance/stubbing_method_unnecessarily_test.rb +1 -1
  95. data/test/acceptance/stubbing_nil_test.rb +1 -1
  96. data/test/acceptance/stubbing_non_existent_any_instance_method_test.rb +1 -1
  97. data/test/acceptance/stubbing_non_existent_class_method_test.rb +1 -1
  98. data/test/acceptance/stubbing_non_existent_instance_method_test.rb +1 -1
  99. data/test/acceptance/stubbing_non_public_any_instance_method_test.rb +1 -1
  100. data/test/acceptance/stubbing_non_public_class_method_test.rb +1 -1
  101. data/test/acceptance/stubbing_non_public_instance_method_test.rb +1 -1
  102. data/test/acceptance/stubbing_on_non_mock_object_test.rb +1 -1
  103. data/test/acceptance/stubbing_same_class_method_on_parent_and_child_classes_test.rb +3 -3
  104. data/test/acceptance/throw_test.rb +1 -1
  105. data/test/acceptance/unstubbing_test.rb +1 -1
  106. data/test/integration/mini_test_test.rb +9 -0
  107. data/test/integration/shared_tests.rb +174 -0
  108. data/test/integration/test_unit_test.rb +9 -0
  109. data/test/mini_test_result.rb +0 -1
  110. data/test/test_runner.rb +14 -14
  111. data/test/unit/class_methods_test.rb +40 -0
  112. data/test/unit/method_matcher_test.rb +5 -0
  113. data/test/unit/mock_test.rb +6 -0
  114. data/test/unit/module_methods_test.rb +19 -0
  115. data/test/unit/object_methods_test.rb +45 -0
  116. metadata +45 -74
  117. data/COPYING.rdoc +0 -3
  118. data/README.rdoc +0 -56
  119. data/examples/misc.rb +0 -43
  120. data/examples/mocha.rb +0 -25
  121. data/examples/stubba.rb +0 -64
  122. data/gemfiles/Gemfile.minitest.3.3.0 +0 -7
  123. data/gemfiles/Gemfile.minitest.4.2.0 +0 -7
  124. data/lib/mocha/integration/mini_test/assertion_counter.rb +0 -23
  125. data/lib/mocha/integration/mini_test/version_330_to_410.rb +0 -65
  126. data/lib/mocha/integration/mini_test/version_420_to_433.rb +0 -70
  127. data/lib/mocha/integration/mini_test/version_440.rb +0 -70
  128. data/lib/mocha/integration/mini_test/version_450_to_461.rb +0 -72
  129. data/lib/mocha/integration/test_unit/assertion_counter.rb +0 -23
  130. data/lib/mocha/integration/test_unit/gem_version_230_to_254.rb +0 -58
  131. data/lib/mocha/options.rb +0 -1
  132. data/test/acceptance/api_test.rb +0 -139
  133. data/test/acceptance/minitest_test.rb +0 -162
  134. data/test/unit/object_test.rb +0 -92
@@ -1,3 +0,0 @@
1
- Copyright Revieworld Ltd. 2006
2
-
3
- You may use, copy and redistribute this library under the same terms as {Ruby itself}[http://www.ruby-lang.org/en/LICENSE.txt] or under the {file:MIT-LICENSE.rdoc MIT license}.
@@ -1,56 +0,0 @@
1
- = Mocha {<img src="https://secure.travis-ci.org/freerange/mocha.png" />}[http://travis-ci.org/freerange/mocha]
2
-
3
- Mocha is a library for mocking and stubbing using a syntax like that of {JMock}[http://www.jmock.org].
4
-
5
- It can be used with many testing frameworks e.g. {Test::Unit}[http://www.ruby-doc.org/core/classes/Test/Unit.html], {RSpec}[http://rspec.info/], {test/spec}[http://chneukirchen.org/repos/testspec/README], {expectations}[http://expectations.rubyforge.org/], {Dust}[http://dust.rubyforge.org/], {MiniTest}[http://rubyforge.org/projects/bfts] and even {JtestR}[http://jtestr.codehaus.org/].
6
-
7
- Mocha provides a unified, simple and readable syntax for both traditional mocking and partial mocking.
8
-
9
- Mocha was harvested from projects at {Reevoo}[http://www.reevoo.com/] by me ({James}[http://jamesmead.org/]) and my (then) colleagues {Ben}[http://www.techbelly.com/], {Chris}[http://chrisroos.co.uk/] and {Paul}[http://po-ru.com/].
10
-
11
- == Installation
12
-
13
- Install the latest version of the gem with the following command...
14
-
15
- $ gem install mocha
16
-
17
- Note that if you are intending to use Mocha with Test::Unit or MiniTest, you should only load Mocha *after* loading the relevant test library...
18
-
19
- require "test/unit"
20
- require "mocha"
21
-
22
- If you're using Bundler, ensure the correct load order by not auto-requiring Mocha in the Gemfile and then later load it once you know the test library has been loaded...
23
-
24
- # Gemfile
25
- gem "mocha", :require => false
26
-
27
- # Elsewhere after Bundler has loaded gems
28
- require "test/unit"
29
- require "mocha"
30
-
31
- Note that versions 0.10.2, 0.10.3 & 0.11.0 included a bug. Please do not use these versions.
32
-
33
- Or install the {Rails}[http://www.rubyonrails.org/] plugin...
34
-
35
- $ script/plugin install git://github.com/freerange/mocha.git
36
-
37
- Note that versions 0.9.6 & 0.9.7 of the Rails plugin were broken. As of version 0.9.8, you need to explicitly load Mocha after the test framework e.g. by adding "require 'mocha'" at the bottom of test/test_helper.rb.
38
-
39
- == Examples
40
-
41
- * Quick Start - {file:misc.rb Usage Examples}
42
- * Traditional mocking - {file:mocha.rb Star Trek Example}
43
- * Setting expectations on real classes - {file:stubba.rb Order Example}
44
- * More examples on {James Mead's Blog}[http://jamesmead.org/blog/]
45
- * {Mailing List Archives}[http://groups.google.com/group/mocha-developer]
46
-
47
- == Links
48
-
49
- * {Source code}[http://github.com/freerange/mocha]
50
- * {Bug reports}[http://github.com/freerange/mocha/issues]
51
-
52
- == License
53
-
54
- Copyright Revieworld Ltd. 2006
55
-
56
- You may use, copy and redistribute this library under the same terms as {Ruby itself}[http://www.ruby-lang.org/en/LICENSE.txt] or under the {file:MIT-LICENSE.rdoc MIT license}.
@@ -1,43 +0,0 @@
1
- require 'test/unit'
2
- require 'mocha'
3
-
4
- class MiscExampleTest < Test::Unit::TestCase
5
-
6
- def test_mocking_a_class_method
7
- product = Product.new
8
- Product.expects(:find).with(1).returns(product)
9
- assert_equal product, Product.find(1)
10
- end
11
-
12
- def test_mocking_an_instance_method_on_a_real_object
13
- product = Product.new
14
- product.expects(:save).returns(true)
15
- assert product.save
16
- end
17
-
18
- def test_stubbing_instance_methods_on_real_objects
19
- prices = [stub(:pence => 1000), stub(:pence => 2000)]
20
- product = Product.new
21
- product.stubs(:prices).returns(prices)
22
- assert_equal [1000, 2000], product.prices.collect {|p| p.pence}
23
- end
24
-
25
- def test_stubbing_an_instance_method_on_all_instances_of_a_class
26
- Product.any_instance.stubs(:name).returns('stubbed_name')
27
- product = Product.new
28
- assert_equal 'stubbed_name', product.name
29
- end
30
-
31
- def test_traditional_mocking
32
- object = mock()
33
- object.expects(:expected_method).with(:p1, :p2).returns(:result)
34
- assert_equal :result, object.expected_method(:p1, :p2)
35
- end
36
-
37
- def test_shortcuts
38
- object = stub(:method1 => :result1, :method2 => :result2)
39
- assert_equal :result1, object.method1
40
- assert_equal :result2, object.method2
41
- end
42
-
43
- end
@@ -1,25 +0,0 @@
1
- class Enterprise
2
-
3
- def initialize(dilithium)
4
- @dilithium = dilithium
5
- end
6
-
7
- def go(warp_factor)
8
- warp_factor.times { @dilithium.nuke(:anti_matter) }
9
- end
10
-
11
- end
12
-
13
- require 'test/unit'
14
- require 'mocha'
15
-
16
- class EnterpriseTest < Test::Unit::TestCase
17
-
18
- def test_should_boldly_go
19
- dilithium = mock()
20
- dilithium.expects(:nuke).with(:anti_matter).at_least_once # auto-verified at end of test
21
- enterprise = Enterprise.new(dilithium)
22
- enterprise.go(2)
23
- end
24
-
25
- end
@@ -1,64 +0,0 @@
1
- class Order
2
-
3
- attr_accessor :shipped_on
4
-
5
- def total_cost
6
- line_items.inject(0) { |total, line_item| total + line_item.price } + shipping_cost
7
- end
8
-
9
- def total_weight
10
- line_items.inject(0) { |total, line_item| total + line_item.weight }
11
- end
12
-
13
- def shipping_cost
14
- total_weight * 5 + 10
15
- end
16
-
17
- class << self
18
-
19
- def find_all
20
- # Database.connection.execute('select * from orders...
21
- end
22
-
23
- def number_shipped_since(date)
24
- find_all.select { |order| order.shipped_on > date }.length
25
- end
26
-
27
- def unshipped_value
28
- find_all.inject(0) { |total, order| order.shipped_on ? total : total + order.total_cost }
29
- end
30
-
31
- end
32
-
33
- end
34
-
35
- require 'test/unit'
36
- require 'mocha'
37
-
38
- class OrderTest < Test::Unit::TestCase
39
-
40
- # illustrates stubbing instance method
41
- def test_should_calculate_shipping_cost_based_on_total_weight
42
- order = Order.new
43
- order.stubs(:total_weight).returns(10)
44
- assert_equal 60, order.shipping_cost
45
- end
46
-
47
- # illustrates stubbing class method
48
- def test_should_count_number_of_orders_shipped_after_specified_date
49
- now = Time.now; week_in_secs = 7 * 24 * 60 * 60
50
- order_1 = Order.new; order_1.shipped_on = now - 1 * week_in_secs
51
- order_2 = Order.new; order_2.shipped_on = now - 3 * week_in_secs
52
- Order.stubs(:find_all).returns([order_1, order_2])
53
- assert_equal 1, Order.number_shipped_since(now - 2 * week_in_secs)
54
- end
55
-
56
- # illustrates stubbing instance method for all instances of a class
57
- def test_should_calculate_value_of_unshipped_orders
58
- Order.stubs(:find_all).returns([Order.new, Order.new, Order.new])
59
- Order.any_instance.stubs(:shipped_on).returns(nil)
60
- Order.any_instance.stubs(:total_cost).returns(10)
61
- assert_equal 30, Order.unshipped_value
62
- end
63
-
64
- end
@@ -1,7 +0,0 @@
1
- source :rubygems
2
-
3
- gemspec :path=>"../"
4
-
5
- group :development do
6
- gem "minitest", "3.3.0"
7
- end
@@ -1,7 +0,0 @@
1
- source :rubygems
2
-
3
- gemspec :path=>"../"
4
-
5
- group :development do
6
- gem "minitest", "4.2.0"
7
- end
@@ -1,23 +0,0 @@
1
- module Mocha
2
-
3
- module Integration
4
-
5
- module MiniTest
6
-
7
- class AssertionCounter
8
-
9
- def initialize(test_case)
10
- @test_case = test_case
11
- end
12
-
13
- def increment
14
- @test_case.assert(true)
15
- end
16
-
17
- end
18
-
19
- end
20
-
21
- end
22
-
23
- end
@@ -1,65 +0,0 @@
1
- require 'mocha/integration/mini_test/assertion_counter'
2
- require 'mocha/expectation_error'
3
-
4
- module Mocha
5
-
6
- module Integration
7
-
8
- module MiniTest
9
-
10
- module Version330To410
11
- def self.included(mod)
12
- $stderr.puts "Monkey patching MiniTest >= v3.3.0 <= v4.1.0" if $mocha_options['debug']
13
- end
14
- def run runner
15
- trap "INFO" do
16
- runner.report.each_with_index do |msg, i|
17
- warn "\n%3d) %s" % [i + 1, msg]
18
- end
19
- warn ''
20
- time = runner.start_time ? Time.now - runner.start_time : 0
21
- warn "Current Test: %s#%s %.2fs" % [self.class, self.__name__, time]
22
- runner.status $stderr
23
- end if ::MiniTest::Unit::TestCase::SUPPORTS_INFO_SIGNAL
24
- assertion_counter = AssertionCounter.new(self)
25
- result = ""
26
- begin
27
- begin
28
- @passed = nil
29
- self.before_setup
30
- self.setup
31
- self.after_setup
32
- self.run_test self.__name__
33
- mocha_verify(assertion_counter)
34
- result = "." unless io?
35
- @passed = true
36
- rescue *::MiniTest::Unit::TestCase::PASSTHROUGH_EXCEPTIONS
37
- raise
38
- rescue Exception => e
39
- @passed = false
40
- result = runner.puke self.class, self.__name__, Mocha::Integration::MiniTest.translate(e)
41
- ensure
42
- %w{ before_teardown teardown after_teardown }.each do |hook|
43
- begin
44
- self.send hook
45
- rescue *::MiniTest::Unit::TestCase::PASSTHROUGH_EXCEPTIONS
46
- raise
47
- rescue Exception => e
48
- @passed = false
49
- result = runner.puke self.class, self.__name__, Mocha::Integration::MiniTest.translate(e)
50
- end
51
- end
52
- trap 'INFO', 'DEFAULT' if ::MiniTest::Unit::TestCase::SUPPORTS_INFO_SIGNAL
53
- end
54
- ensure
55
- mocha_teardown
56
- end
57
- result
58
- end
59
- end
60
-
61
- end
62
-
63
- end
64
-
65
- end
@@ -1,70 +0,0 @@
1
- require 'mocha/integration/mini_test/assertion_counter'
2
- require 'mocha/expectation_error'
3
-
4
- module Mocha
5
-
6
- module Integration
7
-
8
- module MiniTest
9
-
10
- module Version420To433
11
- def self.included(mod)
12
- $stderr.puts "Monkey patching MiniTest >= v4.2.0 <= v4.3.3" if $mocha_options['debug']
13
- end
14
- def run runner
15
- trap "INFO" do
16
- runner.report.each_with_index do |msg, i|
17
- warn "\n%3d) %s" % [i + 1, msg]
18
- end
19
- warn ''
20
- time = runner.start_time ? Time.now - runner.start_time : 0
21
- warn "Current Test: %s#%s %.2fs" % [self.class, self.__name__, time]
22
- runner.status $stderr
23
- end if ::MiniTest::Unit::TestCase::SUPPORTS_INFO_SIGNAL
24
- start_time = Time.now
25
- assertion_counter = AssertionCounter.new(self)
26
- result = ""
27
- begin
28
- begin
29
- @passed = nil
30
- self.before_setup
31
- self.setup
32
- self.after_setup
33
- self.run_test self.__name__
34
- mocha_verify(assertion_counter)
35
- result = "." unless io?
36
- time = Time.now - start_time
37
- runner.record self.class, self.__name__, self._assertions, time, nil
38
- @passed = true
39
- rescue *::MiniTest::Unit::TestCase::PASSTHROUGH_EXCEPTIONS
40
- raise
41
- rescue Exception => e
42
- @passed = false
43
- time = Time.now - start_time
44
- runner.record self.class, self.__name__, self._assertions, time, e
45
- result = runner.puke self.class, self.__name__, Mocha::Integration::MiniTest.translate(e)
46
- ensure
47
- %w{ before_teardown teardown after_teardown }.each do |hook|
48
- begin
49
- self.send hook
50
- rescue *::MiniTest::Unit::TestCase::PASSTHROUGH_EXCEPTIONS
51
- raise
52
- rescue Exception => e
53
- @passed = false
54
- result = runner.puke self.class, self.__name__, Mocha::Integration::MiniTest.translate(e)
55
- end
56
- end
57
- trap 'INFO', 'DEFAULT' if ::MiniTest::Unit::TestCase::SUPPORTS_INFO_SIGNAL
58
- end
59
- ensure
60
- mocha_teardown
61
- end
62
- result
63
- end
64
- end
65
-
66
- end
67
-
68
- end
69
-
70
- end
@@ -1,70 +0,0 @@
1
- require 'mocha/integration/mini_test/assertion_counter'
2
- require 'mocha/expectation_error'
3
-
4
- module Mocha
5
-
6
- module Integration
7
-
8
- module MiniTest
9
-
10
- module Version440
11
- def self.included(mod)
12
- $stderr.puts "Monkey patching MiniTest >= v4.4.0 <= v4.4.0" if $mocha_options['debug']
13
- end
14
- def run runner
15
- trap "INFO" do
16
- runner.report.each_with_index do |msg, i|
17
- warn "\n%3d) %s" % [i + 1, msg]
18
- end
19
- warn ''
20
- time = runner.start_time ? Time.now - runner.start_time : 0
21
- warn "Current Test: %s#%s %.2fs" % [self.class, self.__name__, time]
22
- runner.status $stderr
23
- end if ::MiniTest::Unit::TestCase::SUPPORTS_INFO_SIGNAL
24
- start_time = Time.now
25
- assertion_counter = AssertionCounter.new(self)
26
- result = ""
27
- begin
28
- begin
29
- @passed = nil
30
- self.before_setup
31
- self.setup
32
- self.after_setup
33
- self.run_test self.__name__
34
- mocha_verify(assertion_counter)
35
- result = "." unless io?
36
- time = Time.now - start_time
37
- runner.record self.class, self.__name__, self._assertions, time, nil
38
- @passed = true
39
- rescue *::MiniTest::Unit::TestCase::PASSTHROUGH_EXCEPTIONS
40
- raise
41
- rescue Exception => e
42
- @passed = ::MiniTest::Skip === e
43
- time = Time.now - start_time
44
- runner.record self.class, self.__name__, self._assertions, time, e
45
- result = runner.puke self.class, self.__name__, Mocha::Integration::MiniTest.translate(e)
46
- ensure
47
- %w{ before_teardown teardown after_teardown }.each do |hook|
48
- begin
49
- self.send hook
50
- rescue *::MiniTest::Unit::TestCase::PASSTHROUGH_EXCEPTIONS
51
- raise
52
- rescue Exception => e
53
- @passed = false
54
- result = runner.puke self.class, self.__name__, Mocha::Integration::MiniTest.translate(e)
55
- end
56
- end
57
- trap 'INFO', 'DEFAULT' if ::MiniTest::Unit::TestCase::SUPPORTS_INFO_SIGNAL
58
- end
59
- ensure
60
- mocha_teardown
61
- end
62
- result
63
- end
64
- end
65
-
66
- end
67
-
68
- end
69
-
70
- end