aquarium 0.1.8 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. data/CHANGES +59 -2
  2. data/README +33 -16
  3. data/RELEASE-PLAN +28 -5
  4. data/UPGRADE +11 -0
  5. data/examples/aspect_design_example.rb +2 -2
  6. data/examples/aspect_design_example_spec.rb +2 -2
  7. data/examples/design_by_contract_example.rb +4 -4
  8. data/examples/design_by_contract_example_spec.rb +4 -4
  9. data/examples/method_missing_example.rb +4 -1
  10. data/examples/method_missing_example_spec.rb +4 -1
  11. data/examples/method_tracing_example.rb +2 -2
  12. data/examples/method_tracing_example_spec.rb +16 -16
  13. data/lib/aquarium/aspects/advice.rb +47 -25
  14. data/lib/aquarium/aspects/aspect.rb +81 -39
  15. data/lib/aquarium/aspects/dsl/aspect_dsl.rb +1 -1
  16. data/lib/aquarium/aspects/exclusion_handler.rb +2 -2
  17. data/lib/aquarium/aspects/join_point.rb +28 -28
  18. data/lib/aquarium/aspects/pointcut.rb +61 -15
  19. data/lib/aquarium/extras/design_by_contract.rb +7 -7
  20. data/lib/aquarium/finders.rb +0 -1
  21. data/lib/aquarium/finders/method_finder.rb +10 -20
  22. data/lib/aquarium/finders/type_finder.rb +141 -75
  23. data/lib/aquarium/utils.rb +1 -0
  24. data/lib/aquarium/utils/logic_error.rb +9 -0
  25. data/lib/aquarium/utils/method_utils.rb +4 -3
  26. data/lib/aquarium/utils/nil_object.rb +1 -0
  27. data/lib/aquarium/utils/type_utils.rb +19 -0
  28. data/lib/aquarium/version.rb +2 -2
  29. data/spec/aquarium/aspects/advice_chain_node_spec.rb +2 -2
  30. data/spec/aquarium/aspects/advice_spec.rb +28 -5
  31. data/spec/aquarium/aspects/aspect_invocation_spec.rb +522 -289
  32. data/spec/aquarium/aspects/aspect_spec.rb +59 -41
  33. data/spec/aquarium/aspects/aspect_with_nested_types_spec.rb +7 -7
  34. data/spec/aquarium/aspects/aspect_with_subtypes_spec.rb +2 -2
  35. data/spec/aquarium/aspects/concurrent_aspects_spec.rb +1 -2
  36. data/spec/aquarium/aspects/concurrent_aspects_with_objects_and_types_spec.rb +1 -1
  37. data/spec/aquarium/aspects/dsl/aspect_dsl_spec.rb +34 -34
  38. data/spec/aquarium/aspects/join_point_spec.rb +79 -0
  39. data/spec/aquarium/aspects/pointcut_or_composition_spec.rb +13 -3
  40. data/spec/aquarium/aspects/pointcut_spec.rb +310 -63
  41. data/spec/aquarium/extras/design_by_contract_spec.rb +4 -4
  42. data/spec/aquarium/finders/method_finder_spec.rb +208 -54
  43. data/spec/aquarium/finders/type_finder_spec.rb +24 -88
  44. data/spec/aquarium/finders/type_finder_with_descendents_and_ancestors_spec.rb +206 -0
  45. data/spec/aquarium/spec_example_classes.rb +75 -12
  46. data/spec/aquarium/utils/logic_error_spec.rb +10 -0
  47. data/spec/aquarium/utils/type_utils_sample_classes.rb +203 -0
  48. data/spec/aquarium/utils/type_utils_spec.rb +47 -1
  49. metadata +48 -39
  50. data/lib/aquarium/finders/object_finder.rb +0 -75
  51. data/spec/aquarium/finders/object_finder_spec.rb +0 -231
@@ -1,6 +1,6 @@
1
1
  require File.dirname(__FILE__) + '/../spec_helper.rb'
2
- require File.dirname(__FILE__) + '/../spec_example_classes'
3
2
  require 'aquarium/utils/type_utils'
3
+ require File.dirname(__FILE__) + '/../utils/type_utils_sample_classes'
4
4
 
5
5
  describe Aquarium::Utils::TypeUtils, ".is_type?" do
6
6
  it "should be true for a class" do
@@ -14,4 +14,50 @@ describe Aquarium::Utils::TypeUtils, ".is_type?" do
14
14
  it "should be false for an Object" do
15
15
  Aquarium::Utils::TypeUtils.is_type?("Object").should be_false
16
16
  end
17
+ end
18
+
19
+ # We don't compare the sizes, because RSpec will add some classes that we don't care about...
20
+ def check_descendent_array clazz, expected
21
+ actual = Aquarium::Utils::TypeUtils.descendents(clazz)
22
+ expected.each {|c| actual.should include(c)}
23
+ end
24
+
25
+ describe Aquarium::Utils::TypeUtils, ".descendents called with a class" do
26
+ it "should return the class itself in the result" do
27
+ Aquarium::Utils::TypeUtils.descendents(BaseForDescendents).should include(BaseForDescendents)
28
+ end
29
+
30
+ it "should return just the class if it has no descendents" do
31
+ Aquarium::Utils::TypeUtils.descendents(D11ForDescendents).should eql([D11ForDescendents])
32
+ Aquarium::Utils::TypeUtils.descendents(D2ForDescendents).should eql([D2ForDescendents])
33
+ Aquarium::Utils::TypeUtils.descendents(Aquarium::ForDescendents::NestedD11ForDescendents).should eql([Aquarium::ForDescendents::NestedD11ForDescendents])
34
+ Aquarium::Utils::TypeUtils.descendents(Aquarium::ForDescendents::NestedD2ForDescendents).should eql([Aquarium::ForDescendents::NestedD2ForDescendents])
35
+ Aquarium::Utils::TypeUtils.descendents(Aquarium::ForDescendents::NestedD3ForDescendents).should eql([Aquarium::ForDescendents::NestedD3ForDescendents])
36
+ Aquarium::Utils::TypeUtils.descendents(Aquarium::ForDescendents::NestedD4ForDescendents).should eql([Aquarium::ForDescendents::NestedD4ForDescendents])
37
+ Aquarium::Utils::TypeUtils.descendents(Aquarium::ForDescendents::NestedD31ForDescendents).should eql([Aquarium::ForDescendents::NestedD31ForDescendents])
38
+ end
39
+
40
+ it "should return all classes and their descendents that derive from a class" do
41
+ Aquarium::Utils::TypeUtils.sample_classes.each do |t|
42
+ check_descendent_array t, Aquarium::Utils::TypeUtils.sample_classes_descendents[t]
43
+ end
44
+ end
45
+ end
46
+
47
+ describe Aquarium::Utils::TypeUtils, ".descendents called with a module" do
48
+ it "should return the module itself in the result" do
49
+ Aquarium::Utils::TypeUtils.descendents(ModuleForDescendents).should include(ModuleForDescendents)
50
+ Aquarium::Utils::TypeUtils.descendents(Aquarium::ForDescendents::NestedModuleForDescendents).should include(Aquarium::ForDescendents::NestedModuleForDescendents)
51
+ end
52
+
53
+ it "should return all classes and their descendents that include a module" do
54
+ Aquarium::Utils::TypeUtils.sample_modules.each do |t|
55
+ check_descendent_array t, Aquarium::Utils::TypeUtils.sample_modules_descendents[t]
56
+ end
57
+ end
58
+
59
+ it "should return all modules that include a module" do
60
+ Aquarium::Utils::TypeUtils.descendents(ModuleForDescendents).should include(ModuleForDescendents)
61
+ Aquarium::Utils::TypeUtils.descendents(ModuleForDescendents).should include(Aquarium::ForDescendents::Nested2ModuleForDescendents)
62
+ end
17
63
  end
metadata CHANGED
@@ -1,33 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.4
3
- specification_version: 1
4
2
  name: aquarium
5
3
  version: !ruby/object:Gem::Version
6
- version: 0.1.8
7
- date: 2007-11-03 00:00:00 -05:00
8
- summary: Aquarium-0.1.8 (r7) - Aspect-Oriented Programming toolkit for Ruby http://aquarium.rubyforge.org
9
- require_paths:
10
- - lib
11
- email: aquarium-devel@rubyforge.org
12
- homepage: http://aquarium.rubyforge.org
13
- rubyforge_project: aquarium
14
- description: Aquarium is a full-featured Aspect-Oriented Programming (AOP) framework for Ruby that is designed to provide an intuitive syntax and support for large-scale, dynamic aspects.
15
- autorequire: aquarium
16
- default_executable: ""
17
- bindir: bin
18
- has_rdoc: true
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">"
22
- - !ruby/object:Gem::Version
23
- version: 0.0.0
24
- version:
25
- platform: ruby
26
- signing_key:
27
- cert_chain:
28
- post_install_message:
4
+ version: 0.2.0
5
+ platform: ""
29
6
  authors:
30
7
  - - Aquarium Development Team
8
+ autorequire: aquarium
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2007-11-24 00:00:00 -06:00
13
+ default_executable: ""
14
+ dependencies: []
15
+
16
+ description: Aquarium is a full-featured Aspect-Oriented Programming (AOP) framework for Ruby that is designed to provide an intuitive syntax and support for large-scale, dynamic aspects.
17
+ email: aquarium-devel@rubyforge.org
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README
24
+ - CHANGES
25
+ - MIT-LICENSE
26
+ - UPGRADE
31
27
  files:
32
28
  - CHANGES
33
29
  - EXAMPLES.rd
@@ -57,13 +53,13 @@ files:
57
53
  - lib/aquarium/extras.rb
58
54
  - lib/aquarium/finders/finder_result.rb
59
55
  - lib/aquarium/finders/method_finder.rb
60
- - lib/aquarium/finders/object_finder.rb
61
56
  - lib/aquarium/finders/type_finder.rb
62
57
  - lib/aquarium/finders.rb
63
58
  - lib/aquarium/utils/array_utils.rb
64
59
  - lib/aquarium/utils/hash_utils.rb
65
60
  - lib/aquarium/utils/html_escaper.rb
66
61
  - lib/aquarium/utils/invalid_options.rb
62
+ - lib/aquarium/utils/logic_error.rb
67
63
  - lib/aquarium/utils/method_utils.rb
68
64
  - lib/aquarium/utils/name_utils.rb
69
65
  - lib/aquarium/utils/nil_object.rb
@@ -94,17 +90,19 @@ files:
94
90
  - spec/aquarium/extras/design_by_contract_spec.rb
95
91
  - spec/aquarium/finders/finder_result_spec.rb
96
92
  - spec/aquarium/finders/method_finder_spec.rb
97
- - spec/aquarium/finders/object_finder_spec.rb
98
93
  - spec/aquarium/finders/type_finder_spec.rb
94
+ - spec/aquarium/finders/type_finder_with_descendents_and_ancestors_spec.rb
99
95
  - spec/aquarium/spec_example_classes.rb
100
96
  - spec/aquarium/spec_helper.rb
101
97
  - spec/aquarium/utils/array_utils_spec.rb
102
98
  - spec/aquarium/utils/hash_utils_spec.rb
103
99
  - spec/aquarium/utils/html_escaper_spec.rb
100
+ - spec/aquarium/utils/logic_error_spec.rb
104
101
  - spec/aquarium/utils/method_utils_spec.rb
105
102
  - spec/aquarium/utils/name_utils_spec.rb
106
103
  - spec/aquarium/utils/nil_object_spec.rb
107
104
  - spec/aquarium/utils/set_utils_spec.rb
105
+ - spec/aquarium/utils/type_utils_sample_classes.rb
108
106
  - spec/aquarium/utils/type_utils_spec.rb
109
107
  - examples/aspect_design_example.rb
110
108
  - examples/aspect_design_example_spec.rb
@@ -118,8 +116,9 @@ files:
118
116
  - rake_tasks/examples_specdoc.rake
119
117
  - rake_tasks/examples_with_rcov.rake
120
118
  - rake_tasks/verify_rcov.rake
121
- test_files: []
122
-
119
+ has_rdoc: true
120
+ homepage: http://aquarium.rubyforge.org
121
+ post_install_message:
123
122
  rdoc_options:
124
123
  - --title
125
124
  - Aquarium
@@ -127,16 +126,26 @@ rdoc_options:
127
126
  - --inline-source
128
127
  - --main
129
128
  - README
130
- extra_rdoc_files:
131
- - README
132
- - CHANGES
133
- - MIT-LICENSE
134
- - UPGRADE
135
- executables: []
136
-
137
- extensions: []
138
-
129
+ require_paths:
130
+ - lib
131
+ required_ruby_version: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ version: "0"
136
+ version:
137
+ required_rubygems_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: "0"
142
+ version:
139
143
  requirements: []
140
144
 
141
- dependencies: []
145
+ rubyforge_project: aquarium
146
+ rubygems_version: 0.9.5
147
+ signing_key:
148
+ specification_version: 2
149
+ summary: Aquarium-0.2.0 (r7) - Aspect-Oriented Programming toolkit for Ruby http://aquarium.rubyforge.org
150
+ test_files: []
142
151
 
@@ -1,75 +0,0 @@
1
- require 'set'
2
- require File.dirname(__FILE__) + '/../utils/array_utils'
3
- require File.dirname(__FILE__) + '/type_finder'
4
-
5
-
6
- # Queries the ObjectSpace, so "immediate" objects are never returned.
7
- # Uses Aquarium::Finders::TypeFinder to map type name regular expressions to types.
8
-
9
- module Aquarium
10
- module Finders
11
- # Deprecated - Will be removed in a future release!
12
- class ObjectFinder
13
- include Aquarium::Utils::ArrayUtils
14
-
15
- # finder_result = ObjectFinder.new.find [:types => [type_names_and_regexps] | :type => type_name_or_regexp]
16
- # where the input types are regular expressions, there may be 0 to
17
- # many matching types that appear in the returned hash.
18
- # Use #find_all_by_types to find objects matching actual types, not just
19
- # names or regular expressions.
20
- # <tt>:types => type_names_and_regexps</tt>::
21
- # One or an array of type names and regular expessions to match.
22
- #
23
- # <tt>:type => type_name_or_regexp</tt>::
24
- # A type name or regular expession to match.
25
- #
26
- # Actually, there is effectively no difference between <tt>:types</tt> and
27
- # <tt>:type</tt>. The singular form is "sugar"...
28
- def find options = {}
29
- type_regexpes_or_names = make_array options[:types]
30
- type_regexpes_or_names += make_array options[:type]
31
- if type_regexpes_or_names.empty?
32
- return Aquarium::Finders::FinderResult.new
33
- end
34
- self.find_all_by type_regexpes_or_names
35
- end
36
-
37
- # Input is a list or array object with names and/or regular expressions.
38
- def find_all_by *possible_type_regexpes_or_names
39
- raise "Input name or name array can't be nil!" if possible_type_regexpes_or_names.nil?
40
- result = Aquarium::Finders::FinderResult.new
41
- make_array(*possible_type_regexpes_or_names).each do |expression|
42
- found_types = Aquarium::Finders::TypeFinder.new.find :types => expression
43
- found_types.matched_keys.each do |type|
44
- result << find_all_by_types(type)
45
- end
46
- found_types.not_matched_keys.each do |type|
47
- result.append_not_matched({type => Set.new([])})
48
- end
49
- end
50
- result
51
- end
52
-
53
- # Return the objects in ObjectSpace for the input classes and modules.
54
- def find_all_by_types *types
55
- result = Aquarium::Finders::FinderResult.new
56
- make_array(*types).each do |type|
57
- object_space.each_object(type) do |obj|
58
- result.append_matched type => obj
59
- end
60
- result.append_not_matched type => [] unless result.matched[type]
61
- end
62
- result
63
- end
64
-
65
- def initialize object_space = ObjectSpace
66
- @object_space = object_space
67
- end
68
-
69
- protected
70
-
71
- attr_reader :object_space
72
-
73
- end
74
- end
75
- end
@@ -1,231 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper.rb'
2
- require 'aquarium/finders/object_finder'
3
-
4
- # :stopdoc:
5
- class OBase
6
- attr_reader :name
7
- def initialize name; @name = name; end
8
- def == other
9
- name == other.name
10
- end
11
- end
12
-
13
- class ODerived < OBase
14
- def initialize name; super; end
15
- end
16
-
17
- module Mod; end
18
-
19
- class IncludesMod
20
- include Mod
21
- attr_reader :name
22
- def initialize name; @name = name; end
23
- def == other
24
- name == other.name
25
- end
26
- end
27
-
28
- class ClassNotInstantiated; end
29
- class ClassNotInstantiated2; end
30
- # :startdoc:
31
-
32
- b1 = OBase.new "b1"
33
- b2 = OBase.new "b2"
34
- d1 = ODerived.new "d1"
35
- d2 = ODerived.new "d2"
36
- m1 = IncludesMod.new "m1"
37
- m2 = IncludesMod.new "m2"
38
-
39
- def space_of_objects
40
- end
41
-
42
- # Running the tests with the real Aquarium::Finders::ObjectFinder is too slow when looking
43
- # for "objects" of type Class or Module, i.e., to retrieve classes and modules.
44
- class MockObjectSpace
45
- @@space_of_objects = [OBase, ODerived, String, IncludesMod, Mod, Kernel, Class]
46
-
47
- def self.each_object type
48
- @@space_of_objects.each do |object|
49
- yield(object) if (object.kind_of?(type) and block_given?)
50
- end
51
- end
52
- end
53
-
54
- class TestObjectFinder < Aquarium::Finders::ObjectFinder
55
- def initialize
56
- super MockObjectSpace
57
- end
58
- end
59
-
60
- describe Aquarium::Finders::ObjectFinder, "#find_all_by_types" do
61
- it "should return an empty FinderResult#matched hash and FinderResult#not_matched list if no types are specified." do
62
- actual = Aquarium::Finders::ObjectFinder.new.find_all_by_types
63
- actual.matched.should == {}
64
- actual.not_matched == []
65
- end
66
-
67
- it "should return the input types in the FinderResult#not_matched list if the specified types have no instances." do
68
- actual = Aquarium::Finders::ObjectFinder.new.find_all_by_types ClassNotInstantiated
69
- actual.matched_keys.should == []
70
- actual.not_matched == [ClassNotInstantiated]
71
- end
72
- end
73
-
74
- describe Aquarium::Finders::ObjectFinder, ".find_all_by_types" do
75
-
76
- it "should return all objects of a specified base type and its derivatives." do
77
- actual = Aquarium::Finders::ObjectFinder.new.find_all_by_types(OBase)
78
- actual.matched.size.should == 1
79
- actual.matched[OBase].sort_by {|o| o.name}.should == [b1, b2, d1, d2]
80
- actual.not_matched.should == {}
81
- end
82
-
83
- it "should return all objects of a specified derived type." do
84
- actual = Aquarium::Finders::ObjectFinder.new.find_all_by_types(ODerived)
85
- actual.matched.size.should == 1
86
- actual.matched[ODerived].sort_by {|o| o.name}.should == [d1, d2]
87
- actual.not_matched.should == {}
88
- end
89
-
90
- it "should return all objects of a specified module." do
91
- actual = Aquarium::Finders::ObjectFinder.new.find_all_by_types(Mod)
92
- actual.matched.size.should == 1
93
- actual.matched[Mod].sort_by {|o| o.name}.should == [m1, m2]
94
- actual.not_matched.should == {}
95
- end
96
-
97
- it "should return all objects of a list of types." do
98
- actual = Aquarium::Finders::ObjectFinder.new.find_all_by_types(ODerived, Mod)
99
- actual.matched.size.should == 2
100
- actual.matched[ODerived].sort_by {|o| o.name}.should == [d1, d2]
101
- actual.matched[Mod].sort_by {|o| o.name}.should == [m1, m2]
102
- actual.not_matched.should == {}
103
- end
104
-
105
- it "should return all objects of an array of types." do
106
- actual = Aquarium::Finders::ObjectFinder.new.find_all_by_types([ODerived, Mod])
107
- actual.matched.size.should == 2
108
- actual.matched[ODerived].sort_by {|o| o.name}.should == [d1, d2]
109
- actual.matched[Mod].sort_by {|o| o.name}.should == [m1, m2]
110
- actual.not_matched.should == {}
111
- end
112
-
113
- end
114
-
115
- describe Aquarium::Finders::ObjectFinder, "#find" do
116
-
117
- it "should return all objects of a specified base type and its derivatives." do
118
- actual = Aquarium::Finders::ObjectFinder.new.find :type => OBase
119
- actual.matched.size.should == 1
120
- actual.matched[OBase].sort_by {|o| o.name}.should == [b1, b2, d1, d2]
121
- actual.matched[OBase].each {|o| [b1, b2, d1, d2].include?(o)}
122
- actual.not_matched.should == {}
123
- end
124
-
125
- it "should return all objects of a specified derived type." do
126
- actual = Aquarium::Finders::ObjectFinder.new.find :types => ODerived
127
- actual.matched.size.should == 1
128
- actual.matched[ODerived].sort_by {|o| o.name}.should == [d1, d2]
129
- actual.not_matched.should == {}
130
- end
131
-
132
- it "should return all objects of a specified module." do
133
- actual = Aquarium::Finders::ObjectFinder.new.find :type => Mod
134
- actual.matched.size.should == 1
135
- actual.matched[Mod].sort_by {|o| o.name}.should == [m1, m2]
136
- actual.not_matched.should == {}
137
- end
138
-
139
- it "should return all objects of a list of types." do
140
- actual = Aquarium::Finders::ObjectFinder.new.find :type => [ODerived, Mod]
141
- actual.matched.size.should == 2
142
- actual.matched[ODerived].sort_by {|o| o.name}.should == [d1, d2]
143
- actual.matched[Mod].sort_by {|o| o.name}.should == [m1, m2]
144
- actual.not_matched.should == {}
145
- end
146
-
147
- it "should accept an array of one type or the type itself as the value for the :type key." do
148
- actual1 = Aquarium::Finders::ObjectFinder.new.find :type => Mod
149
- actual2 = Aquarium::Finders::ObjectFinder.new.find :type => [Mod]
150
- actual1.matched.should == actual2.matched
151
- actual1.matched.should == actual2.matched
152
- end
153
-
154
- it "should accept :type as a synonym for the :types key." do
155
- actual1 = Aquarium::Finders::ObjectFinder.new.find :types => Mod
156
- actual2 = Aquarium::Finders::ObjectFinder.new.find :type => Mod
157
- actual1.matched.should == actual2.matched
158
- actual1.matched.should == actual2.matched
159
- end
160
-
161
-
162
- it "should behave as find_all_by with a different invocation syntax." do
163
- actual1 = Aquarium::Finders::ObjectFinder.new.find :types => Mod
164
- actual2 = Aquarium::Finders::ObjectFinder.new.find :type => Mod
165
- actual1.matched.should == actual2.matched
166
- actual1.matched.should == actual2.matched
167
- end
168
- end
169
-
170
- describe Aquarium::Finders::ObjectFinder, "#find" do
171
- it "should return an empty FinderResult#matched hash and FinderResult#not_matched list if no types are specified." do
172
- actual = Aquarium::Finders::ObjectFinder.new.find
173
- actual.matched.should == {}
174
- actual.not_matched.should == {}
175
- end
176
-
177
- it "should return the input types in the FinderResult#not_matched list if the types have no instances." do
178
- actual = Aquarium::Finders::ObjectFinder.new.find :type => "ClassNotInstantiated"
179
- actual.matched_keys.should == []
180
- actual.not_matched_keys.should == [ClassNotInstantiated]
181
- end
182
-
183
- it "should accept a single type name as the value for the key :type." do
184
- actual = Aquarium::Finders::ObjectFinder.new.find :type => "ClassNotInstantiated"
185
- actual.matched_keys.should == []
186
- actual.not_matched_keys.should == [ClassNotInstantiated]
187
- end
188
-
189
- it "should accept an array of type names as the value for the key :types." do
190
- actual = Aquarium::Finders::ObjectFinder.new.find :type => ["ClassNotInstantiated", "ClassNotInstantiated2"]
191
- actual.matched_keys.should == []
192
- actual.not_matched_keys.size.should == 2
193
- actual.not_matched_keys.should include(ClassNotInstantiated)
194
- actual.not_matched_keys.should include(ClassNotInstantiated2)
195
- end
196
-
197
- it "should return the input types in the FinderResult#not_matched list if the types do not exist." do
198
- type_list = [/^NeverBeforeSeen/, "NotLikelyToExistClass"]
199
- actual = Aquarium::Finders::ObjectFinder.new.find :type => type_list
200
- actual.matched_keys.should == []
201
- actual.not_matched_keys.should == type_list
202
- end
203
-
204
- it "should accept :type and :types as synonyms for type name hash keys." do
205
- type_list = [/^NeverBeforeSeen/, "NotLikelyToExistClass"]
206
- actual1 = Aquarium::Finders::ObjectFinder.new.find :type => type_list
207
- actual2 = Aquarium::Finders::ObjectFinder.new.find :types => type_list
208
- actual1.matched.should == actual2.matched
209
- actual1.not_matched.should == actual2.not_matched
210
- end
211
- end
212
-
213
- describe Aquarium::Finders::ObjectFinder, "#find" do
214
- it "should return classes, not objects, when given Class as the type." do
215
- # Uses Test override for faster test execution.
216
- actual = TestObjectFinder.new.find :type => Class
217
- actual.matched[Class].should include(OBase)
218
- actual.matched[Class].should include(ODerived)
219
- actual.matched[Class].should include(String)
220
- actual.not_matched_keys.should == []
221
- end
222
-
223
- it "should return modules, not objects, when given Module as the type." do
224
- # Uses Test override for faster test execution.
225
- actual = TestObjectFinder.new.find :type => Module
226
- actual.matched[Module].should include(Mod)
227
- actual.matched[Module].should include(Kernel)
228
- actual.matched[Module].should include(Class)
229
- actual.not_matched_keys.should == []
230
- end
231
- end