diff options
Diffstat (limited to 'railties/test/backtrace_cleaner_test.rb')
-rw-r--r-- | railties/test/backtrace_cleaner_test.rb | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/railties/test/backtrace_cleaner_test.rb b/railties/test/backtrace_cleaner_test.rb index 70917ba20b..ec512b6b64 100644 --- a/railties/test/backtrace_cleaner_test.rb +++ b/railties/test/backtrace_cleaner_test.rb @@ -8,27 +8,19 @@ class BacktraceCleanerTest < ActiveSupport::TestCase @cleaner = Rails::BacktraceCleaner.new end - test "should format installed gems correctly" do - backtrace = [ "#{Gem.path[0]}/gems/nosuchgem-1.2.3/lib/foo.rb" ] - result = @cleaner.clean(backtrace, :all) - assert_equal "nosuchgem (1.2.3) lib/foo.rb", result[0] - end - - test "should format installed gems not in Gem.default_dir correctly" do - target_dir = Gem.path.detect { |p| p != Gem.default_dir } - # skip this test if default_dir is the only directory on Gem.path - if target_dir - backtrace = [ "#{target_dir}/gems/nosuchgem-1.2.3/lib/foo.rb" ] - result = @cleaner.clean(backtrace, :all) - assert_equal "nosuchgem (1.2.3) lib/foo.rb", result[0] - end + test "should consider traces from irb lines as User code" do + backtrace = [ "(irb):1", + "/Path/to/rails/railties/lib/rails/commands/console.rb:77:in `start'", + "bin/rails:4:in `<main>'" ] + result = @cleaner.clean(backtrace) + assert_equal "(irb):1", result[0] + assert_equal 1, result.length end - test "should consider traces from irb lines as User code" do - backtrace = [ "from (irb):1", - "from /Path/to/rails/railties/lib/rails/commands/console.rb:77:in `start'", - "from bin/rails:4:in `<main>'" ] + test "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}'"] result = @cleaner.clean(backtrace, :all) - assert_equal "from (irb):1", result[0] + assert_equal "app/views/application/index.html.erb:4", result[0] end end |