This project is archived and is in readonly mode.
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
-
CancelProfileIsBroken September 25th, 2009 @ 11:52 AM
- Tag set to backtracecleaner, bugmash, gem
- Milestone cleared.
- Assigned user cleared.
-
Matt Jones October 16th, 2009 @ 09:01 PM
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... :)
-
Repository October 18th, 2009 @ 08:25 PM
- State changed from new to resolved
(from [77bb129fdb3b1da8365931a6313b5e7ef4c91de0]) Fix bad assumption in BacktraceCleaner test [#3249 state:resolved]
Signed-off-by: Pratik Naik pratiknaik@gmail.com
http://github.com/rails/rails/commit/77bb129fdb3b1da8365931a6313b5e... -
Repository October 18th, 2009 @ 08:25 PM
(from [9edfdef2a7c0c36b84b0f0bcd591e0c123351866]) Fix bad assumption in BacktraceCleaner test [#3249 state:resolved]
Signed-off-by: Pratik Naik pratiknaik@gmail.com
http://github.com/rails/rails/commit/9edfdef2a7c0c36b84b0f0bcd591e0...
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>
People watching this ticket
Attachments
Tags
Referenced by
- 3249 BacktraceCleaner test makes bad assumption about gems (from [77bb129fdb3b1da8365931a6313b5e7ef4c91de0]) Fix bad...
- 3249 BacktraceCleaner test makes bad assumption about gems (from [9edfdef2a7c0c36b84b0f0bcd591e0c123351866]) Fix bad...