From e9be46dc4bed301b8bfa09ffac439e08dddcff82 Mon Sep 17 00:00:00 2001 From: michail Date: Thu, 1 Jun 2023 08:52:45 +0300 Subject: [PATCH] Fix specs for missing SortedSet --- aquarium/lib/aquarium/finders/pointcut_finder.rb | 2 ++ aquarium/lib/aquarium/utils/type_utils.rb | 2 ++ aquarium/spec/aquarium/aspects/aspect_invocation_spec.rb | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/aquarium/lib/aquarium/finders/pointcut_finder.rb b/aquarium/lib/aquarium/finders/pointcut_finder.rb index 7415fbb..4cb9739 100644 --- a/aquarium/lib/aquarium/finders/pointcut_finder.rb +++ b/aquarium/lib/aquarium/finders/pointcut_finder.rb @@ -111,6 +111,8 @@ def find_constant_pointcuts types, names = :all con = t.const_get c pointcuts.append_matched({t => con}) if con.kind_of?(Aquarium::Aspects::Pointcut) end + rescue + next end end pointcuts diff --git a/aquarium/lib/aquarium/utils/type_utils.rb b/aquarium/lib/aquarium/utils/type_utils.rb index 24a9821..04ddc46 100644 --- a/aquarium/lib/aquarium/utils/type_utils.rb +++ b/aquarium/lib/aquarium/utils/type_utils.rb @@ -20,6 +20,8 @@ def self.descendents clazz result << mod if mod.ancestors.include?(clazz) do_descendents clazz, mod, visited, result end + rescue + next end result.uniq end diff --git a/aquarium/spec/aquarium/aspects/aspect_invocation_spec.rb b/aquarium/spec/aquarium/aspects/aspect_invocation_spec.rb index 3c386f5..348b8fb 100644 --- a/aquarium/spec/aquarium/aspects/aspect_invocation_spec.rb +++ b/aquarium/spec/aquarium/aspects/aspect_invocation_spec.rb @@ -205,14 +205,14 @@ def public_test_method *args; @args=args; end [:type, :type_and_descendents, :type_and_ancestors, :type_and_nested_types].each do |type_key| it "should ignore the :default_objects if at least one :#{type_key} is given and the :default_objects are objects." do object = Aquarium::AspectInvocationTestClass.new - aspect = Aspect.new(:after, :default_objects => object, type_key => Aquarium::AspectInvocationTestClass2, :method => :public_test_method, :method => :public_test_method) {true} + aspect = Aspect.new(:after, :default_objects => object, type_key => Aquarium::AspectInvocationTestClass2, :method => :public_test_method) {true} aspect.join_points_matched.size.should == 1 aspect.join_points_matched.each {|jp| jp.type_or_object.should_not == object} aspect.unadvise end it "should ignore the :default_objects if at least one :#{type_key} is given and the :default_objects are types." do - aspect = Aspect.new(:after, :default_objects => Aquarium::AspectInvocationTestClass, type_key => Aquarium::AspectInvocationTestClass2, :method => :public_test_method, :method => :public_test_method) {true} + aspect = Aspect.new(:after, :default_objects => Aquarium::AspectInvocationTestClass, type_key => Aquarium::AspectInvocationTestClass2, :method => :public_test_method) {true} aspect.join_points_matched.size.should == 1 aspect.join_points_matched.each {|jp| jp.type_or_object.should_not == Aquarium::AspectInvocationTestClass} aspect.unadvise