aquarium 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +26 -5
- data/README +8 -8
- data/RELEASE-PLAN +20 -2
- data/TODO.rb +26 -0
- data/UPGRADE +5 -5
- data/examples/aspect_design_example.rb +1 -1
- data/examples/aspect_design_example_spec.rb +1 -1
- data/examples/design_by_contract_example.rb +4 -9
- data/examples/design_by_contract_example_spec.rb +7 -9
- data/examples/exception_wrapping_example.rb +48 -0
- data/examples/exception_wrapping_example_spec.rb +49 -0
- data/examples/reusable_aspect_hack_example.rb +56 -0
- data/examples/reusable_aspect_hack_example_spec.rb +80 -0
- data/lib/aquarium.rb +1 -0
- data/lib/aquarium/aspects.rb +1 -1
- data/lib/aquarium/aspects/advice.rb +16 -13
- data/lib/aquarium/aspects/aspect.rb +81 -56
- data/lib/aquarium/aspects/join_point.rb +4 -4
- data/lib/aquarium/aspects/pointcut.rb +49 -73
- data/lib/aquarium/dsl.rb +2 -0
- data/lib/aquarium/dsl/aspect_dsl.rb +77 -0
- data/lib/aquarium/{aspects/dsl → dsl}/object_dsl.rb +2 -2
- data/lib/aquarium/extras/design_by_contract.rb +1 -1
- data/lib/aquarium/finders.rb +1 -1
- data/lib/aquarium/finders/method_finder.rb +26 -26
- data/lib/aquarium/finders/type_finder.rb +45 -39
- data/lib/aquarium/utils/array_utils.rb +6 -5
- data/lib/aquarium/utils/default_logger.rb +2 -1
- data/lib/aquarium/utils/options_utils.rb +178 -67
- data/lib/aquarium/utils/set_utils.rb +8 -3
- data/lib/aquarium/version.rb +1 -1
- data/spec/aquarium/aspects/aspect_invocation_spec.rb +111 -14
- data/spec/aquarium/aspects/aspect_spec.rb +91 -7
- data/spec/aquarium/aspects/pointcut_spec.rb +61 -0
- data/spec/aquarium/{aspects/dsl → dsl}/aspect_dsl_spec.rb +76 -32
- data/spec/aquarium/finders/method_finder_spec.rb +80 -80
- data/spec/aquarium/finders/type_finder_spec.rb +57 -52
- data/spec/aquarium/finders/type_finder_with_descendents_and_ancestors_spec.rb +12 -12
- data/spec/aquarium/spec_example_types.rb +4 -3
- data/spec/aquarium/utils/array_utils_spec.rb +9 -7
- data/spec/aquarium/utils/options_utils_spec.rb +106 -5
- data/spec/aquarium/utils/set_utils_spec.rb +14 -0
- metadata +12 -7
- data/lib/aquarium/aspects/dsl.rb +0 -2
- data/lib/aquarium/aspects/dsl/aspect_dsl.rb +0 -64
@@ -107,9 +107,9 @@ describe Aquarium::Finders::MethodFinder, "#find (synonymous input parameters)"
|
|
107
107
|
end
|
108
108
|
end
|
109
109
|
|
110
|
-
Aquarium::Finders::MethodFinder::CANONICAL_OPTIONS["
|
111
|
-
it "should accept :#{key} as a synonym for :
|
112
|
-
expected = Aquarium::Finders::MethodFinder.new.find :types => Derived, :methods => [/^mder/, /^mmod/], :
|
110
|
+
Aquarium::Finders::MethodFinder::CANONICAL_OPTIONS["method_options"].each do |key|
|
111
|
+
it "should accept :#{key} as a synonym for :method_options." do
|
112
|
+
expected = Aquarium::Finders::MethodFinder.new.find :types => Derived, :methods => [/^mder/, /^mmod/], :method_options => [:exclude_ancestor_methods]
|
113
113
|
actual = Aquarium::Finders::MethodFinder.new.find :types => Derived, :methods => [/^mder/, /^mmod/], key.intern => [:exclude_ancestor_methods]
|
114
114
|
actual.should == expected
|
115
115
|
end
|
@@ -127,10 +127,10 @@ describe Aquarium::Finders::MethodFinder, "#find (invalid input parameters)" do
|
|
127
127
|
end
|
128
128
|
|
129
129
|
it "should raise if options include :singleton and :class, :public, :protected, or :private." do
|
130
|
-
lambda { Aquarium::Finders::MethodFinder.new.find :type => String, :method => "foo", :
|
131
|
-
lambda { Aquarium::Finders::MethodFinder.new.find :type => String, :method => "foo", :
|
132
|
-
lambda { Aquarium::Finders::MethodFinder.new.find :type => String, :method => "foo", :
|
133
|
-
lambda { Aquarium::Finders::MethodFinder.new.find :type => String, :method => "foo", :
|
130
|
+
lambda { Aquarium::Finders::MethodFinder.new.find :type => String, :method => "foo", :method_options => [:singleton, :class] }.should raise_error(Aquarium::Utils::InvalidOptions)
|
131
|
+
lambda { Aquarium::Finders::MethodFinder.new.find :type => String, :method => "foo", :method_options => [:singleton, :public] }.should raise_error(Aquarium::Utils::InvalidOptions)
|
132
|
+
lambda { Aquarium::Finders::MethodFinder.new.find :type => String, :method => "foo", :method_options => [:singleton, :protected] }.should raise_error(Aquarium::Utils::InvalidOptions)
|
133
|
+
lambda { Aquarium::Finders::MethodFinder.new.find :type => String, :method => "foo", :method_options => [:singleton, :private] }.should raise_error(Aquarium::Utils::InvalidOptions)
|
134
134
|
end
|
135
135
|
end
|
136
136
|
|
@@ -260,14 +260,14 @@ describe Aquarium::Finders::MethodFinder, "#find (behavior for derived classes)"
|
|
260
260
|
end
|
261
261
|
|
262
262
|
it "should only find Derived methods for a type when ancestor methods are excluded, which also excludes method overrides." do
|
263
|
-
actual = Aquarium::Finders::MethodFinder.new.find :types => Derived, :methods => [/^mder/, /^mmod/], :
|
263
|
+
actual = Aquarium::Finders::MethodFinder.new.find :types => Derived, :methods => [/^mder/, /^mmod/], :method_options => [:exclude_ancestor_methods]
|
264
264
|
actual.matched.size.should == 1
|
265
265
|
actual.matched[Derived].should == Set.new([:mderived1, :mmodule2b])
|
266
266
|
end
|
267
267
|
|
268
268
|
it "should only find Derived methods for an object when ancestor methods are excluded, which also excludes method overrides." do
|
269
269
|
child = Derived.new
|
270
|
-
actual = Aquarium::Finders::MethodFinder.new.find :object => child, :methods => [/^mder/, /^mmodule/], :
|
270
|
+
actual = Aquarium::Finders::MethodFinder.new.find :object => child, :methods => [/^mder/, /^mmodule/], :method_options => [:exclude_ancestor_methods]
|
271
271
|
actual.matched.size.should == 1
|
272
272
|
actual.matched[child].should == Set.new([:mderived1, :mmodule2b])
|
273
273
|
end
|
@@ -302,7 +302,7 @@ describe Aquarium::Finders::MethodFinder, "#find (behavior for included modules)
|
|
302
302
|
end
|
303
303
|
|
304
304
|
it "should only find defined methods for a module when ancestor methods are excluded, which also excludes method overrides." do
|
305
|
-
actual = Aquarium::Finders::MethodFinder.new.find :type => [M, M2], :methods => /^mmod/, :
|
305
|
+
actual = Aquarium::Finders::MethodFinder.new.find :type => [M, M2], :methods => /^mmod/, :method_options => [:exclude_ancestor_methods]
|
306
306
|
actual.matched.size.should == 2
|
307
307
|
actual.matched[M].should == Set.new([:mmodule1, :mmodule2])
|
308
308
|
actual.matched[M2].should == Set.new([:mmodule3, :mmodule4])
|
@@ -311,7 +311,7 @@ describe Aquarium::Finders::MethodFinder, "#find (behavior for included modules)
|
|
311
311
|
it "should not find any methods from included modules in classes when ancestor methods are excluded, which also excludes method overrides." do
|
312
312
|
child = Derived.new
|
313
313
|
child2 = Derived2.new
|
314
|
-
actual = Aquarium::Finders::MethodFinder.new.find :objects => [child, child2], :methods => /^mmodule/, :
|
314
|
+
actual = Aquarium::Finders::MethodFinder.new.find :objects => [child, child2], :methods => /^mmodule/, :method_options => [:exclude_ancestor_methods]
|
315
315
|
actual.matched.size.should == 2
|
316
316
|
actual.matched[child].should == Set.new([:mmodule2b])
|
317
317
|
actual.matched[child2].should == Set.new([:mmodule2b, :mmodule4b])
|
@@ -332,14 +332,14 @@ describe Aquarium::Finders::MethodFinder, "#find (searching for class methods)"
|
|
332
332
|
expected[clazz] = [:respond_to?]
|
333
333
|
end
|
334
334
|
class_array = [Kernel, Module, Object, Class]
|
335
|
-
actual = Aquarium::Finders::MethodFinder.new.find :types => class_array, :methods => [/^resp.*\?$/, /^ch.*\!$/], :
|
335
|
+
actual = Aquarium::Finders::MethodFinder.new.find :types => class_array, :methods => [/^resp.*\?$/, /^ch.*\!$/], :method_options => :class
|
336
336
|
class_array.each do |c|
|
337
337
|
actual.matched[c].should == Set.new(expected[c])
|
338
338
|
end
|
339
339
|
end
|
340
340
|
|
341
341
|
it "should find all public class methods in types when searching with the :all method specification and the :class option." do
|
342
|
-
actual = Aquarium::Finders::MethodFinder.new.find :types => [ClassWithPublicClassMethod, ClassWithPrivateClassMethod], :methods => :all, :
|
342
|
+
actual = Aquarium::Finders::MethodFinder.new.find :types => [ClassWithPublicClassMethod, ClassWithPrivateClassMethod], :methods => :all, :method_options => :class
|
343
343
|
actual.matched.size.should == 2
|
344
344
|
actual.not_matched.size.should == 0
|
345
345
|
actual.matched[ClassWithPublicClassMethod].should == Set.new(ClassWithPublicClassMethod.public_methods.sort.map{|m| m.intern})
|
@@ -347,7 +347,7 @@ describe Aquarium::Finders::MethodFinder, "#find (searching for class methods)"
|
|
347
347
|
end
|
348
348
|
|
349
349
|
it "should accept :all_methods as a synonym for :all." do
|
350
|
-
actual = Aquarium::Finders::MethodFinder.new.find :types => [ClassWithPublicClassMethod, ClassWithPrivateClassMethod], :methods => :all_methods, :
|
350
|
+
actual = Aquarium::Finders::MethodFinder.new.find :types => [ClassWithPublicClassMethod, ClassWithPrivateClassMethod], :methods => :all_methods, :method_options => :class
|
351
351
|
actual.matched.size.should == 2
|
352
352
|
actual.not_matched.size.should == 0
|
353
353
|
actual.matched[ClassWithPublicClassMethod].should == Set.new(ClassWithPublicClassMethod.public_methods.sort.map{|m| m.intern})
|
@@ -355,7 +355,7 @@ describe Aquarium::Finders::MethodFinder, "#find (searching for class methods)"
|
|
355
355
|
end
|
356
356
|
|
357
357
|
it "should find all public class methods in types, but not ancestors, when searching with the :all method specification and the :class and :exclude_ancestor_methods options." do
|
358
|
-
actual = Aquarium::Finders::MethodFinder.new.find :types => [ClassWithPublicClassMethod, ClassWithPrivateClassMethod], :methods => :all, :
|
358
|
+
actual = Aquarium::Finders::MethodFinder.new.find :types => [ClassWithPublicClassMethod, ClassWithPrivateClassMethod], :methods => :all, :method_options => [:class, :exclude_ancestor_methods]
|
359
359
|
actual.matched.size.should == 1
|
360
360
|
actual.not_matched.size.should == 1
|
361
361
|
actual.matched[ClassWithPublicClassMethod].should == Set.new([:public_class_test_method])
|
@@ -369,7 +369,7 @@ describe Aquarium::Finders::MethodFinder, "#find (searching for class methods de
|
|
369
369
|
end
|
370
370
|
|
371
371
|
def do_class_methods_for_modules method_spec, options_spec
|
372
|
-
actual = Aquarium::Finders::MethodFinder.new.find :type => [M, M2], :methods => method_spec, :
|
372
|
+
actual = Aquarium::Finders::MethodFinder.new.find :type => [M, M2], :methods => method_spec, :method_options => options_spec
|
373
373
|
actual.matched.size.should == 2
|
374
374
|
actual.matched[M].should == Set.new([:cmmodule1])
|
375
375
|
actual.matched[M2].should == Set.new([:cmmodule3])
|
@@ -392,21 +392,21 @@ describe Aquarium::Finders::MethodFinder, "#find (searching for class methods de
|
|
392
392
|
end
|
393
393
|
|
394
394
|
it "should find all public class methods in types when searching with the :all method specification and the :class option." do
|
395
|
-
actual = Aquarium::Finders::MethodFinder.new.find :type => [M, M2], :methods => :all, :
|
395
|
+
actual = Aquarium::Finders::MethodFinder.new.find :type => [M, M2], :methods => :all, :method_options => [:class]
|
396
396
|
actual.matched.size.should == 2
|
397
397
|
actual.matched[M].should == Set.new(M.public_methods.sort.map{|m| m.intern})
|
398
398
|
actual.matched[M2].should == Set.new(M2.public_methods.sort.map{|m| m.intern})
|
399
399
|
end
|
400
400
|
|
401
401
|
it "should not find any module-defined class methods in classes that include the modules." do
|
402
|
-
actual = Aquarium::Finders::MethodFinder.new.find :types => [Derived, Derived2], :methods => /^cmmodule/, :
|
402
|
+
actual = Aquarium::Finders::MethodFinder.new.find :types => [Derived, Derived2], :methods => /^cmmodule/, :method_options => [:class]
|
403
403
|
actual.matched.size.should == 0
|
404
404
|
end
|
405
405
|
|
406
406
|
it "should not find any module-defined class methods in instances of classes that include the modules." do
|
407
407
|
child = Derived.new
|
408
408
|
child2 = Derived2.new
|
409
|
-
actual = Aquarium::Finders::MethodFinder.new.find :objects => [child, child2], :methods => /^cmmodule/, :
|
409
|
+
actual = Aquarium::Finders::MethodFinder.new.find :objects => [child, child2], :methods => /^cmmodule/, :method_options => [:class]
|
410
410
|
actual.matched.size.should == 0
|
411
411
|
end
|
412
412
|
end
|
@@ -571,44 +571,44 @@ describe Aquarium::Finders::MethodFinder, "#find (using :methods => :all)" do
|
|
571
571
|
end
|
572
572
|
|
573
573
|
it "should accept :all for the methods argument and find all methods for a type subject to the method options." do
|
574
|
-
actual = Aquarium::Finders::MethodFinder.new.find :type => ClassWithPublicInstanceMethod, :method => :all, :
|
574
|
+
actual = Aquarium::Finders::MethodFinder.new.find :type => ClassWithPublicInstanceMethod, :method => :all, :method_options => :exclude_ancestor_methods
|
575
575
|
actual.matched.size.should == 1
|
576
576
|
actual.matched[ClassWithPublicInstanceMethod].should == Set.new([:public_instance_test_method])
|
577
577
|
end
|
578
578
|
|
579
579
|
it "should accept :all for the methods argument and find all methods for an object subject to the method options." do
|
580
580
|
pub = ClassWithPublicInstanceMethod.new
|
581
|
-
actual = Aquarium::Finders::MethodFinder.new.find :object => pub, :method => :all, :
|
581
|
+
actual = Aquarium::Finders::MethodFinder.new.find :object => pub, :method => :all, :method_options => :exclude_ancestor_methods
|
582
582
|
actual.matched.size.should == 1
|
583
583
|
actual.matched[pub].should == Set.new([:public_instance_test_method])
|
584
584
|
end
|
585
585
|
|
586
586
|
it "should ignore other method arguments if :all is present." do
|
587
|
-
actual = Aquarium::Finders::MethodFinder.new.find :type => ClassWithPublicInstanceMethod, :method => [:all, :none, /.*foo.*/], :methods =>[/.*bar.*/, /^baz/], :
|
587
|
+
actual = Aquarium::Finders::MethodFinder.new.find :type => ClassWithPublicInstanceMethod, :method => [:all, :none, /.*foo.*/], :methods =>[/.*bar.*/, /^baz/], :method_options => :exclude_ancestor_methods
|
588
588
|
actual.matched.size.should == 1
|
589
589
|
actual.matched[ClassWithPublicInstanceMethod].should == Set.new([:public_instance_test_method])
|
590
590
|
pub = ClassWithPublicInstanceMethod.new
|
591
|
-
actual = Aquarium::Finders::MethodFinder.new.find :object => pub, :method => [:all, :none, /.*foo.*/], :methods =>[/.*bar.*/, /^baz/], :
|
591
|
+
actual = Aquarium::Finders::MethodFinder.new.find :object => pub, :method => [:all, :none, /.*foo.*/], :methods =>[/.*bar.*/, /^baz/], :method_options => :exclude_ancestor_methods
|
592
592
|
actual.matched.size.should == 1
|
593
593
|
actual.matched[pub].should == Set.new([:public_instance_test_method])
|
594
594
|
end
|
595
595
|
|
596
596
|
it "should ignore other method arguments if :all_methods is present." do
|
597
|
-
actual = Aquarium::Finders::MethodFinder.new.find :type => ClassWithPublicInstanceMethod, :method => [:all_methods, :none, /.*foo.*/], :methods =>[/.*bar.*/, /^baz/], :
|
597
|
+
actual = Aquarium::Finders::MethodFinder.new.find :type => ClassWithPublicInstanceMethod, :method => [:all_methods, :none, /.*foo.*/], :methods =>[/.*bar.*/, /^baz/], :method_options => :exclude_ancestor_methods
|
598
598
|
actual.matched.size.should == 1
|
599
599
|
actual.matched[ClassWithPublicInstanceMethod].should == Set.new([:public_instance_test_method])
|
600
600
|
pub = ClassWithPublicInstanceMethod.new
|
601
|
-
actual = Aquarium::Finders::MethodFinder.new.find :object => pub, :method => [:all, :none, /.*foo.*/], :methods =>[/.*bar.*/, /^baz/], :
|
601
|
+
actual = Aquarium::Finders::MethodFinder.new.find :object => pub, :method => [:all, :none, /.*foo.*/], :methods =>[/.*bar.*/, /^baz/], :method_options => :exclude_ancestor_methods
|
602
602
|
actual.matched.size.should == 1
|
603
603
|
actual.matched[pub].should == Set.new([:public_instance_test_method])
|
604
604
|
end
|
605
605
|
|
606
606
|
it "should report [:all] as the not_matched value when :all is the method argument and no methods match, e.g., for :exclude_ancestor_methods." do
|
607
|
-
actual = Aquarium::Finders::MethodFinder.new.find :type => ClassWithPrivateInstanceMethod, :method => :all, :
|
607
|
+
actual = Aquarium::Finders::MethodFinder.new.find :type => ClassWithPrivateInstanceMethod, :method => :all, :method_options => :exclude_ancestor_methods
|
608
608
|
actual.matched.size.should == 0
|
609
609
|
actual.not_matched[ClassWithPrivateInstanceMethod].should == Set.new([:all])
|
610
610
|
pri = ClassWithPrivateInstanceMethod.new
|
611
|
-
actual = Aquarium::Finders::MethodFinder.new.find :object => pri, :method => :all, :
|
611
|
+
actual = Aquarium::Finders::MethodFinder.new.find :object => pri, :method => :all, :method_options => :exclude_ancestor_methods
|
612
612
|
actual.matched.size.should == 0
|
613
613
|
actual.not_matched[pri].should == Set.new([:all])
|
614
614
|
end
|
@@ -622,23 +622,23 @@ end
|
|
622
622
|
|
623
623
|
describe Aquarium::Finders::MethodFinder, "#find for types (using :exclude_methods)" do
|
624
624
|
it "should return an empty result for classes if :exclude_methods => :all specified." do
|
625
|
-
actual = Aquarium::Finders::MethodFinder.new.find :types => ExcludeMethodTester, :methods => :all, :exclude_methods => :all, :
|
625
|
+
actual = Aquarium::Finders::MethodFinder.new.find :types => ExcludeMethodTester, :methods => :all, :exclude_methods => :all, :method_options => :exclude_ancestor_methods
|
626
626
|
actual.matched.size.should == 0
|
627
627
|
actual.not_matched.size.should == 0
|
628
628
|
end
|
629
629
|
it "should return an empty result for modules if :exclude_methods => :all specified." do
|
630
|
-
actual = Aquarium::Finders::MethodFinder.new.find :types => M2, :methods => :all, :exclude_methods => :all, :
|
630
|
+
actual = Aquarium::Finders::MethodFinder.new.find :types => M2, :methods => :all, :exclude_methods => :all, :method_options => :exclude_ancestor_methods
|
631
631
|
actual.matched.size.should == 0
|
632
632
|
actual.not_matched.size.should == 0
|
633
633
|
end
|
634
634
|
it "should return an empty result for classes including modules if :exclude_methods => :all specified." do
|
635
|
-
actual = Aquarium::Finders::MethodFinder.new.find :types => Derived2, :methods => :all, :exclude_methods => :all, :
|
635
|
+
actual = Aquarium::Finders::MethodFinder.new.find :types => Derived2, :methods => :all, :exclude_methods => :all, :method_options => :exclude_ancestor_methods
|
636
636
|
actual.matched.size.should == 0
|
637
637
|
actual.not_matched.size.should == 0
|
638
638
|
end
|
639
639
|
|
640
640
|
it "should remove excluded methods from the result for classes where a single excluded methods is specified by name." do
|
641
|
-
actual = Aquarium::Finders::MethodFinder.new.find :types => ExcludeMethodTester, :methods => :all, :exclude_method => :method1, :
|
641
|
+
actual = Aquarium::Finders::MethodFinder.new.find :types => ExcludeMethodTester, :methods => :all, :exclude_method => :method1, :method_options => :exclude_ancestor_methods
|
642
642
|
actual.matched.size.should == 1
|
643
643
|
actual.matched[ExcludeMethodTester].size.should == 2
|
644
644
|
actual.matched[ExcludeMethodTester].should == Set.new([:method2, :method3])
|
@@ -658,7 +658,7 @@ describe Aquarium::Finders::MethodFinder, "#find for types (using :exclude_metho
|
|
658
658
|
end
|
659
659
|
|
660
660
|
it "should remove excluded methods from the result where the excluded methods are specified by an array of names." do
|
661
|
-
actual = Aquarium::Finders::MethodFinder.new.find :types => ExcludeMethodTester, :methods => :all, :exclude_methods => [:method1, :method2], :
|
661
|
+
actual = Aquarium::Finders::MethodFinder.new.find :types => ExcludeMethodTester, :methods => :all, :exclude_methods => [:method1, :method2], :method_options => :exclude_ancestor_methods
|
662
662
|
actual.matched.size.should == 1
|
663
663
|
actual.matched[ExcludeMethodTester].size.should == 1
|
664
664
|
actual.matched[ExcludeMethodTester].should == Set.new([:method3])
|
@@ -666,7 +666,7 @@ describe Aquarium::Finders::MethodFinder, "#find for types (using :exclude_metho
|
|
666
666
|
end
|
667
667
|
|
668
668
|
it "should remove excluded methods from the result where the excluded methods are specified by regular expression." do
|
669
|
-
actual = Aquarium::Finders::MethodFinder.new.find :types => ExcludeMethodTester, :methods => :all, :exclude_methods => /meth.*1$/, :
|
669
|
+
actual = Aquarium::Finders::MethodFinder.new.find :types => ExcludeMethodTester, :methods => :all, :exclude_methods => /meth.*1$/, :method_options => :exclude_ancestor_methods
|
670
670
|
actual.matched.size.should == 1
|
671
671
|
actual.matched[ExcludeMethodTester].size.should == 2
|
672
672
|
actual.matched[ExcludeMethodTester].should == Set.new([:method2, :method3])
|
@@ -674,7 +674,7 @@ describe Aquarium::Finders::MethodFinder, "#find for types (using :exclude_metho
|
|
674
674
|
end
|
675
675
|
|
676
676
|
it "should support :exclude_method as a synonym." do
|
677
|
-
actual = Aquarium::Finders::MethodFinder.new.find :types => ExcludeMethodTester, :methods => :all, :exclude_method => :method1, :
|
677
|
+
actual = Aquarium::Finders::MethodFinder.new.find :types => ExcludeMethodTester, :methods => :all, :exclude_method => :method1, :method_options => :exclude_ancestor_methods
|
678
678
|
actual.matched.size.should == 1
|
679
679
|
actual.matched[ExcludeMethodTester].size.should == 2
|
680
680
|
actual.matched[ExcludeMethodTester].should == Set.new([:method2, :method3])
|
@@ -682,26 +682,26 @@ describe Aquarium::Finders::MethodFinder, "#find for types (using :exclude_metho
|
|
682
682
|
end
|
683
683
|
|
684
684
|
it "should not add the excluded methods to the #not_matched results." do
|
685
|
-
actual = Aquarium::Finders::MethodFinder.new.find :types => ExcludeMethodTester, :methods => :all, :exclude_methods => /meth.*1$/, :
|
685
|
+
actual = Aquarium::Finders::MethodFinder.new.find :types => ExcludeMethodTester, :methods => :all, :exclude_methods => /meth.*1$/, :method_options => :exclude_ancestor_methods
|
686
686
|
actual.not_matched.size.should == 0
|
687
687
|
end
|
688
688
|
end
|
689
689
|
|
690
690
|
describe Aquarium::Finders::MethodFinder, "#find for objects (using :exclude_methods)" do
|
691
691
|
it "should return an empty result for instances of classes if :exclude_methods => :all specified." do
|
692
|
-
actual = Aquarium::Finders::MethodFinder.new.find :object => ExcludeMethodTester.new, :methods => :all, :exclude_methods => :all, :
|
692
|
+
actual = Aquarium::Finders::MethodFinder.new.find :object => ExcludeMethodTester.new, :methods => :all, :exclude_methods => :all, :method_options => :exclude_ancestor_methods
|
693
693
|
actual.matched.size.should == 0
|
694
694
|
actual.not_matched.size.should == 0
|
695
695
|
end
|
696
696
|
it "should return an empty result for for instances of classes that include modules if :exclude_methods => :all specified." do
|
697
|
-
actual = Aquarium::Finders::MethodFinder.new.find :object => Derived2.new, :methods => :all, :exclude_methods => :all, :
|
697
|
+
actual = Aquarium::Finders::MethodFinder.new.find :object => Derived2.new, :methods => :all, :exclude_methods => :all, :method_options => :exclude_ancestor_methods
|
698
698
|
actual.matched.size.should == 0
|
699
699
|
actual.not_matched.size.should == 0
|
700
700
|
end
|
701
701
|
|
702
702
|
it "should remove excluded methods from the result where a single excluded methods is specified by name." do
|
703
703
|
emt = ExcludeMethodTester.new
|
704
|
-
actual = Aquarium::Finders::MethodFinder.new.find :object => emt, :methods => :all, :exclude_method => :method1, :
|
704
|
+
actual = Aquarium::Finders::MethodFinder.new.find :object => emt, :methods => :all, :exclude_method => :method1, :method_options => :exclude_ancestor_methods
|
705
705
|
actual.matched.size.should == 1
|
706
706
|
actual.matched[emt].size.should == 2
|
707
707
|
actual.matched[emt].should == Set.new([:method2, :method3])
|
@@ -710,7 +710,7 @@ describe Aquarium::Finders::MethodFinder, "#find for objects (using :exclude_met
|
|
710
710
|
|
711
711
|
it "should remove excluded methods from the result where the excluded methods are specified by an array of names." do
|
712
712
|
emt = ExcludeMethodTester.new
|
713
|
-
actual = Aquarium::Finders::MethodFinder.new.find :object => emt, :methods => :all, :exclude_methods => [:method1, :method2], :
|
713
|
+
actual = Aquarium::Finders::MethodFinder.new.find :object => emt, :methods => :all, :exclude_methods => [:method1, :method2], :method_options => :exclude_ancestor_methods
|
714
714
|
actual.matched.size.should == 1
|
715
715
|
actual.matched[emt].size.should == 1
|
716
716
|
actual.matched[emt].should == Set.new([:method3])
|
@@ -719,7 +719,7 @@ describe Aquarium::Finders::MethodFinder, "#find for objects (using :exclude_met
|
|
719
719
|
|
720
720
|
it "should remove excluded methods from the result where the excluded methods are specified by regular expression." do
|
721
721
|
emt = ExcludeMethodTester.new
|
722
|
-
actual = Aquarium::Finders::MethodFinder.new.find :object => emt, :methods => :all, :exclude_methods => /meth.*1$/, :
|
722
|
+
actual = Aquarium::Finders::MethodFinder.new.find :object => emt, :methods => :all, :exclude_methods => /meth.*1$/, :method_options => :exclude_ancestor_methods
|
723
723
|
actual.matched.size.should == 1
|
724
724
|
actual.matched[emt].size.should == 2
|
725
725
|
actual.matched[emt].should == Set.new([:method2, :method3])
|
@@ -728,7 +728,7 @@ describe Aquarium::Finders::MethodFinder, "#find for objects (using :exclude_met
|
|
728
728
|
|
729
729
|
it "should support :exclude_method as a synonym." do
|
730
730
|
emt = ExcludeMethodTester.new
|
731
|
-
actual = Aquarium::Finders::MethodFinder.new.find :object => emt, :methods => :all, :exclude_method => :method1, :
|
731
|
+
actual = Aquarium::Finders::MethodFinder.new.find :object => emt, :methods => :all, :exclude_method => :method1, :method_options => :exclude_ancestor_methods
|
732
732
|
actual.matched.size.should == 1
|
733
733
|
actual.matched[emt].size.should == 2
|
734
734
|
actual.matched[emt].should == Set.new([:method2, :method3])
|
@@ -736,19 +736,19 @@ describe Aquarium::Finders::MethodFinder, "#find for objects (using :exclude_met
|
|
736
736
|
end
|
737
737
|
|
738
738
|
it "should not add the excluded methods to the #not_matched results." do
|
739
|
-
actual = Aquarium::Finders::MethodFinder.new.find :object => ExcludeMethodTester.new, :methods => :all, :exclude_methods => /meth.*1$/, :
|
739
|
+
actual = Aquarium::Finders::MethodFinder.new.find :object => ExcludeMethodTester.new, :methods => :all, :exclude_methods => /meth.*1$/, :method_options => :exclude_ancestor_methods
|
740
740
|
actual.not_matched.size.should == 0
|
741
741
|
end
|
742
742
|
end
|
743
743
|
|
744
744
|
|
745
|
-
describe Aquarium::Finders::MethodFinder, "#find (using :
|
745
|
+
describe Aquarium::Finders::MethodFinder, "#find (using :method_options => :exclude_ancestor_methods)" do
|
746
746
|
before(:each) do
|
747
747
|
before_method_finder_spec
|
748
748
|
end
|
749
749
|
|
750
750
|
it "should suppress ancestor methods for classes when :exclude_ancestor_methods is specified." do
|
751
|
-
actual = Aquarium::Finders::MethodFinder.new.find :types => @test_classes, :methods => /test_method/, :
|
751
|
+
actual = Aquarium::Finders::MethodFinder.new.find :types => @test_classes, :methods => /test_method/, :method_options => [:public, :instance, :exclude_ancestor_methods]
|
752
752
|
actual.matched.size.should == 1
|
753
753
|
actual.matched[ClassWithPublicInstanceMethod].should == Set.new([:public_instance_test_method])
|
754
754
|
actual.not_matched.size.should == 4
|
@@ -758,7 +758,7 @@ describe Aquarium::Finders::MethodFinder, "#find (using :options => :exclude_anc
|
|
758
758
|
actual.not_matched[ClassWithPrivateClassMethod].should == Set.new([/test_method/])
|
759
759
|
end
|
760
760
|
it "should suppress ancestor methods for objects when :exclude_ancestor_methods is specified." do
|
761
|
-
actual = Aquarium::Finders::MethodFinder.new.find :objects => @test_objects, :methods => /test_method/, :
|
761
|
+
actual = Aquarium::Finders::MethodFinder.new.find :objects => @test_objects, :methods => /test_method/, :method_options => [:public, :instance, :exclude_ancestor_methods]
|
762
762
|
actual.matched.size.should == 1
|
763
763
|
actual.matched[@pub].should == Set.new([:public_instance_test_method])
|
764
764
|
actual.not_matched.size.should == 4
|
@@ -769,13 +769,13 @@ describe Aquarium::Finders::MethodFinder, "#find (using :options => :exclude_anc
|
|
769
769
|
end
|
770
770
|
|
771
771
|
it "should suppress ancestor methods for modules when :exclude_ancestor_methods is specified." do
|
772
|
-
actual = Aquarium::Finders::MethodFinder.new.find :type => M2, :methods => /^mmodule/, :
|
772
|
+
actual = Aquarium::Finders::MethodFinder.new.find :type => M2, :methods => /^mmodule/, :method_options => [:instance, :exclude_ancestor_methods]
|
773
773
|
actual.matched.size.should == 1
|
774
774
|
actual.matched[M2].should == Set.new([:mmodule3, :mmodule4])
|
775
775
|
actual.not_matched.size.should == 0
|
776
776
|
end
|
777
777
|
it "should suppress ancestor methods for classes including modules when :exclude_ancestor_methods is specified." do
|
778
|
-
actual = Aquarium::Finders::MethodFinder.new.find :types => [Derived, Derived2], :methods => /^mmodule/, :
|
778
|
+
actual = Aquarium::Finders::MethodFinder.new.find :types => [Derived, Derived2], :methods => /^mmodule/, :method_options => [:instance, :exclude_ancestor_methods]
|
779
779
|
actual.matched.size.should == 2
|
780
780
|
actual.matched[Derived].should == Set.new([:mmodule2b])
|
781
781
|
actual.matched[Derived2].should == Set.new([:mmodule2b, :mmodule4b])
|
@@ -784,7 +784,7 @@ describe Aquarium::Finders::MethodFinder, "#find (using :options => :exclude_anc
|
|
784
784
|
it "should suppress ancestor methods for instances of classes including modules when :exclude_ancestor_methods is specified." do
|
785
785
|
child = Derived.new
|
786
786
|
child2 = Derived2.new
|
787
|
-
actual = Aquarium::Finders::MethodFinder.new.find :types => [child, child2], :methods => /^mmodule/, :
|
787
|
+
actual = Aquarium::Finders::MethodFinder.new.find :types => [child, child2], :methods => /^mmodule/, :method_options => [:instance, :exclude_ancestor_methods]
|
788
788
|
actual.matched.size.should == 2
|
789
789
|
actual.matched[child].should == Set.new([:mmodule2b])
|
790
790
|
actual.matched[child2].should == Set.new([:mmodule2b, :mmodule4b])
|
@@ -792,13 +792,13 @@ describe Aquarium::Finders::MethodFinder, "#find (using :options => :exclude_anc
|
|
792
792
|
end
|
793
793
|
end
|
794
794
|
|
795
|
-
describe Aquarium::Finders::MethodFinder, "#find (using :
|
795
|
+
describe Aquarium::Finders::MethodFinder, "#find (using :method_options => [:public, :instance])" do
|
796
796
|
before(:each) do
|
797
797
|
before_method_finder_spec
|
798
798
|
end
|
799
799
|
|
800
800
|
it "should find only public instance methods for types when :public, and :instance are specified." do
|
801
|
-
actual = Aquarium::Finders::MethodFinder.new.find :types => @test_classes, :methods => /test_method/, :
|
801
|
+
actual = Aquarium::Finders::MethodFinder.new.find :types => @test_classes, :methods => /test_method/, :method_options => [:public, :instance, :exclude_ancestor_methods]
|
802
802
|
actual.matched.size.should == 1
|
803
803
|
actual.matched[ClassWithPublicInstanceMethod].should == Set.new([:public_instance_test_method])
|
804
804
|
actual.not_matched.size.should == 4
|
@@ -809,7 +809,7 @@ describe Aquarium::Finders::MethodFinder, "#find (using :options => [:public, :i
|
|
809
809
|
end
|
810
810
|
|
811
811
|
it "should find only public instance methods for objects when :public, and :instance are specified." do
|
812
|
-
actual = Aquarium::Finders::MethodFinder.new.find :objects => @test_objects, :methods => /test_method/, :
|
812
|
+
actual = Aquarium::Finders::MethodFinder.new.find :objects => @test_objects, :methods => /test_method/, :method_options => [:public, :instance, :exclude_ancestor_methods]
|
813
813
|
actual.matched.size.should == 1
|
814
814
|
actual.matched[@pub].should == Set.new([:public_instance_test_method])
|
815
815
|
actual.not_matched.size.should == 4
|
@@ -820,13 +820,13 @@ describe Aquarium::Finders::MethodFinder, "#find (using :options => [:public, :i
|
|
820
820
|
end
|
821
821
|
end
|
822
822
|
|
823
|
-
describe Aquarium::Finders::MethodFinder, "#find (using :
|
823
|
+
describe Aquarium::Finders::MethodFinder, "#find (using :method_options => [:protected, :instance])" do
|
824
824
|
before(:each) do
|
825
825
|
before_method_finder_spec
|
826
826
|
end
|
827
827
|
|
828
828
|
it "should find only protected instance methods when :protected, and :instance are specified." do
|
829
|
-
actual = Aquarium::Finders::MethodFinder.new.find :types => @test_classes, :methods => /test_method/, :
|
829
|
+
actual = Aquarium::Finders::MethodFinder.new.find :types => @test_classes, :methods => /test_method/, :method_options => [:protected, :instance, :exclude_ancestor_methods]
|
830
830
|
actual.matched.size.should == 1
|
831
831
|
actual.matched[ClassWithProtectedInstanceMethod].should == Set.new([:protected_instance_test_method])
|
832
832
|
actual.not_matched.size.should == 4
|
@@ -837,7 +837,7 @@ describe Aquarium::Finders::MethodFinder, "#find (using :options => [:protected,
|
|
837
837
|
end
|
838
838
|
|
839
839
|
it "should find only protected instance methods for objects when :protected, and :instance are specified." do
|
840
|
-
actual = Aquarium::Finders::MethodFinder.new.find :objects => @test_objects, :methods => /test_method/, :
|
840
|
+
actual = Aquarium::Finders::MethodFinder.new.find :objects => @test_objects, :methods => /test_method/, :method_options => [:protected, :instance, :exclude_ancestor_methods]
|
841
841
|
actual.matched.size.should == 1
|
842
842
|
actual.matched[@pro].should == Set.new([:protected_instance_test_method])
|
843
843
|
actual.not_matched.size.should == 4
|
@@ -848,13 +848,13 @@ describe Aquarium::Finders::MethodFinder, "#find (using :options => [:protected,
|
|
848
848
|
end
|
849
849
|
end
|
850
850
|
|
851
|
-
describe Aquarium::Finders::MethodFinder, "#find (using :
|
851
|
+
describe Aquarium::Finders::MethodFinder, "#find (using :method_options => [:private, :instance])" do
|
852
852
|
before(:each) do
|
853
853
|
before_method_finder_spec
|
854
854
|
end
|
855
855
|
|
856
856
|
it "should find only private instance methods when :private, and :instance are specified." do
|
857
|
-
actual = Aquarium::Finders::MethodFinder.new.find :types => @test_classes, :methods => /test_method/, :
|
857
|
+
actual = Aquarium::Finders::MethodFinder.new.find :types => @test_classes, :methods => /test_method/, :method_options => [:private, :instance, :exclude_ancestor_methods]
|
858
858
|
actual.matched.size.should == 1
|
859
859
|
actual.matched[ClassWithPrivateInstanceMethod].should == Set.new([:private_instance_test_method])
|
860
860
|
actual.not_matched.size.should == 4
|
@@ -865,7 +865,7 @@ describe Aquarium::Finders::MethodFinder, "#find (using :options => [:private, :
|
|
865
865
|
end
|
866
866
|
|
867
867
|
it "should find only private instance methods for objects when :private, and :instance are specified." do
|
868
|
-
actual = Aquarium::Finders::MethodFinder.new.find :objects => @test_objects, :methods => /test_method/, :
|
868
|
+
actual = Aquarium::Finders::MethodFinder.new.find :objects => @test_objects, :methods => /test_method/, :method_options => [:private, :instance, :exclude_ancestor_methods]
|
869
869
|
actual.matched.size.should == 1
|
870
870
|
actual.matched[@pri].should == Set.new([:private_instance_test_method])
|
871
871
|
actual.not_matched.size.should == 4
|
@@ -876,13 +876,13 @@ describe Aquarium::Finders::MethodFinder, "#find (using :options => [:private, :
|
|
876
876
|
end
|
877
877
|
end
|
878
878
|
|
879
|
-
describe Aquarium::Finders::MethodFinder, "#find (using :
|
879
|
+
describe Aquarium::Finders::MethodFinder, "#find (using :method_options => [:public, :class])" do
|
880
880
|
before(:each) do
|
881
881
|
before_method_finder_spec
|
882
882
|
end
|
883
883
|
|
884
884
|
it "should find only public class methods for types when :public, and :class are specified." do
|
885
|
-
actual = Aquarium::Finders::MethodFinder.new.find :types => @test_classes, :methods => /test_method/, :
|
885
|
+
actual = Aquarium::Finders::MethodFinder.new.find :types => @test_classes, :methods => /test_method/, :method_options => [:public, :class, :exclude_ancestor_methods]
|
886
886
|
actual.matched.size.should == 1
|
887
887
|
actual.matched[ClassWithPublicClassMethod].should == Set.new([:public_class_test_method])
|
888
888
|
actual.not_matched.size.should == 4
|
@@ -893,7 +893,7 @@ describe Aquarium::Finders::MethodFinder, "#find (using :options => [:public, :c
|
|
893
893
|
end
|
894
894
|
|
895
895
|
it "should find no public class methods for objects when :public, and :class are specified." do
|
896
|
-
actual = Aquarium::Finders::MethodFinder.new.find :objects => @test_objects, :methods => /test_method/, :
|
896
|
+
actual = Aquarium::Finders::MethodFinder.new.find :objects => @test_objects, :methods => /test_method/, :method_options => [:public, :class, :exclude_ancestor_methods]
|
897
897
|
actual.matched.size.should == 0
|
898
898
|
actual.not_matched.size.should == 5
|
899
899
|
actual.not_matched[@pub].should == Set.new([/test_method/])
|
@@ -904,13 +904,13 @@ describe Aquarium::Finders::MethodFinder, "#find (using :options => [:public, :c
|
|
904
904
|
end
|
905
905
|
end
|
906
906
|
|
907
|
-
describe Aquarium::Finders::MethodFinder, "#find (using :
|
907
|
+
describe Aquarium::Finders::MethodFinder, "#find (using :method_options => [:private, :class])" do
|
908
908
|
before(:each) do
|
909
909
|
before_method_finder_spec
|
910
910
|
end
|
911
911
|
|
912
912
|
it "should find only private class methods for types when :private, and :class are specified." do
|
913
|
-
actual = Aquarium::Finders::MethodFinder.new.find :types => @test_classes, :methods => /test_method/, :
|
913
|
+
actual = Aquarium::Finders::MethodFinder.new.find :types => @test_classes, :methods => /test_method/, :method_options => [:private, :class, :exclude_ancestor_methods]
|
914
914
|
actual.matched.size.should == 1
|
915
915
|
actual.matched[ClassWithPrivateClassMethod].should == Set.new([:private_class_test_method])
|
916
916
|
actual.not_matched.size.should == 4
|
@@ -921,7 +921,7 @@ describe Aquarium::Finders::MethodFinder, "#find (using :options => [:private, :
|
|
921
921
|
end
|
922
922
|
|
923
923
|
it "should find no private class methods for objects when :private, and :class are specified." do
|
924
|
-
actual = Aquarium::Finders::MethodFinder.new.find :objects => @test_objects, :methods => /test_method/, :
|
924
|
+
actual = Aquarium::Finders::MethodFinder.new.find :objects => @test_objects, :methods => /test_method/, :method_options => [:private, :class, :exclude_ancestor_methods]
|
925
925
|
actual.matched.size.should == 0
|
926
926
|
actual.not_matched.size.should == 5
|
927
927
|
actual.not_matched[@pub].should == Set.new([/test_method/])
|
@@ -932,13 +932,13 @@ describe Aquarium::Finders::MethodFinder, "#find (using :options => [:private, :
|
|
932
932
|
end
|
933
933
|
end
|
934
934
|
|
935
|
-
describe Aquarium::Finders::MethodFinder, "#find (using :
|
935
|
+
describe Aquarium::Finders::MethodFinder, "#find (using :method_options => [:public, :protected, :instance])" do
|
936
936
|
before(:each) do
|
937
937
|
before_method_finder_spec
|
938
938
|
end
|
939
939
|
|
940
940
|
it "should find public and protected instance methods for types when :public, :protected, and :instance are specified." do
|
941
|
-
actual = Aquarium::Finders::MethodFinder.new.find :types => @test_classes, :methods => /test_method/, :
|
941
|
+
actual = Aquarium::Finders::MethodFinder.new.find :types => @test_classes, :methods => /test_method/, :method_options => [:public, :protected, :instance, :exclude_ancestor_methods]
|
942
942
|
actual.matched.size.should == 2
|
943
943
|
actual.matched[ClassWithPublicInstanceMethod].should == Set.new([:public_instance_test_method])
|
944
944
|
actual.matched[ClassWithProtectedInstanceMethod].should == Set.new([:protected_instance_test_method])
|
@@ -949,7 +949,7 @@ describe Aquarium::Finders::MethodFinder, "#find (using :options => [:public, :p
|
|
949
949
|
end
|
950
950
|
|
951
951
|
it "should find public and protected instance methods for objects when :public, :protected, and :instance are specified." do
|
952
|
-
actual = Aquarium::Finders::MethodFinder.new.find :objects => @test_objects, :methods => /test_method/, :
|
952
|
+
actual = Aquarium::Finders::MethodFinder.new.find :objects => @test_objects, :methods => /test_method/, :method_options => [:public, :protected, :instance, :exclude_ancestor_methods]
|
953
953
|
actual.matched.size.should == 2
|
954
954
|
actual.matched[@pub].should == Set.new([:public_instance_test_method])
|
955
955
|
actual.matched[@pro].should == Set.new([:protected_instance_test_method])
|
@@ -960,13 +960,13 @@ describe Aquarium::Finders::MethodFinder, "#find (using :options => [:public, :p
|
|
960
960
|
end
|
961
961
|
end
|
962
962
|
|
963
|
-
describe Aquarium::Finders::MethodFinder, "#find (using :
|
963
|
+
describe Aquarium::Finders::MethodFinder, "#find (using :method_options => [:public, :;private, :instance])" do
|
964
964
|
before(:each) do
|
965
965
|
before_method_finder_spec
|
966
966
|
end
|
967
967
|
|
968
968
|
it "should find public and private instance methods when :public, :private, and :instance are specified." do
|
969
|
-
actual = Aquarium::Finders::MethodFinder.new.find :types => @test_classes, :methods => /test_method/, :
|
969
|
+
actual = Aquarium::Finders::MethodFinder.new.find :types => @test_classes, :methods => /test_method/, :method_options => [:public, :private, :instance, :exclude_ancestor_methods]
|
970
970
|
actual.matched.size.should == 2
|
971
971
|
actual.matched[ClassWithPublicInstanceMethod].should == Set.new([:public_instance_test_method])
|
972
972
|
actual.matched[ClassWithPrivateInstanceMethod].should == Set.new([:private_instance_test_method])
|
@@ -977,7 +977,7 @@ describe Aquarium::Finders::MethodFinder, "#find (using :options => [:public, :;
|
|
977
977
|
end
|
978
978
|
|
979
979
|
it "should find public and private instance methods for objects when :public, :private, and :instance are specified." do
|
980
|
-
actual = Aquarium::Finders::MethodFinder.new.find :objects => @test_objects, :methods => /test_method/, :
|
980
|
+
actual = Aquarium::Finders::MethodFinder.new.find :objects => @test_objects, :methods => /test_method/, :method_options => [:public, :private, :instance, :exclude_ancestor_methods]
|
981
981
|
actual.matched.size.should == 2
|
982
982
|
actual.matched[@pub].should == Set.new([:public_instance_test_method])
|
983
983
|
actual.matched[@pri].should == Set.new([:private_instance_test_method])
|
@@ -988,13 +988,13 @@ describe Aquarium::Finders::MethodFinder, "#find (using :options => [:public, :;
|
|
988
988
|
end
|
989
989
|
end
|
990
990
|
|
991
|
-
describe Aquarium::Finders::MethodFinder, "#find (using :
|
991
|
+
describe Aquarium::Finders::MethodFinder, "#find (using :method_options => [:protected, :private, :instance])" do
|
992
992
|
before(:each) do
|
993
993
|
before_method_finder_spec
|
994
994
|
end
|
995
995
|
|
996
996
|
it "should find protected and private instance methods when :protected, :private, and :instance are specified." do
|
997
|
-
actual = Aquarium::Finders::MethodFinder.new.find :types => @test_classes, :methods => /test_method/, :
|
997
|
+
actual = Aquarium::Finders::MethodFinder.new.find :types => @test_classes, :methods => /test_method/, :method_options => [:protected, :private, :instance, :exclude_ancestor_methods]
|
998
998
|
actual.matched.size.should == 2
|
999
999
|
actual.matched[ClassWithProtectedInstanceMethod].should == Set.new([:protected_instance_test_method])
|
1000
1000
|
actual.matched[ClassWithPrivateInstanceMethod].should == Set.new([:private_instance_test_method])
|
@@ -1005,7 +1005,7 @@ describe Aquarium::Finders::MethodFinder, "#find (using :options => [:protected,
|
|
1005
1005
|
end
|
1006
1006
|
|
1007
1007
|
it "should find protected and private instance methods for objects when :protected, :private, and :instance are specified." do
|
1008
|
-
actual = Aquarium::Finders::MethodFinder.new.find :objects => @test_objects, :methods => /test_method/, :
|
1008
|
+
actual = Aquarium::Finders::MethodFinder.new.find :objects => @test_objects, :methods => /test_method/, :method_options => [:protected, :private, :instance, :exclude_ancestor_methods]
|
1009
1009
|
actual.matched.size.should == 2
|
1010
1010
|
actual.matched[@pro].should == Set.new([:protected_instance_test_method])
|
1011
1011
|
actual.matched[@pri].should == Set.new([:private_instance_test_method])
|
@@ -1016,13 +1016,13 @@ describe Aquarium::Finders::MethodFinder, "#find (using :options => [:protected,
|
|
1016
1016
|
end
|
1017
1017
|
end
|
1018
1018
|
|
1019
|
-
describe Aquarium::Finders::MethodFinder, "#find (using :
|
1019
|
+
describe Aquarium::Finders::MethodFinder, "#find (using :method_options => [:public, :class, :instance])" do
|
1020
1020
|
before(:each) do
|
1021
1021
|
before_method_finder_spec
|
1022
1022
|
end
|
1023
1023
|
|
1024
1024
|
it "should find public class and instance methods for types when :public, :class, and :instance are specified." do
|
1025
|
-
actual = Aquarium::Finders::MethodFinder.new.find :types => @test_classes, :methods => /test_method/, :
|
1025
|
+
actual = Aquarium::Finders::MethodFinder.new.find :types => @test_classes, :methods => /test_method/, :method_options => [:public, :class, :instance, :exclude_ancestor_methods]
|
1026
1026
|
actual.matched.size.should == 2
|
1027
1027
|
actual.matched[ClassWithPublicInstanceMethod].should == Set.new([:public_instance_test_method])
|
1028
1028
|
actual.matched[ClassWithPublicClassMethod].should == Set.new([:public_class_test_method])
|
@@ -1033,7 +1033,7 @@ describe Aquarium::Finders::MethodFinder, "#find (using :options => [:public, :c
|
|
1033
1033
|
end
|
1034
1034
|
|
1035
1035
|
it "should find only public instance methods for objects even when :class is specified along with :public and :instance." do
|
1036
|
-
actual = Aquarium::Finders::MethodFinder.new.find :objects => @test_objects, :methods => /test_method/, :
|
1036
|
+
actual = Aquarium::Finders::MethodFinder.new.find :objects => @test_objects, :methods => /test_method/, :method_options => [:public, :class, :instance, :exclude_ancestor_methods]
|
1037
1037
|
actual.matched.size.should == 1
|
1038
1038
|
actual.matched[@pub].should == Set.new([:public_instance_test_method])
|
1039
1039
|
actual.not_matched.size.should == 4
|
@@ -1044,13 +1044,13 @@ describe Aquarium::Finders::MethodFinder, "#find (using :options => [:public, :c
|
|
1044
1044
|
end
|
1045
1045
|
end
|
1046
1046
|
|
1047
|
-
describe Aquarium::Finders::MethodFinder, "#find (using :
|
1047
|
+
describe Aquarium::Finders::MethodFinder, "#find (using :method_options => [:public, :protected, :class, :instance])" do
|
1048
1048
|
before(:each) do
|
1049
1049
|
before_method_finder_spec
|
1050
1050
|
end
|
1051
1051
|
|
1052
1052
|
it "should find public and protected instance methods when :public, :protected, :class, and :instance are specified." do
|
1053
|
-
actual = Aquarium::Finders::MethodFinder.new.find :types => @test_classes, :methods => /test_method/, :
|
1053
|
+
actual = Aquarium::Finders::MethodFinder.new.find :types => @test_classes, :methods => /test_method/, :method_options => [:public, :protected, :class, :instance, :exclude_ancestor_methods]
|
1054
1054
|
actual.matched.size.should == 3
|
1055
1055
|
actual.matched[ClassWithPublicInstanceMethod].should == Set.new([:public_instance_test_method])
|
1056
1056
|
actual.matched[ClassWithPublicClassMethod].should == Set.new([:public_class_test_method])
|
@@ -1061,7 +1061,7 @@ describe Aquarium::Finders::MethodFinder, "#find (using :options => [:public, :p
|
|
1061
1061
|
end
|
1062
1062
|
|
1063
1063
|
it "should find only public and protected instance methods for objects even when :class is specified along with :public, :protected, :class, and :instance." do
|
1064
|
-
actual = Aquarium::Finders::MethodFinder.new.find :objects => @test_objects, :methods => /test_method/, :
|
1064
|
+
actual = Aquarium::Finders::MethodFinder.new.find :objects => @test_objects, :methods => /test_method/, :method_options => [:public, :protected, :class, :instance, :exclude_ancestor_methods]
|
1065
1065
|
actual.matched.size.should == 2
|
1066
1066
|
actual.matched[@pub].should == Set.new([:public_instance_test_method])
|
1067
1067
|
actual.matched[@pro].should == Set.new([:protected_instance_test_method])
|
@@ -1093,7 +1093,7 @@ describe "Aquarium::Finders::MethodFinder#find (looking for singleton methods)"
|
|
1093
1093
|
end
|
1094
1094
|
|
1095
1095
|
it "should find instance-level singleton methods for objects when :singleton is specified." do
|
1096
|
-
actual = Aquarium::Finders::MethodFinder.new.find :objects => [@notQuiteEmpty, @objectWithSingletonMethod], :methods => :all, :
|
1096
|
+
actual = Aquarium::Finders::MethodFinder.new.find :objects => [@notQuiteEmpty, @objectWithSingletonMethod], :methods => :all, :method_options => [:singleton]
|
1097
1097
|
actual.matched.size.should == 1
|
1098
1098
|
actual.matched[@objectWithSingletonMethod].should == Set.new([:a_singleton_method])
|
1099
1099
|
actual.not_matched.size.should == 1
|
@@ -1101,7 +1101,7 @@ describe "Aquarium::Finders::MethodFinder#find (looking for singleton methods)"
|
|
1101
1101
|
end
|
1102
1102
|
|
1103
1103
|
it "should find type-level singleton methods for types when :singleton is specified." do
|
1104
|
-
actual = Aquarium::Finders::MethodFinder.new.find :types => [NotQuiteEmpty, Empty], :methods => :all, :
|
1104
|
+
actual = Aquarium::Finders::MethodFinder.new.find :types => [NotQuiteEmpty, Empty], :methods => :all, :method_options => [:singleton, :exclude_ancestor_methods]
|
1105
1105
|
actual.matched.size.should == 1
|
1106
1106
|
actual.matched[NotQuiteEmpty].should == Set.new([:a_class_singleton_method])
|
1107
1107
|
actual.not_matched.size.should == 1
|