1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Add gem filter for default gem path since it maybe different than the set of gem paths

This commit is contained in:
Joshua Peek 2009-09-26 11:04:08 -05:00
parent 5eeed9f00a
commit 79a4d505fa
2 changed files with 3 additions and 3 deletions

View file

@ -32,7 +32,7 @@ module Rails
private private
def add_gem_filters def add_gem_filters
Gem.path.each do |path| (Gem.path + [Gem.default_dir]).uniq.each do |path|
# http://gist.github.com/30430 # http://gist.github.com/30430
add_filter { |line| line.sub(/(#{path})\/gems\/([a-z]+)-([0-9.]+)\/(.*)/, '\2 (\3) \4')} add_filter { |line| line.sub(/(#{path})\/gems\/([a-z]+)-([0-9.]+)\/(.*)/, '\2 (\3) \4')}
end end

View file

@ -14,13 +14,13 @@ if defined? Test::Unit::Util::BacktraceFilter
@test = TestWithBacktrace.new @test = TestWithBacktrace.new
@backtrace = [ './test/rails/benchmark_test.rb', './test/rails/dependencies.rb', '/opt/local/lib/ruby/kernel.rb' ] @backtrace = [ './test/rails/benchmark_test.rb', './test/rails/dependencies.rb', '/opt/local/lib/ruby/kernel.rb' ]
end end
test "test with backtrace should use the rails backtrace cleaner to clean" do test "test with backtrace should use the rails backtrace cleaner to clean" do
Rails.stubs(:backtrace_cleaner).returns(stub(:clean)) Rails.stubs(:backtrace_cleaner).returns(stub(:clean))
Rails.backtrace_cleaner.expects(:clean).with(@backtrace, nil) Rails.backtrace_cleaner.expects(:clean).with(@backtrace, nil)
@test.filter_backtrace(@backtrace) @test.filter_backtrace(@backtrace)
end end
test "filter backtrace should have the same arity as Test::Unit::Util::BacktraceFilter" do test "filter backtrace should have the same arity as Test::Unit::Util::BacktraceFilter" do
assert_nothing_raised do assert_nothing_raised do
@test.filter_backtrace(@backtrace, '/opt/local/lib') @test.filter_backtrace(@backtrace, '/opt/local/lib')