changelog shortlog tags changeset manifest revisions annotate raw

vendor/plugins/rspec/spec/spec/runner/quiet_backtrace_tweaker_spec.rb

changeset 15: 64acf98d15f4
author: moriq@moriq.com
date: Mon Mar 10 10:12:58 2008 +0900 (16 years ago)
permissions: -rw-r--r--
description: add plugins rspec
1require File.dirname(__FILE__) + '/../../spec_helper.rb'
2
3module 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
56end