diff --git a/railties/lib/rails/backtrace_cleaner.rb b/railties/lib/rails/backtrace_cleaner.rb index 12c27d6e1c5c3..9f72d244f1b55 100644 --- a/railties/lib/rails/backtrace_cleaner.rb +++ b/railties/lib/rails/backtrace_cleaner.rb @@ -5,7 +5,7 @@ module Rails class BacktraceCleaner < ActiveSupport::BacktraceCleaner # :nodoc: - APP_DIRS_PATTERN = /\A(?:\.\/)?(?:app|config|lib|test|\(\w*\))/ + APP_DIRS_PATTERN = /\A(?:\.\/)?(?:app|config|lib|test|\(\w+(?:-\w+)*\))/ RENDER_TEMPLATE_PATTERN = /:in [`'].*_\w+_{2,3}\d+_\d+'/ def initialize diff --git a/railties/test/backtrace_cleaner_test.rb b/railties/test/backtrace_cleaner_test.rb index a3eccff38033b..0defb6dc94682 100644 --- a/railties/test/backtrace_cleaner_test.rb +++ b/railties/test/backtrace_cleaner_test.rb @@ -36,6 +36,15 @@ def setup assert_equal 2, result.length end + test "#clean should consider traces that include dasherized Rails application name" do + backtrace = [ "(my-app):1", + "/Path/to/rails/railties/lib/rails/commands/console.rb:77:in `start'", + "bin/rails:4:in `
'" ] + result = @cleaner.clean(backtrace) + assert_equal "(my-app):1", result[0] + assert_equal 1, result.length + end + test "#clean should omit ActionView template methods names" do method_name = ActionView::Template.new(nil, "app/views/application/index.html.erb", nil, locals: []).send :method_name backtrace = [ "app/views/application/index.html.erb:4:in `block in #{method_name}'"]