diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-10-20 09:32:26 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-10-20 09:32:26 -0500 |
commit | fa1926ddaa7ad481c55b76d1f2c1952721b7b586 (patch) | |
tree | dc1de35e1218013b8815d40440b094c58500c144 /railties/test | |
parent | 80a3983b7b987ef11c8875c5c23707b4903cdf72 (diff) | |
download | rails-fa1926ddaa7ad481c55b76d1f2c1952721b7b586.tar.gz rails-fa1926ddaa7ad481c55b76d1f2c1952721b7b586.tar.bz2 rails-fa1926ddaa7ad481c55b76d1f2c1952721b7b586.zip |
Exclude gem backtrace filter if rubygems is not loaded
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/backtrace_cleaner_test.rb | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/railties/test/backtrace_cleaner_test.rb b/railties/test/backtrace_cleaner_test.rb index 64a47712b7..4e273852e0 100644 --- a/railties/test/backtrace_cleaner_test.rb +++ b/railties/test/backtrace_cleaner_test.rb @@ -29,25 +29,26 @@ else $stderr.puts 'No BacktraceFilter for minitest' end -class BacktraceCleanerVendorGemTest < ActiveSupport::TestCase - def setup - @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) - assert_equal "nosuchgem (1.2.3) lib/foo.rb", @result[0] - end +if defined? Gem + class BacktraceCleanerVendorGemTest < ActiveSupport::TestCase + def setup + @cleaner = Rails::BacktraceCleaner.new + 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" ] + test "should format installed gems correctly" do + @backtrace = [ "#{Gem.path[0]}/gems/nosuchgem-1.2.3/lib/foo.rb" ] @result = @cleaner.clean(@backtrace) assert_equal "nosuchgem (1.2.3) lib/foo.rb", @result[0] end - 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) + assert_equal "nosuchgem (1.2.3) lib/foo.rb", @result[0] + end + end + end end |