2008-11-23 17:48:36 -05:00
|
|
|
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'
|
2009-02-02 14:49:32 -05:00
|
|
|
require 'active_support/testing/pending'
|
2009-06-30 15:00:50 -04:00
|
|
|
require 'active_support/testing/isolation'
|
2008-11-23 17:48:36 -05:00
|
|
|
|
2009-07-01 14:53:17 -04:00
|
|
|
begin
|
|
|
|
require 'mocha'
|
|
|
|
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
|
|
|
|
|
2008-11-22 22:18:30 -05:00
|
|
|
module ActiveSupport
|
|
|
|
class TestCase < ::Test::Unit::TestCase
|
|
|
|
if defined? MiniTest
|
2008-11-07 13:26:28 -05:00
|
|
|
Assertion = MiniTest::Assertion
|
2009-07-19 01:36:44 -04:00
|
|
|
alias_method :method_name, :name if method_defined? :name
|
|
|
|
alias_method :method_name, :__name__ if method_defined? :__name__
|
2008-11-22 22:18:30 -05:00
|
|
|
else
|
|
|
|
# TODO: Figure out how to get the Rails::BacktraceFilter into minitest/unit
|
2009-03-03 22:10:12 -05:00
|
|
|
if defined?(Rails) && ENV['BACKTRACE'].nil?
|
2008-11-22 22:18:30 -05:00
|
|
|
require 'rails/backtrace_cleaner'
|
|
|
|
Test::Unit::Util::BacktraceFilter.module_eval { include Rails::BacktraceFilterForTestUnit }
|
|
|
|
end
|
2008-11-22 12:06:08 -05:00
|
|
|
|
2008-11-07 13:26:28 -05:00
|
|
|
Assertion = Test::Unit::AssertionFailedError
|
2008-11-22 22:18:30 -05:00
|
|
|
|
|
|
|
require 'active_support/testing/default'
|
2008-11-07 12:45:48 -05:00
|
|
|
include ActiveSupport::Testing::Default
|
2008-11-22 22:18:30 -05:00
|
|
|
end
|
2008-11-07 12:45:48 -05:00
|
|
|
|
2009-05-20 19:52:56 -04:00
|
|
|
$tags = {}
|
|
|
|
def self.for_tag(tag)
|
|
|
|
yield if $tags[tag]
|
|
|
|
end
|
|
|
|
|
2008-11-07 12:45:48 -05:00
|
|
|
include ActiveSupport::Testing::SetupAndTeardown
|
|
|
|
include ActiveSupport::Testing::Assertions
|
2008-11-23 16:11:07 -05:00
|
|
|
include ActiveSupport::Testing::Deprecation
|
2009-02-02 14:49:32 -05:00
|
|
|
include ActiveSupport::Testing::Pending
|
2008-11-07 12:45:48 -05:00
|
|
|
extend ActiveSupport::Testing::Declarative
|
|
|
|
end
|
2008-11-22 22:18:30 -05:00
|
|
|
end
|