Skip to content

Commit

Permalink
Changes necessary to run the T::U tests with the rspec runner
Browse files Browse the repository at this point in the history
  • Loading branch information
wycats committed Apr 6, 2009
1 parent a501638 commit 4d3cd9b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
21 changes: 15 additions & 6 deletions actionpack/test/new_base/test_helper.rb
Expand Up @@ -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
Expand Down
12 changes: 10 additions & 2 deletions activesupport/lib/active_support/testing/setup_and_teardown.rb
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 4d3cd9b

Please sign in to comment.