Skip to content

Commit

Permalink
Merge pull request #152 from kevintuhumury/master
Browse files Browse the repository at this point in the history
Adjust the backtrace to look more like rails. Adds the enhancement requested in #29.
  • Loading branch information
rstacruz committed Apr 17, 2013
2 parents d9fd157 + a1b43e4 commit 83a5680
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/better_errors/stack_frame.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def gem?
def gem_path
Gem.path.each do |path|
if filename.index(path) == 0
return filename.gsub("#{path}/gems/", "(gem) ")
return filename.gsub(%r{#{path}/gems/([^/]+)-([\w.]+)/}, '\1 (\2) ')
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/better_errors/stack_frame_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ module BetterErrors
Gem.stub!(:path).and_return(["/abc/xyz"])
frame = StackFrame.new("/abc/xyz/gems/whatever-1.2.3/lib/whatever.rb", 123, "foo")

frame.gem_path.should == "(gem) whatever-1.2.3/lib/whatever.rb"
frame.gem_path.should == "whatever (1.2.3) lib/whatever.rb"
end

it "should prioritize gem path over application path" do
BetterErrors.stub!(:application_root).and_return("/abc/xyz")
Gem.stub!(:path).and_return(["/abc/xyz/vendor"])
frame = StackFrame.new("/abc/xyz/vendor/gems/whatever-1.2.3/lib/whatever.rb", 123, "foo")

frame.gem_path.should == "(gem) whatever-1.2.3/lib/whatever.rb"
frame.gem_path.should == "whatever (1.2.3) lib/whatever.rb"
end
end

Expand Down

0 comments on commit 83a5680

Please sign in to comment.