aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2008-11-23 14:48:36 -0800
committerJeremy Kemper <jeremy@bitsweat.net>2008-11-23 15:05:59 -0800
commite931012287df0bca83cae04d95c2e0835ae08758 (patch)
tree46af916792dbd3a74883b4e1b572dd432cee4a59 /activesupport/lib
parent5d3712a81e502f46b2745d238d9bb76fcdb31f5b (diff)
downloadrails-e931012287df0bca83cae04d95c2e0835ae08758.tar.gz
rails-e931012287df0bca83cae04d95c2e0835ae08758.tar.bz2
rails-e931012287df0bca83cae04d95c2e0835ae08758.zip
Require Mocha >= 0.9.3 which includes a MiniTest adapter
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/test_case.rb18
-rw-r--r--activesupport/lib/active_support/testing/mocha_minitest_adapter.rb45
2 files changed, 7 insertions, 56 deletions
diff --git a/activesupport/lib/active_support/test_case.rb b/activesupport/lib/active_support/test_case.rb
index 90c6aff215..1cc8564a18 100644
--- a/activesupport/lib/active_support/test_case.rb
+++ b/activesupport/lib/active_support/test_case.rb
@@ -1,22 +1,18 @@
-require 'test/unit/testcase'
-require 'active_support/testing/setup_and_teardown'
-require 'active_support/testing/assertions'
-require 'active_support/testing/deprecation'
-require 'active_support/testing/declarative'
-
begin
- gem 'mocha', '>= 0.9.0'
+ gem 'mocha', '>= 0.9.3'
require 'mocha'
-
- if defined?(MiniTest)
- require 'active_support/testing/mocha_minitest_adapter'
- end
rescue LoadError
# Fake Mocha::ExpectationError so we can rescue it in #run. Bleh.
Object.const_set :Mocha, Module.new
Mocha.const_set :ExpectationError, Class.new(StandardError)
end
+require 'test/unit/testcase'
+require 'active_support/testing/setup_and_teardown'
+require 'active_support/testing/assertions'
+require 'active_support/testing/deprecation'
+require 'active_support/testing/declarative'
+
module ActiveSupport
class TestCase < ::Test::Unit::TestCase
if defined? MiniTest
diff --git a/activesupport/lib/active_support/testing/mocha_minitest_adapter.rb b/activesupport/lib/active_support/testing/mocha_minitest_adapter.rb
deleted file mode 100644
index a96ce74526..0000000000
--- a/activesupport/lib/active_support/testing/mocha_minitest_adapter.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-class MiniTest::Unit::TestCase
- include Mocha::Standalone
-
- class MochaAssertionCounter
- def initialize(runner) @runner = runner end
- def increment; @runner.assertion_count += 1 end
- end
-
- def run(runner)
- assertion_counter = MochaAssertionCounter.new(runner)
- result = '.'
- begin
- begin
- @passed = nil
- setup
- __send__ name
- mocha_verify(assertion_counter)
- @passed = true
- rescue Exception => e
- @passed = false
- result = runner.puke(self.class, self.name, e)
- ensure
- begin
- teardown
- rescue Exception => e
- result = runner.puke(self.class, self.name, e)
- end
- end
- ensure
- mocha_teardown
- end
- result
- end
-end
-
-module Test
- module Unit
- remove_const :TestCase
-
- class TestCase < MiniTest::Unit::TestCase
- include Test::Unit::Assertions
- def self.test_order; :sorted end
- end
- end
-end