Geminstaller C0 Coverage Information - RCov

/Users/woolley/.rvm/gems/ruby-1.8.7-p174@geminstaller/gems/rspec-1.3.0/lib/spec/runner/backtrace_tweaker.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
/Users/woolley/.rvm/gems/ruby-1.8.7-p174@geminstaller/gems/rspec-1.3.0/lib/spec/runner/backtrace_tweaker.rb 77 65
71.43%
66.15%

Key

Code reported as executed by Ruby looks like this...and this: this line is also marked as covered.Lines considered as run by rcov, but not reported by Ruby, look like this,and this: these lines were inferred by rcov (using simple heuristics).Finally, here's a line marked as not executed.

Coverage Details

1 module Spec
2   module Runner
3     class BacktraceTweaker
4       def initialize(*patterns)
5         @ignore_patterns = []
6       end
7 
8       def clean_up_double_slashes(line)
9         line.gsub!('//','/')
10       end
11 
12       def ignore_patterns(*patterns)
13         # do nothing. Only QuietBacktraceTweaker ignores patterns.
14       end
15 
16       def ignored_patterns
17         []
18       end
19 
20       def tweak_backtrace(error)
21         return if error.backtrace.nil?
22         tweaked = error.backtrace.collect do |message|
23           clean_up_double_slashes(message)
24           kept_lines = message.split("\n").select do |line|
25             ignored_patterns.each do |ignore|
26               break if line =~ ignore
27             end
28           end
29           kept_lines.empty?? nil : kept_lines.join("\n")
30         end
31         error.set_backtrace(tweaked.select {|line| line})
32       end
33     end
34 
35     class NoisyBacktraceTweaker < BacktraceTweaker
36     end
37 
38     # Tweaks raised Exceptions to mask noisy (unneeded) parts of the backtrace
39     class QuietBacktraceTweaker < BacktraceTweaker
40       unless defined?(IGNORE_PATTERNS)
41         spec_files = Dir["lib/*"].map do |path| 
42           subpath = path[1..-1]
43           /#{subpath}/
44         end
45         IGNORE_PATTERNS = spec_files + [
46           /\/rspec-[^\/]*\/lib\/spec\//,
47           /\/spork-[^\/]*\/lib\/spork\//,
48           /\/lib\/ruby\//,
49           /bin\/spec:/,
50           /bin\/spork:/,
51           /bin\/rcov:/,
52           /lib\/rspec-rails/,
53           /vendor\/rails/,
54           # TextMate's Ruby and RSpec plugins
55           /Ruby\.tmbundle\/Support\/tmruby.rb:/,
56           /RSpec\.tmbundle\/Support\/lib/,
57           /temp_textmate\./,
58           /mock_frameworks\/rspec/,
59           /spec_server/
60         ]
61       end
62 
63       def initialize(*patterns)
64         super
65         ignore_patterns(*patterns)
66       end
67 
68       def ignore_patterns(*patterns)
69         @ignore_patterns += patterns.flatten.map { |pattern| Regexp.new(pattern) }
70       end
71 
72       def ignored_patterns
73         IGNORE_PATTERNS + @ignore_patterns
74       end
75     end
76   end
77 end

Generated on Mon May 10 23:40:27 -0700 2010 with rcov 0.9.8