Sha256: 92ca9fb886f7ddabc5375df02d4a6e39b80f511cddf5fec6fd822b388408d9d2

Contents?: true

Size: 1.71 KB

Versions: 33

Compression:

Stored size: 1.71 KB

Contents

require File.dirname(__FILE__) + '/../../spec_helper.rb'

module Spec
  module Runner
    describe "QuietBacktraceTweaker" do
      before(:each) do
        @error = RuntimeError.new
        @tweaker = QuietBacktraceTweaker.new
      end

      it "should not barf on nil backtrace" do
        lambda do
          @tweaker.tweak_backtrace(@error)
        end.should_not raise_error
      end

      it "should remove anything from textmate ruby bundle" do
        @error.set_backtrace(["/Applications/TextMate.app/Contents/SharedSupport/Bundles/Ruby.tmbundle/Support/tmruby.rb:147"])
        @tweaker.tweak_backtrace(@error)
        @error.backtrace.should be_empty
      end

      it "should remove anything in lib spec dir" do
        ["expectations", "mocks", "runner"].each do |child|
          element="/lib/spec/#{child}/anything.rb"
          @error.set_backtrace([element])
          @tweaker.tweak_backtrace(@error)
          unless (@error.backtrace.empty?)
            raise("Should have tweaked away '#{element}'")
          end
        end
      end

      it "should remove mock_frameworks/rspec" do
        element = "mock_frameworks/rspec"
        @error.set_backtrace([element])
        @tweaker.tweak_backtrace(@error)
        unless (@error.backtrace.empty?)
          raise("Should have tweaked away '#{element}'")
        end
      end

      it "should remove bin spec" do
        @error.set_backtrace(["bin/spec:"])
        @tweaker.tweak_backtrace(@error)
        @error.backtrace.should be_empty
      end
      
      it "should clean up double slashes" do
        @error.set_backtrace(["/a//b/c//d.rb"])
        @tweaker.tweak_backtrace(@error)
        @error.backtrace.should include("/a/b/c/d.rb")
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 5 rubygems

Version Path
picolena-0.0.99 app_generators/picolena/templates/vendor/plugins/rspec/spec/spec/runner/quiet_backtrace_tweaker_spec.rb
picolena-0.1.0 rails_plugins/rspec/spec/spec/runner/quiet_backtrace_tweaker_spec.rb
picolena-0.1.1 rails_plugins/rspec/spec/spec/runner/quiet_backtrace_tweaker_spec.rb
picolena-0.1.4 rails_plugins/rspec/spec/spec/runner/quiet_backtrace_tweaker_spec.rb
picolena-0.1.3 rails_plugins/rspec/spec/spec/runner/quiet_backtrace_tweaker_spec.rb
picolena-0.1.2 rails_plugins/rspec/spec/spec/runner/quiet_backtrace_tweaker_spec.rb
picolena-0.1.5 rails_plugins/rspec/spec/spec/runner/quiet_backtrace_tweaker_spec.rb
radiant-0.6.5.1 vendor/plugins/rspec/spec/spec/runner/quiet_backtrace_tweaker_spec.rb
radiant-0.6.5 vendor/plugins/rspec/spec/spec/runner/quiet_backtrace_tweaker_spec.rb
radiant-0.6.7 vendor/plugins/rspec/spec/spec/runner/quiet_backtrace_tweaker_spec.rb
radiant-0.6.6 vendor/plugins/rspec/spec/spec/runner/quiet_backtrace_tweaker_spec.rb
radiant-0.6.9 vendor/plugins/rspec/spec/spec/runner/quiet_backtrace_tweaker_spec.rb
radiant-0.6.8 vendor/plugins/rspec/spec/spec/runner/quiet_backtrace_tweaker_spec.rb
rspec-0.0.10 spec/spec/runner/quiet_backtrace_tweaker_spec.rb
rspec-1.1.0 spec/spec/runner/quiet_backtrace_tweaker_spec.rb
rspec-1.1.1 spec/spec/runner/quiet_backtrace_tweaker_spec.rb
rspec-1.1.3 spec/spec/runner/quiet_backtrace_tweaker_spec.rb
rspec-1.1.2 spec/spec/runner/quiet_backtrace_tweaker_spec.rb
rspec-1.1.4 spec/spec/runner/quiet_backtrace_tweaker_spec.rb
spree-0.2.0 vendor/plugins/rspec/spec/spec/runner/quiet_backtrace_tweaker_spec.rb