C0 code coverage information
Generated on Mon Aug 13 01:18:53 -0400 2007 with rcov 0.8.0
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.
1 module Spec
2 module DSL
3 # See http://rspec.rubyforge.org/documentation/before_and_after.html
4 module BehaviourCallbacks
5 def prepend_before(*args, &block)
6 scope, options = scope_and_options(*args)
7 add(scope, options, :before, :unshift, &block)
8 end
9 def append_before(*args, &block)
10 scope, options = scope_and_options(*args)
11 add(scope, options, :before, :<<, &block)
12 end
13 alias_method :before, :append_before
14
15 def prepend_after(*args, &block)
16 scope, options = scope_and_options(*args)
17 add(scope, options, :after, :unshift, &block)
18 end
19 alias_method :after, :prepend_after
20 def append_after(*args, &block)
21 scope, options = scope_and_options(*args)
22 add(scope, options, :after, :<<, &block)
23 end
24
25 def scope_and_options(*args)
26 args, options = args_and_options(*args)
27 scope = (args[0] || :each), options
28 end
29
30 def add(scope, options, where, how, &block)
31 scope ||= :each
32 options ||= {}
33 behaviour_type = options[:behaviour_type]
34 case scope
35 when :each; self.__send__("#{where}_each_parts", behaviour_type).__send__(how, block)
36 when :all; self.__send__("#{where}_all_parts", behaviour_type).__send__(how, block)
37 end
38 end
39
40 def remove_after(scope, &block)
41 after_each_parts.delete(block)
42 end
43
44 # Deprecated. Use before(:each)
45 def setup(&block)
46 before(:each, &block)
47 end
48
49 # Deprecated. Use after(:each)
50 def teardown(&block)
51 after(:each, &block)
52 end
53
54 def before_all_parts(behaviour_type=nil) # :nodoc:
55 @before_all_parts ||= {}
56 @before_all_parts[behaviour_type] ||= []
57 end
58
59 def after_all_parts(behaviour_type=nil) # :nodoc:
60 @after_all_parts ||= {}
61 @after_all_parts[behaviour_type] ||= []
62 end
63
64 def before_each_parts(behaviour_type=nil) # :nodoc:
65 @before_each_parts ||= {}
66 @before_each_parts[behaviour_type] ||= []
67 end
68
69 def after_each_parts(behaviour_type=nil) # :nodoc:
70 @after_each_parts ||= {}
71 @after_each_parts[behaviour_type] ||= []
72 end
73
74 def clear_before_and_after! # :nodoc:
75 @before_all_parts = nil
76 @after_all_parts = nil
77 @before_each_parts = nil
78 @after_each_parts = nil
79 end
80 end
81 end
82 end
Generated using the rcov code coverage analysis tool for Ruby version 0.8.0.