changelog shortlog tags changeset manifest revisions annotate raw

vendor/plugins/rspec/spec/spec/runner/noisy_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 "NoisyBacktraceTweaker" do
6 before(:each) do
7 @error = RuntimeError.new
8 @tweaker = NoisyBacktraceTweaker.new
9 end
10
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
16 end
17 end
18
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
23 end
24
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
29 end
30
31 it "should not barf on nil backtrace" do
32 lambda do
33 @tweaker.tweak_backtrace(@error)
34 end.should_not raise_error
35 end
36
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")
41 end
42
43 end
44 end
45end