2009-02-04 21:26:08 +01:00
|
|
|
require 'abstract_unit'
|
|
|
|
|
|
|
|
require 'initializer'
|
|
|
|
require 'rails/backtrace_cleaner'
|
|
|
|
|
2009-02-28 02:23:00 +01:00
|
|
|
if defined? Test::Unit::Util::BacktraceFilter
|
|
|
|
class TestWithBacktrace
|
|
|
|
include Test::Unit::Util::BacktraceFilter
|
|
|
|
include Rails::BacktraceFilterForTestUnit
|
2009-02-04 21:26:08 +01:00
|
|
|
end
|
2009-02-28 02:23:00 +01:00
|
|
|
|
|
|
|
class BacktraceCleanerFilterTest < ActiveSupport::TestCase
|
|
|
|
def setup
|
|
|
|
@test = TestWithBacktrace.new
|
|
|
|
@backtrace = [ './test/rails/benchmark_test.rb', './test/rails/dependencies.rb', '/opt/local/lib/ruby/kernel.rb' ]
|
|
|
|
end
|
|
|
|
|
|
|
|
test "test with backtrace should use the rails backtrace cleaner to clean" do
|
|
|
|
Rails.stubs(:backtrace_cleaner).returns(stub(:clean))
|
|
|
|
Rails.backtrace_cleaner.expects(:clean).with(@backtrace, nil)
|
|
|
|
@test.filter_backtrace(@backtrace)
|
|
|
|
end
|
|
|
|
|
|
|
|
test "filter backtrace should have the same arity as Test::Unit::Util::BacktraceFilter" do
|
|
|
|
assert_nothing_raised do
|
|
|
|
@test.filter_backtrace(@backtrace, '/opt/local/lib')
|
|
|
|
end
|
2009-02-04 21:26:08 +01:00
|
|
|
end
|
|
|
|
end
|
2009-02-28 02:23:00 +01:00
|
|
|
else
|
|
|
|
$stderr.puts 'No BacktraceFilter for minitest'
|
|
|
|
end
|