2008-06-10 17:01:05 -04:00
|
|
|
require 'active_support/testing/setup_and_teardown'
|
|
|
|
require 'active_support/testing/assertions'
|
2008-11-07 12:45:48 -05:00
|
|
|
require 'active_support/testing/declarative'
|
2008-01-05 08:34:15 -05:00
|
|
|
|
2007-10-25 22:21:21 -04:00
|
|
|
module ActiveSupport
|
2008-11-07 12:45:48 -05:00
|
|
|
# Prefer MiniTest with Test::Unit compatibility.
|
|
|
|
begin
|
|
|
|
require 'minitest/unit'
|
2008-11-07 12:58:42 -05:00
|
|
|
|
|
|
|
# Hack around the test/unit autorun.
|
2008-11-17 15:28:43 -05:00
|
|
|
autorun_enabled = MiniTest::Unit.send(:class_variable_get, '@@installed_at_exit')
|
|
|
|
if MiniTest::Unit.respond_to?(:disable_autorun)
|
|
|
|
MiniTest::Unit.disable_autorun
|
|
|
|
else
|
|
|
|
MiniTest::Unit.send(:class_variable_set, '@@installed_at_exit', false)
|
|
|
|
end
|
2008-11-07 12:45:48 -05:00
|
|
|
require 'test/unit'
|
2008-11-17 15:28:43 -05:00
|
|
|
MiniTest::Unit.send(:class_variable_set, '@@installed_at_exit', autorun_enabled)
|
2008-11-07 12:45:48 -05:00
|
|
|
|
2008-11-07 13:26:28 -05:00
|
|
|
class TestCase < ::Test::Unit::TestCase
|
|
|
|
Assertion = MiniTest::Assertion
|
|
|
|
end
|
2008-11-07 12:45:48 -05:00
|
|
|
|
2008-11-22 12:06:08 -05:00
|
|
|
# TODO: Figure out how to get the Rails::BacktraceFilter into minitest/unit
|
2008-11-07 12:45:48 -05:00
|
|
|
# Test::Unit compatibility.
|
|
|
|
rescue LoadError
|
|
|
|
require 'test/unit/testcase'
|
|
|
|
require 'active_support/testing/default'
|
2008-06-10 17:01:05 -04:00
|
|
|
|
2008-11-22 12:06:08 -05:00
|
|
|
if defined?(Rails)
|
|
|
|
require 'rails/backtrace_cleaner'
|
|
|
|
Test::Unit::Util::BacktraceFilter.module_eval { include Rails::BacktraceFilterForTestUnit }
|
|
|
|
end
|
|
|
|
|
2008-11-07 12:45:48 -05:00
|
|
|
class TestCase < ::Test::Unit::TestCase
|
2008-11-07 13:26:28 -05:00
|
|
|
Assertion = Test::Unit::AssertionFailedError
|
2008-11-07 12:45:48 -05:00
|
|
|
include ActiveSupport::Testing::Default
|
2008-11-22 12:06:08 -05:00
|
|
|
end
|
2007-10-25 22:21:21 -04:00
|
|
|
end
|
2008-11-07 12:45:48 -05:00
|
|
|
|
|
|
|
class TestCase
|
|
|
|
include ActiveSupport::Testing::SetupAndTeardown
|
|
|
|
include ActiveSupport::Testing::Assertions
|
|
|
|
extend ActiveSupport::Testing::Declarative
|
|
|
|
end
|
2008-11-22 12:06:08 -05:00
|
|
|
end
|