C0 code coverage information
Generated on Sun Oct 26 11:18:14 -0500 2008 with rcov 0.8.1.2
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 require File.dirname(__FILE__) + '/../spec_helper'
2 require 'aquarium/dsl'
3 require 'aquarium/finders/pointcut_finder'
4 require File.dirname(__FILE__) + '/pointcut_finder_spec_test_classes'
5
6 describe Aquarium::Finders::PointcutFinder, "#find with invalid invocation parameters" do
7 it "should raise if no options are specified." do
8 lambda { Aquarium::Finders::PointcutFinder.new.find}.should raise_error(Aquarium::Utils::InvalidOptions)
9 end
10 it "should raise if no type options are specified." do
11 lambda { Aquarium::Finders::PointcutFinder.new.find :matching => :foo}.should raise_error(Aquarium::Utils::InvalidOptions)
12 end
13 end
14
15 describe Aquarium::Finders::PointcutFinder, "#find with valid type invocation parameters" do
16 it "should accept :types with a single type." do
17 lambda { Aquarium::Finders::PointcutFinder.new.find :types => Aquarium::PointcutFinderTestClasses::PointcutConstantHolder1, :noop => true}.should_not raise_error(Aquarium::Utils::InvalidOptions)
18 end
19 it "should accept :types with an array of types." do
20 lambda { Aquarium::Finders::PointcutFinder.new.find :types => [Aquarium::PointcutFinderTestClasses::PointcutConstantHolder1, Aquarium::PointcutFinderTestClasses::PointcutConstantHolder2], :noop => true}.should_not raise_error(Aquarium::Utils::InvalidOptions)
21 end
22 it "should accept :types with a regular expression for types." do
23 lambda { Aquarium::Finders::PointcutFinder.new.find :types => /Aquarium::PointcutFinderTestClasses::PointcutConstantHolder/, :noop => true}.should_not raise_error(Aquarium::Utils::InvalidOptions)
24 end
25 Aquarium::Finders::PointcutFinder::CANONICAL_OPTIONS["types"].each do |synonym|
26 it "should accept :#{synonym} as a synonym for :types." do
27 lambda { Aquarium::Finders::PointcutFinder.new.find synonym.intern => /Aquarium::PointcutFinderTestClasses::PointcutConstantHolder/, :noop => true}.should_not raise_error(Aquarium::Utils::InvalidOptions)
28 end
29 end
30 end
31
32 describe Aquarium::Finders::PointcutFinder, "#find with nonexistent types specified" do
33 it "should return an empty FinderResult." do
34 found = Aquarium::Finders::PointcutFinder.new.find :types => /UndefinedType/
35 found.matched.should be_empty
36 found.not_matched.keys.should eql([/UndefinedType/])
37 end
38 end
39
40 describe Aquarium::Finders::PointcutFinder, "#find with no pointcut name parameter" do
41 it "should return all constant and class variable pointcuts in the specified types." do
42 found = Aquarium::Finders::PointcutFinder.new.find :types => Aquarium::PointcutFinderTestClasses.all_pointcut_classes
43 Aquarium::PointcutFinderTestClasses.found_pointcuts_should_match found, Aquarium::PointcutFinderTestClasses.all_pointcuts
44 end
45 end
46
47 variants = {'constant and class variable ' => '', 'constant ' => 'constants_', 'class variable ' => 'class_variables_'}.each do |name, prefix|
48 describe Aquarium::Finders::PointcutFinder, "#find with valid #{name}name invocation parameters" do
49 it "should accept :#{prefix}matching => :all and match all #{name} pointcuts in the specified types." do
50 found = Aquarium::Finders::PointcutFinder.new.find "#{prefix}matching".intern => :all, :types => Aquarium::PointcutFinderTestClasses.all_pointcut_classes
51 Aquarium::PointcutFinderTestClasses.found_pointcuts_should_match found, eval("Aquarium::PointcutFinderTestClasses.all_#{prefix}pointcuts")
52 end
53 it "should accept :#{prefix}matching with a single pointcut name." do
54 lambda { Aquarium::Finders::PointcutFinder.new.find "#{prefix}matching".intern => :POINTCUT1, :types => Aquarium::PointcutFinderTestClasses.all_pointcut_classes, :noop => true}.should_not raise_error(Aquarium::Utils::InvalidOptions)
55 end
56 it "should accept :#{prefix}matching with an array of pointcut names." do
57 lambda { Aquarium::Finders::PointcutFinder.new.find "#{prefix}matching".intern => [:POINTCUT1, :POINTCUT2], :types => Aquarium::PointcutFinderTestClasses.all_pointcut_classes, :noop => true}.should_not raise_error(Aquarium::Utils::InvalidOptions)
58 end
59 it "should accept :#{prefix}matching with a regular expression for pointcut names." do
60 lambda { Aquarium::Finders::PointcutFinder.new.find "#{prefix}matching".intern => /POINTCUT/, :types => Aquarium::PointcutFinderTestClasses.all_pointcut_classes, :noop => true}.should_not raise_error(Aquarium::Utils::InvalidOptions)
61 end
62 Aquarium::Finders::PointcutFinder::CANONICAL_OPTIONS["#{prefix}matching"].each do |synonym|
63 it "should accept :#{synonym} as a synonym for :#{prefix}matching." do
64 lambda { Aquarium::Finders::PointcutFinder.new.find synonym.intern => /POINTCUT/, :types => Aquarium::PointcutFinderTestClasses.all_pointcut_classes, :noop => true}.should_not raise_error(Aquarium::Utils::InvalidOptions)
65 end
66 end
67 end
68 end
69
70 describe Aquarium::Finders::PointcutFinder, "#find with :matching => single pointcut name" do
71 it "should return all constant and class variable pointcuts that match the specified name exactly." do
72 found = Aquarium::Finders::PointcutFinder.new.find :matching => :POINTCUT1, :types => Aquarium::PointcutFinderTestClasses.all_pointcut_classes
73 Aquarium::PointcutFinderTestClasses.found_pointcuts_should_match found, [Aquarium::PointcutFinderTestClasses::PointcutConstantHolder1::POINTCUT1]
74 found = Aquarium::Finders::PointcutFinder.new.find :matching => :pointcut1, :types => Aquarium::PointcutFinderTestClasses.all_pointcut_classes
75 Aquarium::PointcutFinderTestClasses.found_pointcuts_should_match found, [Aquarium::PointcutFinderTestClasses::PointcutClassVariableHolder1.pointcut1]
76 end
77 end
78 describe Aquarium::Finders::PointcutFinder, "#find with :constants_matching => single pointcut name" do
79 it "should return all constant pointcuts and no class variable pointcuts that match the specified name exactly." do
80 found = Aquarium::Finders::PointcutFinder.new.find :constants_matching => :POINTCUT1, :types => Aquarium::PointcutFinderTestClasses.all_pointcut_classes
81 Aquarium::PointcutFinderTestClasses.found_pointcuts_should_match found, [Aquarium::PointcutFinderTestClasses::PointcutConstantHolder1::POINTCUT1]
82 found = Aquarium::Finders::PointcutFinder.new.find :constants_matching => :pointcut1, :types => Aquarium::PointcutFinderTestClasses.all_pointcut_classes
83 Aquarium::PointcutFinderTestClasses.found_pointcuts_should_match found, []
84 end
85 end
86 describe Aquarium::Finders::PointcutFinder, "#find with :class_variables_matching => single pointcut name" do
87 it "should return all class variable pointcuts and no constant pointcuts that match the specified name exactly." do
88 found = Aquarium::Finders::PointcutFinder.new.find :class_variables_matching => :POINTCUT1, :types => Aquarium::PointcutFinderTestClasses.all_pointcut_classes
89 Aquarium::PointcutFinderTestClasses.found_pointcuts_should_match found, []
90 found = Aquarium::Finders::PointcutFinder.new.find :class_variables_matching => :pointcut1, :types => Aquarium::PointcutFinderTestClasses.all_pointcut_classes
91 Aquarium::PointcutFinderTestClasses.found_pointcuts_should_match found, [Aquarium::PointcutFinderTestClasses::PointcutClassVariableHolder1.pointcut1]
92 end
93 end
94
95 describe Aquarium::Finders::PointcutFinder, "#find with :matching => /pointcut regexps/" do
96 it "should return all constant and class variable pointcuts that match the specified regular expressions." do
97 found = Aquarium::Finders::PointcutFinder.new.find :matching => /POINTCUT(1+|2)/, :types => Aquarium::PointcutFinderTestClasses.all_pointcut_classes
98 Aquarium::PointcutFinderTestClasses.found_pointcuts_should_match found, Aquarium::PointcutFinderTestClasses.all_constants_pointcuts
99 found = Aquarium::Finders::PointcutFinder.new.find :matching => /pointcut1/, :types => Aquarium::PointcutFinderTestClasses.all_pointcut_classes
100 Aquarium::PointcutFinderTestClasses.found_pointcuts_should_match found, Aquarium::PointcutFinderTestClasses.all_class_variables_pointcuts
101 end
102 end
103 describe Aquarium::Finders::PointcutFinder, "#find with :constants_matching => /pointcut regexps/" do
104 it "should return all constant pointcuts and no class variable pointcuts that match the specified regular expressions." do
105 found = Aquarium::Finders::PointcutFinder.new.find :constants_matching => /POINTCUT(1+|2)/, :types => Aquarium::PointcutFinderTestClasses.all_pointcut_classes
106 Aquarium::PointcutFinderTestClasses.found_pointcuts_should_match found, Aquarium::PointcutFinderTestClasses.all_constants_pointcuts
107 found = Aquarium::Finders::PointcutFinder.new.find :constants_matching => /pointcut1/, :types => Aquarium::PointcutFinderTestClasses.all_pointcut_classes
108 Aquarium::PointcutFinderTestClasses.found_pointcuts_should_match found, []
109 end
110 end
111 describe Aquarium::Finders::PointcutFinder, "#find with :class_variables_matching => /pointcut regexps/" do
112 it "should return all class variable pointcuts and no constant pointcuts that match the specified regular expressions." do
113 found = Aquarium::Finders::PointcutFinder.new.find :class_variables_matching => /POINTCUT(1+|2)/, :types => Aquarium::PointcutFinderTestClasses.all_pointcut_classes
114 Aquarium::PointcutFinderTestClasses.found_pointcuts_should_match found, []
115 found = Aquarium::Finders::PointcutFinder.new.find :class_variables_matching => /pointcut1/, :types => Aquarium::PointcutFinderTestClasses.all_pointcut_classes
116 Aquarium::PointcutFinderTestClasses.found_pointcuts_should_match found, Aquarium::PointcutFinderTestClasses.all_class_variables_pointcuts
117 end
118 end
119
120 describe Aquarium::Finders::PointcutFinder, "#find with :matching => [pointcut names]" do
121 it "should return all constant and class variable pointcuts that match the specified names exactly." do
122 found = Aquarium::Finders::PointcutFinder.new.find :matching => [:POINTCUT1, :POINTCUT11, :POINTCUT2], :types => Aquarium::PointcutFinderTestClasses.all_pointcut_classes
123 Aquarium::PointcutFinderTestClasses.found_pointcuts_should_match found, Aquarium::PointcutFinderTestClasses.all_constants_pointcuts
124 found = Aquarium::Finders::PointcutFinder.new.find :matching => [:pointcut1, :pointcut11], :types => Aquarium::PointcutFinderTestClasses.all_pointcut_classes
125 Aquarium::PointcutFinderTestClasses.found_pointcuts_should_match found, Aquarium::PointcutFinderTestClasses.all_class_variables_pointcuts
126 end
127 end
128 describe Aquarium::Finders::PointcutFinder, "#find with :constants_matching => [pointcut names]" do
129 it "should return all constant pointcuts and no class variable pointcuts that match the specified names exactly." do
130 found = Aquarium::Finders::PointcutFinder.new.find :constants_matching => [:POINTCUT1, :POINTCUT11, :POINTCUT2], :types => Aquarium::PointcutFinderTestClasses.all_pointcut_classes
131 Aquarium::PointcutFinderTestClasses.found_pointcuts_should_match found, Aquarium::PointcutFinderTestClasses.all_constants_pointcuts
132 found = Aquarium::Finders::PointcutFinder.new.find :constants_matching => [:pointcut1, :pointcut11], :types => Aquarium::PointcutFinderTestClasses.all_pointcut_classes
133 Aquarium::PointcutFinderTestClasses.found_pointcuts_should_match found, []
134 end
135 end
136 describe Aquarium::Finders::PointcutFinder, "#find with :class_variables_matching => [pointcut names]" do
137 it "should return all class variable pointcuts and no constant pointcuts that match the specified names and regular expressions." do
138 found = Aquarium::Finders::PointcutFinder.new.find :class_variables_matching => [:POINTCUT1, :POINTCUT11, :POINTCUT2], :types => Aquarium::PointcutFinderTestClasses.all_pointcut_classes
139 Aquarium::PointcutFinderTestClasses.found_pointcuts_should_match found, []
140 found = Aquarium::Finders::PointcutFinder.new.find :class_variables_matching => [:pointcut1, :pointcut11], :types => Aquarium::PointcutFinderTestClasses.all_pointcut_classes
141 Aquarium::PointcutFinderTestClasses.found_pointcuts_should_match found, Aquarium::PointcutFinderTestClasses.all_class_variables_pointcuts
142 end
143 end
144
145 describe Aquarium::Finders::PointcutFinder, "#find with :matching => [pointcut names and regular expressions]" do
146 it "should return all constant and class variable pointcuts that match the specified names exactly." do
147 found = Aquarium::Finders::PointcutFinder.new.find :matching => [:POINTCUT1, :POINTCUT11, /CUT2/], :types => Aquarium::PointcutFinderTestClasses.all_pointcut_classes
148 Aquarium::PointcutFinderTestClasses.found_pointcuts_should_match found, Aquarium::PointcutFinderTestClasses.all_constants_pointcuts
149 found = Aquarium::Finders::PointcutFinder.new.find :matching => [:pointcut1, /cut11$/], :types => Aquarium::PointcutFinderTestClasses.all_pointcut_classes
150 Aquarium::PointcutFinderTestClasses.found_pointcuts_should_match found, Aquarium::PointcutFinderTestClasses.all_class_variables_pointcuts
151 end
152 end
153 describe Aquarium::Finders::PointcutFinder, "#find with :constants_matching => [pointcut names and regular expressions]" do
154 it "should return all constant pointcuts and no class variable pointcuts that match the specified names and regular expressions." do
155 found = Aquarium::Finders::PointcutFinder.new.find :constants_matching => [:POINTCUT1, :POINTCUT11, /CUT2/], :types => Aquarium::PointcutFinderTestClasses.all_pointcut_classes
156 Aquarium::PointcutFinderTestClasses.found_pointcuts_should_match found, Aquarium::PointcutFinderTestClasses.all_constants_pointcuts
157 found = Aquarium::Finders::PointcutFinder.new.find :constants_matching => [:pointcut1, /cut11$/], :types => Aquarium::PointcutFinderTestClasses.all_pointcut_classes
158 Aquarium::PointcutFinderTestClasses.found_pointcuts_should_match found, []
159 end
160 end
161 describe Aquarium::Finders::PointcutFinder, "#find with :class_variables_matching => [pointcut names and regular expressions]" do
162 it "should return all class variable pointcuts and no constant pointcuts that match the specified names and regular expressions." do
163 found = Aquarium::Finders::PointcutFinder.new.find :class_variables_matching => [:POINTCUT1, :POINTCUT11, /CUT2/], :types => Aquarium::PointcutFinderTestClasses.all_pointcut_classes
164 Aquarium::PointcutFinderTestClasses.found_pointcuts_should_match found, []
165 found = Aquarium::Finders::PointcutFinder.new.find :class_variables_matching => [:pointcut1, /cut11$/], :types => Aquarium::PointcutFinderTestClasses.all_pointcut_classes
166 Aquarium::PointcutFinderTestClasses.found_pointcuts_should_match found, Aquarium::PointcutFinderTestClasses.all_class_variables_pointcuts
167 end
168 end
169
170 describe Aquarium::Finders::PointcutFinder, "#find with any combination of :matching, :constant_matching, and/or :class_variables_matching" do
171 it "should return the union of all matching pointcuts." do
172 found = Aquarium::Finders::PointcutFinder.new.find :types => Aquarium::PointcutFinderTestClasses.all_pointcut_classes,
173 :matching => [:POINTCUT1],
174 :constants_matching => /CUT[12]/,
175 :class_variables_matching => /pointcut/
176 Aquarium::PointcutFinderTestClasses.found_pointcuts_should_match found, Aquarium::PointcutFinderTestClasses.all_pointcuts
177 end
178 end
179
180 describe Aquarium::Finders::PointcutFinder, "#find with :types_and_descendents." do
181 it "should return the matching pointcuts in the hierarchy." do
182 found = Aquarium::Finders::PointcutFinder.new.find :types_and_descendents => Aquarium::PointcutFinderTestClasses::ParentOfPointcutHolder
183 Aquarium::PointcutFinderTestClasses.found_pointcuts_should_match found, [Aquarium::PointcutFinderTestClasses::PointcutConstantHolderChild::POINTCUT]
184 end
185 end
186
187 describe Aquarium::Finders::PointcutFinder, "#find with :types_and_ancestors." do
188 it "should return the matching pointcuts in the hierarchy." do
189 found = Aquarium::Finders::PointcutFinder.new.find :types_and_ancestors => Aquarium::PointcutFinderTestClasses::DescendentOfPointcutConstantHolderChild
190 Aquarium::PointcutFinderTestClasses.found_pointcuts_should_match found, [Aquarium::PointcutFinderTestClasses::PointcutConstantHolderChild::POINTCUT]
191 end
192 end
193
Generated using the rcov code coverage analysis tool for Ruby version 0.8.1.2.