diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2013-06-20 22:30:35 -0700 |
---|---|---|
committer | Piotr Sarnacki <drogus@gmail.com> | 2013-06-20 22:30:35 -0700 |
commit | 3c0ef057f1af4d39379ba572139aa104c3673779 (patch) | |
tree | 7684d512ceef40146cdde0ec6b95adf924aff828 /activesupport/test/clean_backtrace_test.rb | |
parent | a29f746398e7b0647885343e7f26d977dd251999 (diff) | |
parent | a3678e45ecf8e17527722889d5347325083ad560 (diff) | |
download | rails-3c0ef057f1af4d39379ba572139aa104c3673779.tar.gz rails-3c0ef057f1af4d39379ba572139aa104c3673779.tar.bz2 rails-3c0ef057f1af4d39379ba572139aa104c3673779.zip |
Merge pull request #11030 from mjtko/fix/backtrace-silencer-noise-with-multiple-silencers
Fix BacktraceSilencer#noise when multiple silencers are configured
Diffstat (limited to 'activesupport/test/clean_backtrace_test.rb')
-rw-r--r-- | activesupport/test/clean_backtrace_test.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/activesupport/test/clean_backtrace_test.rb b/activesupport/test/clean_backtrace_test.rb index b14950acb3..dd67a45cf6 100644 --- a/activesupport/test/clean_backtrace_test.rb +++ b/activesupport/test/clean_backtrace_test.rb @@ -36,6 +36,27 @@ class BacktraceCleanerSilencerTest < ActiveSupport::TestCase end end +class BacktraceCleanerMultipleSilencersTest < ActiveSupport::TestCase + def setup + @bc = ActiveSupport::BacktraceCleaner.new + @bc.add_silencer { |line| line =~ /mongrel/ } + @bc.add_silencer { |line| line =~ /yolo/ } + end + + test "backtrace should not contain lines that match the silencers" do + assert_equal \ + [ "/other/class.rb" ], + @bc.clean([ "/mongrel/class.rb", "/other/class.rb", "/mongrel/stuff.rb", "/other/yolo.rb" ]) + end + + test "backtrace should only contain lines that match the silencers" do + assert_equal \ + [ "/mongrel/class.rb", "/mongrel/stuff.rb", "/other/yolo.rb" ], + @bc.clean([ "/mongrel/class.rb", "/other/class.rb", "/mongrel/stuff.rb", "/other/yolo.rb" ], + :noise) + end +end + class BacktraceCleanerFilterAndSilencerTest < ActiveSupport::TestCase def setup @bc = ActiveSupport::BacktraceCleaner.new |