Changes necessary to run the T::U tests with the rspec runner

上级 a501638e
......@@ -67,12 +67,21 @@ class Rack::TestCase < ActiveSupport::TestCase
ActionController::Routing.use_controllers!(controllers)
end
def self.describe(text)
class_eval <<-RUBY_EVAL
def self.name
"#{text}"
end
RUBY_EVAL
unless method_defined?(:describe)
def self.describe(text)
class_eval <<-RUBY_EVAL
def self.name
"#{text}"
end
RUBY_EVAL
end
end
if defined?(Spec)
class << self
undef test
alias_method :test, :it
end
end
def app
......
......@@ -39,6 +39,14 @@ module ForClassicTestUnit
# For compatibility with Ruby < 1.8.6
PASSTHROUGH_EXCEPTIONS = Test::Unit::TestCase::PASSTHROUGH_EXCEPTIONS rescue [NoMemoryError, SignalException, Interrupt, SystemExit]
def setup
run_callbacks :setup
end
def teardown
run_callbacks :teardown, :enumerator => :reverse_each
end
# This redefinition is unfortunate but test/unit shows us no alternative.
# Doubly unfortunate: hax to support Mocha's hax.
def run(result)
......@@ -52,7 +60,7 @@ def run(result)
@_result = result
begin
begin
run_callbacks :setup
# run_callbacks :setup
setup
__send__(@method_name)
mocha_verify(assertion_counter) if using_mocha
......@@ -66,7 +74,7 @@ def run(result)
ensure
begin
teardown
run_callbacks :teardown, :enumerator => :reverse_each
# run_callbacks :teardown, :enumerator => :reverse_each
rescue Test::Unit::AssertionFailedError => e
add_failure(e.message, e.backtrace)
rescue Exception => e
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册