This project is archived and is in readonly mode.

#3249 ✓resolved
CancelProfileIsBroken

BacktraceCleaner test makes bad assumption about gems

Reported by CancelProfileIsBroken | September 23rd, 2009 @ 01:02 PM

Currently we test the Rails implementation of BacktraceCleaner to see whether it properly cleans gem traces:

  test "should format installed gems correctly" do
    @backtrace = [ "#{Gem.default_dir}/gems/nosuchgem-1.2.3/lib/foo.rb" ]
    @result = @cleaner.clean(@backtrace)
    assert_equal "nosuchgem (1.2.3) lib/foo.rb", @result[0]
  end

However, when we actually build the list of backtrace filters to use, we do it from the array of gem search paths:

Gem.path.each do |path|
... build filter ...

The problem is that Gem.default_dir is not guaranteed to be on the Gem.path list (see http://rubygems.rubyforge.org/rdoc/Gem.html and look at how the two are build), so the test can fail even though the filters are built properly, depending on your Gem install.

The correct change is to fix the test, because when the app is running it'll get gems from the search path. Attached patch does so by testing on Gem.path[0] rather than Gem.default_dir. Applies cleanly to both 2-3-stable and master (and should be applied to both).

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Referenced by

Pages