]> git.openstreetmap.org Git - rails.git/blob - vendor/gems/rspec-1.1.2/spec/spec/runner/quiet_backtrace_tweaker_spec.rb
Show whether a trace is public or private in the trace list, so that a user can easil...
[rails.git] / vendor / gems / rspec-1.1.2 / spec / spec / runner / quiet_backtrace_tweaker_spec.rb
1 require File.dirname(__FILE__) + '/../../spec_helper.rb'
2
3 module Spec
4   module Runner
5     describe "QuietBacktraceTweaker" do
6       before(:each) do
7         @error = RuntimeError.new
8         @tweaker = QuietBacktraceTweaker.new
9       end
10
11       it "should not barf on nil backtrace" do
12         lambda do
13           @tweaker.tweak_backtrace(@error)
14         end.should_not raise_error
15       end
16
17       it "should remove anything from textmate ruby bundle" do
18         @error.set_backtrace(["/Applications/TextMate.app/Contents/SharedSupport/Bundles/Ruby.tmbundle/Support/tmruby.rb:147"])
19         @tweaker.tweak_backtrace(@error)
20         @error.backtrace.should be_empty
21       end
22
23       it "should remove anything in lib spec dir" do
24         ["expectations", "mocks", "runner"].each do |child|
25           element="/lib/spec/#{child}/anything.rb"
26           @error.set_backtrace([element])
27           @tweaker.tweak_backtrace(@error)
28           unless (@error.backtrace.empty?)
29             raise("Should have tweaked away '#{element}'")
30           end
31         end
32       end
33
34       it "should remove mock_frameworks/rspec" do
35         element = "mock_frameworks/rspec"
36         @error.set_backtrace([element])
37         @tweaker.tweak_backtrace(@error)
38         unless (@error.backtrace.empty?)
39           raise("Should have tweaked away '#{element}'")
40         end
41       end
42
43       it "should remove bin spec" do
44         @error.set_backtrace(["bin/spec:"])
45         @tweaker.tweak_backtrace(@error)
46         @error.backtrace.should be_empty
47       end
48       
49       it "should clean up double slashes" do
50         @error.set_backtrace(["/a//b/c//d.rb"])
51         @tweaker.tweak_backtrace(@error)
52         @error.backtrace.should include("/a/b/c/d.rb")
53       end
54     end
55   end
56 end