Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Accept a prefix argument to filter_backtrace_with_cleaning [#1456 sta…
…te:committed] Add a prefix argument to filter_backtrace_with_cleaning so it has the same arity as test/unit's filter_backtrace. Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
- Loading branch information
Showing
3 changed files
with
34 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
require 'abstract_unit' | ||
|
||
require 'initializer' | ||
require 'rails/backtrace_cleaner' | ||
|
||
class TestWithBacktrace | ||
include Test::Unit::Util::BacktraceFilter | ||
include Rails::BacktraceFilterForTestUnit | ||
end | ||
|
||
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 | ||
end | ||
end |