1 require File.dirname(__FILE__) + '/../../spec_helper.rb'
5 describe "NoisyBacktraceTweaker" do
7 @error = RuntimeError.new
8 @tweaker = NoisyBacktraceTweaker.new
11 it "should leave anything in lib spec dir" do
12 ["expectations", "mocks", "runner", "stubs"].each do |child|
13 @error.set_backtrace(["/lib/spec/#{child}/anything.rb"])
14 @tweaker.tweak_backtrace(@error)
15 @error.backtrace.should_not be_empty
19 it "should leave anything in spec dir" do
20 @error.set_backtrace(["/lib/spec/expectations/anything.rb"])
21 @tweaker.tweak_backtrace(@error)
22 @error.backtrace.should_not be_empty
25 it "should leave bin spec" do
26 @error.set_backtrace(["bin/spec:"])
27 @tweaker.tweak_backtrace(@error)
28 @error.backtrace.should_not be_empty
31 it "should not barf on nil backtrace" do
33 @tweaker.tweak_backtrace(@error)
34 end.should_not raise_error
37 it "should clean up double slashes" do
38 @error.set_backtrace(["/a//b/c//d.rb"])
39 @tweaker.tweak_backtrace(@error)
40 @error.backtrace.should include("/a/b/c/d.rb")