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