2008-11-24 05:25:28 -05:00
|
|
|
require 'abstract_unit'
|
|
|
|
require 'rails/backtrace_cleaner'
|
|
|
|
|
2012-05-02 06:56:13 -04:00
|
|
|
class BacktraceCleanerVendorGemTest < ActiveSupport::TestCase
|
|
|
|
def setup
|
|
|
|
@cleaner = Rails::BacktraceCleaner.new
|
|
|
|
end
|
|
|
|
|
|
|
|
test "should format installed gems correctly" do
|
|
|
|
@backtrace = [ "#{Gem.path[0]}/gems/nosuchgem-1.2.3/lib/foo.rb" ]
|
|
|
|
@result = @cleaner.clean(@backtrace, :all)
|
|
|
|
assert_equal "nosuchgem (1.2.3) lib/foo.rb", @result[0]
|
|
|
|
end
|
2009-03-05 15:48:56 -05:00
|
|
|
|
2012-05-02 06:56:13 -04:00
|
|
|
test "should format installed gems not in Gem.default_dir correctly" do
|
|
|
|
@target_dir = Gem.path.detect { |p| p != Gem.default_dir }
|
|
|
|
# skip this test if default_dir is the only directory on Gem.path
|
|
|
|
if @target_dir
|
|
|
|
@backtrace = [ "#{@target_dir}/gems/nosuchgem-1.2.3/lib/foo.rb" ]
|
2010-01-16 22:34:35 -05:00
|
|
|
@result = @cleaner.clean(@backtrace, :all)
|
2009-03-05 15:48:56 -05:00
|
|
|
assert_equal "nosuchgem (1.2.3) lib/foo.rb", @result[0]
|
|
|
|
end
|
2009-10-20 10:32:26 -04:00
|
|
|
end
|
2009-03-05 15:48:56 -05:00
|
|
|
end
|