aquarium 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +50 -0
- data/README +35 -6
- data/RELEASE-PLAN +8 -5
- data/Rakefile +17 -1
- data/UPGRADE +5 -0
- data/lib/aquarium/aspects/advice.rb +6 -6
- data/lib/aquarium/aspects/aspect.rb +11 -17
- data/lib/aquarium/aspects/join_point.rb +5 -5
- data/lib/aquarium/aspects/pointcut.rb +68 -40
- data/lib/aquarium/finders/method_finder.rb +1 -0
- data/lib/aquarium/finders/type_finder.rb +12 -8
- data/lib/aquarium/utils/default_logger.rb +1 -0
- data/lib/aquarium/utils/method_utils.rb +4 -4
- data/lib/aquarium/utils/name_utils.rb +3 -3
- data/lib/aquarium/utils/type_utils.rb +25 -10
- data/lib/aquarium/version.rb +2 -2
- data/spec/aquarium/aspects/advice_spec.rb +13 -1
- data/spec/aquarium/aspects/aspect_spec.rb +63 -44
- data/spec/aquarium/aspects/join_point_spec.rb +1 -1
- data/spec/aquarium/aspects/pointcut_spec.rb +22 -10
- data/spec/aquarium/finders/method_finder_spec.rb +3 -2
- data/spec/aquarium/finders/type_finder_spec.rb +2 -2
- data/spec/aquarium/finders/type_finder_with_descendents_and_ancestors_spec.rb +8 -8
- data/spec/aquarium/utils/method_utils_spec.rb +17 -6
- data/spec/aquarium/utils/type_utils_spec.rb +45 -23
- metadata +3 -3
@@ -2,62 +2,84 @@ require File.dirname(__FILE__) + '/../spec_helper'
|
|
2
2
|
require 'aquarium/utils/type_utils'
|
3
3
|
require File.dirname(__FILE__) + '/../utils/type_utils_sample_classes'
|
4
4
|
|
5
|
-
|
5
|
+
include Aquarium::Utils
|
6
|
+
|
7
|
+
describe TypeUtils, ".is_type?" do
|
6
8
|
it "should be true for a class" do
|
7
|
-
|
9
|
+
TypeUtils.is_type?(String).should be_true
|
8
10
|
end
|
9
11
|
|
10
12
|
it "should be true for a Module" do
|
11
|
-
|
13
|
+
TypeUtils.is_type?(Kernel).should be_true
|
12
14
|
end
|
13
15
|
|
14
16
|
it "should be false for an Object" do
|
15
|
-
|
17
|
+
TypeUtils.is_type?("Object").should be_false
|
16
18
|
end
|
17
19
|
end
|
18
20
|
|
19
21
|
# We don't compare the sizes, because RSpec will add some classes that we don't care about...
|
20
22
|
def check_descendent_array clazz, expected
|
21
|
-
actual =
|
23
|
+
actual = TypeUtils.descendents(clazz)
|
22
24
|
expected.each {|c| actual.should include(c)}
|
23
25
|
end
|
24
26
|
|
25
|
-
describe
|
27
|
+
describe TypeUtils, ".descendents called with a class" do
|
26
28
|
it "should return the class itself in the result" do
|
27
|
-
|
29
|
+
TypeUtils.descendents(BaseForDescendents).should include(BaseForDescendents)
|
28
30
|
end
|
29
31
|
|
30
32
|
it "should return just the class if it has no descendents" do
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
33
|
+
TypeUtils.descendents(D11ForDescendents).should eql([D11ForDescendents])
|
34
|
+
TypeUtils.descendents(D2ForDescendents).should eql([D2ForDescendents])
|
35
|
+
TypeUtils.descendents(Aquarium::ForDescendents::NestedD11ForDescendents).should eql([Aquarium::ForDescendents::NestedD11ForDescendents])
|
36
|
+
TypeUtils.descendents(Aquarium::ForDescendents::NestedD2ForDescendents).should eql([Aquarium::ForDescendents::NestedD2ForDescendents])
|
37
|
+
TypeUtils.descendents(Aquarium::ForDescendents::NestedD3ForDescendents).should eql([Aquarium::ForDescendents::NestedD3ForDescendents])
|
38
|
+
TypeUtils.descendents(Aquarium::ForDescendents::NestedD4ForDescendents).should eql([Aquarium::ForDescendents::NestedD4ForDescendents])
|
39
|
+
TypeUtils.descendents(Aquarium::ForDescendents::NestedD31ForDescendents).should eql([Aquarium::ForDescendents::NestedD31ForDescendents])
|
38
40
|
end
|
39
41
|
|
40
42
|
it "should return all classes and their descendents that derive from a class" do
|
41
|
-
|
42
|
-
check_descendent_array t,
|
43
|
+
TypeUtils.sample_classes.each do |t|
|
44
|
+
check_descendent_array t, TypeUtils.sample_classes_descendents[t]
|
43
45
|
end
|
44
46
|
end
|
45
47
|
end
|
46
48
|
|
47
|
-
describe
|
49
|
+
describe TypeUtils, ".descendents called with a module" do
|
48
50
|
it "should return the module itself in the result" do
|
49
|
-
|
50
|
-
|
51
|
+
TypeUtils.descendents(ModuleForDescendents).should include(ModuleForDescendents)
|
52
|
+
TypeUtils.descendents(Aquarium::ForDescendents::NestedModuleForDescendents).should include(Aquarium::ForDescendents::NestedModuleForDescendents)
|
51
53
|
end
|
52
54
|
|
53
55
|
it "should return all classes and their descendents that include a module" do
|
54
|
-
|
55
|
-
check_descendent_array t,
|
56
|
+
TypeUtils.sample_modules.each do |t|
|
57
|
+
check_descendent_array t, TypeUtils.sample_modules_descendents[t]
|
56
58
|
end
|
57
59
|
end
|
58
60
|
|
59
61
|
it "should return all modules that include a module" do
|
60
|
-
|
61
|
-
|
62
|
+
TypeUtils.descendents(ModuleForDescendents).should include(ModuleForDescendents)
|
63
|
+
TypeUtils.descendents(ModuleForDescendents).should include(Aquarium::ForDescendents::Nested2ModuleForDescendents)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
module FakeJRubyWrapperModule
|
68
|
+
%w[ancestors constants const_get].each do |method_name|
|
69
|
+
module_eval(<<-EOF, __FILE__, __LINE__)
|
70
|
+
def self.__#{method_name}__(*args)
|
71
|
+
self.#{method_name}(*args)
|
72
|
+
end
|
73
|
+
EOF
|
74
|
+
end
|
75
|
+
end
|
76
|
+
class FakeJRubyWrapperClass
|
77
|
+
include FakeJRubyWrapperModule
|
78
|
+
end
|
79
|
+
|
80
|
+
# See the separate JRuby spec suite for exhaustive tests of JRuby support. This example really exists solely to ensure 100% coverage.
|
81
|
+
describe TypeUtils, ".descendents applied to JRuby-wrapped Java classes" do
|
82
|
+
it "should properly determine descendents" do
|
83
|
+
TypeUtils.descendents(FakeJRubyWrapperModule).should include(FakeJRubyWrapperClass)
|
62
84
|
end
|
63
85
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aquarium
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aquarium Development Team
|
@@ -9,7 +9,7 @@ autorequire: aquarium
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-02-25 00:00:00 -06:00
|
13
13
|
default_executable: ""
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -153,6 +153,6 @@ rubyforge_project: aquarium
|
|
153
153
|
rubygems_version: 1.0.1
|
154
154
|
signing_key:
|
155
155
|
specification_version: 2
|
156
|
-
summary: Aquarium-0.
|
156
|
+
summary: Aquarium-0.4.0 (r7) - Aspect-Oriented Programming toolkit for Ruby http://aquarium.rubyforge.org
|
157
157
|
test_files: []
|
158
158
|
|