Geminstaller C0 Coverage Information - RCov

/Users/woolley/.rvm/gems/ruby-1.8.7-p174@geminstaller/gems/rspec-1.3.0/lib/spec/example/before_and_after_hooks.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/example/before_and_after_hooks.rb 93 61
78.49%
68.85%

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 Example
3     module BeforeAndAfterHooks
4       class << self
5         def before_suite_parts # :nodoc:
6           @before_suite_parts ||= []
7         end
8 
9         def after_suite_parts # :nodoc:
10           @after_suite_parts ||= []
11         end
12       end
13 
14       # Registers a block to be executed before examples. <tt>scope</tt> can be
15       # <tt>:each</tt> (default), <tt>:all</tt>, or <tt>:suite</tt>. When
16       # <tt>:each</tt>, the block is executed before each example. When
17       # <tt>:all</tt>, the block is executed only once before any examples are
18       # run.
19       def append_before(scope = :each, &block)
20         before_parts(scope) << block
21       end
22       alias_method :before, :append_before
23 
24       # Registers a block to be executed before each example.
25       # This method prepends +block+ to existing before blocks.
26       #
27       # See <tt>append_before</tt> for scoping semantics.
28       def prepend_before(scope = :each, &block)
29         before_parts(scope).unshift(block)
30       end
31 
32       # Registers a block to be executed after each example.
33       # This method prepends +block+ to existing after blocks.
34       #
35       # See <tt>append_before</tt> for scoping semantics.
36       def prepend_after(scope = :each, &block)
37         after_parts(scope).unshift(block)
38       end
39       alias_method :after, :prepend_after
40 
41       # Registers a block to be executed after each example.
42       # This method appends +block+ to existing after blocks.
43       #
44       # See <tt>append_before</tt> for scoping semantics.
45       def append_after(scope = :each, &block)
46         after_parts(scope) << block
47       end
48 
49       def before_each_parts # :nodoc:
50         @before_each_parts ||= []
51       end
52 
53       def after_each_parts # :nodoc:
54         @after_each_parts ||= []
55       end
56 
57       def before_all_parts # :nodoc:
58         @before_all_parts ||= []
59       end
60 
61       def after_all_parts # :nodoc:
62         @after_all_parts ||= []
63       end
64 
65       def before_suite_parts # :nodoc:
66         BeforeAndAfterHooks.before_suite_parts
67       end
68 
69       def after_suite_parts # :nodoc:
70         BeforeAndAfterHooks.after_suite_parts
71       end
72 
73     private
74 
75       def before_parts(scope)
76         case scope
77         when :each; before_each_parts
78         when :all; before_all_parts
79         when :suite; before_suite_parts
80         end
81       end
82 
83       def after_parts(scope)
84         case scope
85         when :each; after_each_parts
86         when :all; after_all_parts
87         when :suite; after_suite_parts
88         end
89       end
90 
91     end
92   end
93 end

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