Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

BacktraceCleaner test makes bad assumption about gems

#3249

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).

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

State: resolved
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. CancelProfileIsBroken
    CancelProfileIsBroken
    • Tag set to backtracecleaner, bugmash, gem
    • Milestone cleared.
    • Assigned user cleared.

    September 25th, 2009 @ 11:52 AM

  2. Matt Jones
    Matt Jones

    Looks reasonable to me. As I recall, that code was written in one of my "gotta get this patch done before the release drops" moments... :)

    October 16th, 2009 @ 09:01 PM

  3. Repository
  4. Repository