Sha256: f205f66e44315bbab52dc3ecf1e37cfd39c6933f2c785f6c1ca92dd9f432d1be

Contents?: true

Size: 1.36 KB

Versions: 8

Compression:

Stored size: 1.36 KB

Contents

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

module Spec
  module Runner
    describe "NoisyBacktraceTweaker" do
      before(:each) do
        @error = RuntimeError.new
        @tweaker = NoisyBacktraceTweaker.new
      end
        
      it "should leave anything in lib spec dir" do
        ["expectations", "mocks", "runner", "stubs"].each do |child|
          @error.set_backtrace(["/lib/spec/#{child}/anything.rb"])
          @tweaker.tweak_backtrace(@error, "spec name")
          @error.backtrace.should_not be_empty
        end
      end

      it "should leave anything in spec dir" do
        @error.set_backtrace(["/lib/spec/expectations/anything.rb"])
        @tweaker.tweak_backtrace(@error, "spec name")
        @error.backtrace.should_not be_empty
      end

      it "should leave bin spec" do
        @error.set_backtrace(["bin/spec:"])
        @tweaker.tweak_backtrace(@error, "spec name")
        @error.backtrace.should_not be_empty
      end

      it "should not barf on nil backtrace" do
        lambda do
          @tweaker.tweak_backtrace(@error, "spec name")
        end.should_not raise_error
      end
      
      it "should clean up double slashes" do
        @error.set_backtrace(["/a//b/c//d.rb"])
        @tweaker.tweak_backtrace(@error, "spec name")
        @error.backtrace.should include("/a/b/c/d.rb")
      end
      
    end
  end
end

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
deckshuffler-0.0.2 vendor/plugins/rspec/spec/spec/runner/noisy_backtrace_tweaker_spec.rb
has_finder-0.1.1 spec/rails/vendor/plugins/rspec/spec/spec/runner/noisy_backtrace_tweaker_spec.rb
has_finder-0.1.2 spec/rails/vendor/plugins/rspec/spec/spec/runner/noisy_backtrace_tweaker_spec.rb
has_finder-0.1.3 spec/rails/vendor/plugins/rspec/spec/spec/runner/noisy_backtrace_tweaker_spec.rb
rspec-1.0.5 spec/spec/runner/noisy_backtrace_tweaker_spec.rb
rspec-1.0.6 spec/spec/runner/noisy_backtrace_tweaker_spec.rb
rspec-1.0.7 spec/spec/runner/noisy_backtrace_tweaker_spec.rb
rspec-1.0.8 spec/spec/runner/noisy_backtrace_tweaker_spec.rb