module-cluster 1.4.8 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. data/README.md +127 -337
  2. data/lib/module-cluster.rb +1 -153
  3. data/lib/module/cluster.rb +341 -0
  4. data/lib/module/cluster/class_support.rb +22 -0
  5. data/lib/module/cluster/cluster.rb +10 -0
  6. data/lib/module/cluster/cluster/cluster_interface.rb +550 -0
  7. data/lib/module/cluster/exception/module_not_in_stack.rb +26 -0
  8. data/lib/module/cluster/instance_controller.rb +14 -0
  9. data/lib/module/cluster/instance_controller/hook_controller.rb +33 -0
  10. data/lib/module/cluster/instance_controller/hook_controller/chain_proxy.rb +511 -0
  11. data/lib/module/cluster/instance_controller/hook_controller/hook_controller_interface.rb +830 -0
  12. data/lib/module/cluster/instance_controller/instance_controller_interface.rb +269 -0
  13. data/lib/module/cluster/instance_controller/multiple_hook_controller_proxy.rb +359 -0
  14. data/lib/module/cluster/instance_controller/multiple_hook_controller_proxy/chain_proxy.rb +442 -0
  15. data/lib/module/cluster/module_support.rb +67 -0
  16. data/lib/module/namespaces.rb +13 -0
  17. data/lib/module/requires.rb +32 -0
  18. data/spec/module/cluster/cluster_spec.rb +473 -0
  19. data/spec/module/cluster/instance_controller/hook_controller_spec.rb +922 -0
  20. data/spec/module/cluster/instance_controller/multiple_hook_controller_proxy_spec.rb +1240 -0
  21. data/spec/module/cluster_spec.rb +1794 -0
  22. metadata +27 -98
  23. data/README.rdoc +0 -395
  24. data/lib/module-cluster/ModuleCluster.rb +0 -9
  25. data/lib/module-cluster/ModuleCluster/Define.rb +0 -12
  26. data/lib/module-cluster/ModuleCluster/Define/Block.rb +0 -9
  27. data/lib/module-cluster/ModuleCluster/Define/Block/CascadingClass.rb +0 -83
  28. data/lib/module-cluster/ModuleCluster/Define/Block/CascadingClassOrModule.rb +0 -70
  29. data/lib/module-cluster/ModuleCluster/Define/Block/CascadingModule.rb +0 -79
  30. data/lib/module-cluster/ModuleCluster/Define/Block/CascadingModuleOrSubclass.rb +0 -21
  31. data/lib/module-cluster/ModuleCluster/Define/Block/Class.rb +0 -77
  32. data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrInstance.rb +0 -78
  33. data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrModule.rb +0 -78
  34. data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrModuleOrInstance.rb +0 -78
  35. data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrModuleOrSubclass.rb +0 -36
  36. data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrSubclass.rb +0 -29
  37. data/lib/module-cluster/ModuleCluster/Define/Block/Instance.rb +0 -45
  38. data/lib/module-cluster/ModuleCluster/Define/Block/Module.rb +0 -77
  39. data/lib/module-cluster/ModuleCluster/Define/Block/ModuleOrInstance.rb +0 -78
  40. data/lib/module-cluster/ModuleCluster/Define/Block/ModuleOrSubclass.rb +0 -29
  41. data/lib/module-cluster/ModuleCluster/Define/Block/Subclass.rb +0 -56
  42. data/lib/module-cluster/ModuleCluster/Define/ClassCluster.rb +0 -193
  43. data/lib/module-cluster/ModuleCluster/Define/ClassOrInstanceCluster.rb +0 -128
  44. data/lib/module-cluster/ModuleCluster/Define/Cluster.rb +0 -181
  45. data/lib/module-cluster/ModuleCluster/Define/ClusterCascades.rb +0 -185
  46. data/lib/module-cluster/ModuleCluster/Define/ClusterCascadesToClass.rb +0 -181
  47. data/lib/module-cluster/ModuleCluster/Define/ClusterCascadesToModule.rb +0 -181
  48. data/lib/module-cluster/ModuleCluster/Define/Deprecated.rb +0 -40
  49. data/lib/module-cluster/ModuleCluster/Define/InstanceCluster.rb +0 -45
  50. data/lib/module-cluster/ModuleCluster/Define/ModuleCluster.rb +0 -193
  51. data/lib/module-cluster/ModuleCluster/Define/ModuleOrClassCluster.rb +0 -209
  52. data/lib/module-cluster/ModuleCluster/Define/ModuleOrInstanceCluster.rb +0 -128
  53. data/lib/module-cluster/ModuleCluster/Define/Status.rb +0 -106
  54. data/lib/module-cluster/ModuleCluster/Suspend.rb +0 -7
  55. data/lib/module-cluster/ModuleCluster/Suspend/Hooks.rb +0 -315
  56. data/lib/module-cluster/ModuleCluster/Suspend/WithoutHooks.rb +0 -153
  57. data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures.rb +0 -77
  58. data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures/ClusterStack.rb +0 -44
  59. data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures/PerformCascades.rb +0 -292
  60. data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures/Subclass.rb +0 -24
  61. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack.rb +0 -12
  62. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block.rb +0 -9
  63. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Class.rb +0 -36
  64. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Inherited.rb +0 -20
  65. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Instance.rb +0 -20
  66. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Module.rb +0 -36
  67. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Set.rb +0 -6
  68. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Extends.rb +0 -140
  69. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Includes.rb +0 -110
  70. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/PrependsExtends.rb +0 -140
  71. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/PrependsIncludes.rb +0 -110
  72. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Set.rb +0 -35
  73. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Set/MultiSetProxy.rb +0 -359
  74. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Status.rb +0 -55
  75. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Suspend.rb +0 -199
  76. data/lib/module-cluster/_private_/ModuleCluster/ExtendForCascade.rb +0 -34
  77. data/spec/ModuleCluster/Define/Block/CascadingClassOrModule_spec.rb +0 -285
  78. data/spec/ModuleCluster/Define/Block/CascadingClass_spec.rb +0 -254
  79. data/spec/ModuleCluster/Define/Block/CascadingModuleOrSubclass_spec.rb +0 -56
  80. data/spec/ModuleCluster/Define/Block/CascadingModule_spec.rb +0 -278
  81. data/spec/ModuleCluster/Define/Block/ClassOrInstance_spec.rb +0 -230
  82. data/spec/ModuleCluster/Define/Block/ClassOrModuleOrInstance_spec.rb +0 -238
  83. data/spec/ModuleCluster/Define/Block/ClassOrModuleOrSubclass_spec.rb +0 -54
  84. data/spec/ModuleCluster/Define/Block/ClassOrModule_spec.rb +0 -231
  85. data/spec/ModuleCluster/Define/Block/ClassOrSubclass_spec.rb +0 -54
  86. data/spec/ModuleCluster/Define/Block/Class_spec.rb +0 -224
  87. data/spec/ModuleCluster/Define/Block/Instance_spec.rb +0 -78
  88. data/spec/ModuleCluster/Define/Block/ModuleOrInstance_spec.rb +0 -54
  89. data/spec/ModuleCluster/Define/Block/ModuleOrSubclass_spec.rb +0 -51
  90. data/spec/ModuleCluster/Define/Block/Module_spec.rb +0 -230
  91. data/spec/ModuleCluster/Define/Block/Subclass_spec.rb +0 -73
  92. data/spec/ModuleCluster/Define/Block_spec.rb +0 -18
  93. data/spec/ModuleCluster/Define/ClassCluster_spec.rb +0 -728
  94. data/spec/ModuleCluster/Define/ClassOrInstanceCluster_spec.rb +0 -576
  95. data/spec/ModuleCluster/Define/ClusterCascadesToClass_spec.rb +0 -659
  96. data/spec/ModuleCluster/Define/ClusterCascadesToModule_spec.rb +0 -678
  97. data/spec/ModuleCluster/Define/ClusterCascades_spec.rb +0 -644
  98. data/spec/ModuleCluster/Define/Cluster_spec.rb +0 -708
  99. data/spec/ModuleCluster/Define/InstanceCluster_spec.rb +0 -102
  100. data/spec/ModuleCluster/Define/ModuleCluster_spec.rb +0 -728
  101. data/spec/ModuleCluster/Define/ModuleOrClassCluster_spec.rb +0 -728
  102. data/spec/ModuleCluster/Define/ModuleOrInstanceCluster_spec.rb +0 -576
  103. data/spec/ModuleCluster/Suspend/Hooks_spec.rb +0 -573
  104. data/spec/ModuleCluster/Suspend/WithoutHooks_spec.rb +0 -559
  105. data/spec/ModuleCluster_spec.rb +0 -15
  106. data/spec/_private_/ModuleCluster/CascadeFeatures/PerformCascades_spec.rb +0 -386
  107. data/spec/_private_/ModuleCluster/ClusterStack/Set/MultiSetProxy_spec.rb +0 -419
  108. data/spec/_private_/ModuleCluster/ClusterStack/Suspend_spec.rb +0 -242
@@ -1,15 +0,0 @@
1
- require_relative '../lib/module-cluster.rb'
2
-
3
- describe ::ModuleCluster do
4
-
5
- it 'clusters other modules' do
6
- module ::ModuleCluster
7
- is_a?( Define::Cluster )
8
- is_a?( Define::ClusterCascades )
9
- is_a?( Define::ClusterCascadesToClass )
10
- is_a?( Define::ClusterCascadesToModule )
11
- is_a?( Define::Deprecated )
12
- end
13
- end
14
-
15
- end
@@ -1,386 +0,0 @@
1
-
2
- require_relative '../../../../lib/module-cluster.rb'
3
-
4
- describe ::ModuleCluster::CascadeFeatures::PerformCascades do
5
-
6
- ##########################################
7
- # collect_block_runtime_result_modules #
8
- ##########################################
9
-
10
- it 'can run a block and return any modules that were returned by the block' do
11
- # condition is a ::ModuleCluster-extended module
12
- module ::ModuleCluster::CascadeFeatures::PerformCascades::MockCascadeModule01
13
- end
14
- # a module to be included/extended at hook time
15
- module ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule01
16
- end
17
- # another module includes the first module and invokes the runtime hook
18
- module ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleIncludingMockCascadeModule01
19
- end
20
- # we need a mock instance to use our methods
21
- module ::ModuleCluster::CascadeFeatures::PerformCascades::Mock01
22
- extend ::ModuleCluster::CascadeFeatures::PerformCascades
23
- end
24
- module_self = ::ModuleCluster::CascadeFeatures::PerformCascades::MockCascadeModule01
25
- hooked_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleIncludingMockCascadeModule01
26
- block_ran = false
27
- runtime_includes_block = Proc.new { block_ran = true ; ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule01 }
28
- set = ::ModuleCluster::ClusterStack::Set.new( module_self, :declaration_method, :all, :include, nil, runtime_includes_block )
29
- result_modules = ::ModuleCluster::CascadeFeatures::PerformCascades::Mock01.collect_block_runtime_result_modules( module_self,
30
- hooked_instance,
31
- set )
32
- block_ran.should == true
33
- result_modules.should == [ ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule01 ]
34
- end
35
-
36
- ########################################
37
- # should_include_or_extend_instance? #
38
- ########################################
39
-
40
- it 'can report whether an instance should be included or extended based on a descriptor symbol' do
41
- module ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02
42
- extend ::ModuleCluster::CascadeFeatures::PerformCascades
43
- end
44
- module ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleInstance02
45
- end
46
- class ::ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02
47
- end
48
-
49
- module_class_instance_or_all = :all
50
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleInstance02
51
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
52
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02
53
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
54
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02.new
55
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
56
- module_class_instance_or_all = :module_class_or_instance
57
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleInstance02
58
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
59
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02
60
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
61
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02.new
62
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
63
- module_class_instance_or_all = :module_class_and_instance
64
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleInstance02
65
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
66
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02
67
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
68
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02.new
69
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
70
- module_class_instance_or_all = :module_class_instance
71
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleInstance02
72
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
73
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02
74
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
75
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02.new
76
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
77
- module_class_instance_or_all = :module_or_class
78
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleInstance02
79
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
80
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02
81
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
82
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02.new
83
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == false
84
- module_class_instance_or_all = :module_and_class
85
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleInstance02
86
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
87
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02
88
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
89
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02.new
90
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == false
91
- module_class_instance_or_all = :module_class
92
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleInstance02
93
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
94
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02
95
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
96
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02.new
97
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == false
98
- module_class_instance_or_all = :module_or_instance
99
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleInstance02
100
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
101
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02
102
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == false
103
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02.new
104
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
105
- module_class_instance_or_all = :module_and_instance
106
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleInstance02
107
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
108
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02
109
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == false
110
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02.new
111
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
112
- module_class_instance_or_all = :module_instance
113
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleInstance02
114
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
115
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02
116
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == false
117
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02.new
118
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
119
- module_class_instance_or_all = :class_or_instance
120
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleInstance02
121
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == false
122
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02
123
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
124
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02.new
125
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
126
- module_class_instance_or_all = :class_and_instance
127
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleInstance02
128
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == false
129
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02
130
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
131
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02.new
132
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
133
- module_class_instance_or_all = :class_instance
134
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleInstance02
135
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == false
136
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02
137
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
138
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02.new
139
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
140
- module_class_instance_or_all = :module
141
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleInstance02
142
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
143
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02
144
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == false
145
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02.new
146
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == false
147
- module_class_instance_or_all = :class
148
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleInstance02
149
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == false
150
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02
151
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
152
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02.new
153
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == false
154
- module_class_instance_or_all = :instance
155
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleInstance02
156
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == false
157
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02
158
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == false
159
- into_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockClassInstance02.new
160
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock02.should_include_or_extend_instance?( module_class_instance_or_all, into_instance ).should == true
161
- end
162
-
163
- #######################################
164
- # include_or_extend_hooked_instance #
165
- #######################################
166
-
167
- it 'can include or extend the hooked instance as appropriate' do
168
- # condition is a ::ModuleCluster-extended module
169
- module ::ModuleCluster::CascadeFeatures::PerformCascades::MockCascadeModule03
170
- end
171
- # a module to be included/extended at hook time
172
- module ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule03
173
- end
174
- # another module includes the first module and invokes the runtime hook
175
- module ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleIncludingMockCascadeModule03A
176
- end
177
- module ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleIncludingMockCascadeModule03B
178
- end
179
- module ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleIncludingMockCascadeModule03C
180
- end
181
- # we need a mock instance to use our methods
182
- module ::ModuleCluster::CascadeFeatures::PerformCascades::Mock03
183
- extend ::ModuleCluster::CascadeFeatures::PerformCascades
184
- end
185
- module_self = ::ModuleCluster::CascadeFeatures::PerformCascades::MockCascadeModule03
186
- set = ::ModuleCluster::ClusterStack::Set.new( module_self, :declaration_method, :all, :include, [ ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule03 ] )
187
-
188
- # include
189
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock03.include_or_extend_hooked_instance( ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleIncludingMockCascadeModule03A,
190
- set,
191
- true,
192
- false,
193
- set.modules )
194
- ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleIncludingMockCascadeModule03A.ancestors.include?( ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule03 ).should == true
195
- eigenclass = class << ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleIncludingMockCascadeModule03A ; self ; end
196
- eigenclass.ancestors.include?( ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule03 ).should == false
197
- # extend
198
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock03.include_or_extend_hooked_instance( ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleIncludingMockCascadeModule03B,
199
- set,
200
- false,
201
- true,
202
- set.modules )
203
- ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleIncludingMockCascadeModule03B.ancestors.include?( ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule03 ).should == false
204
- eigenclass = class << ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleIncludingMockCascadeModule03B ; self ; end
205
- eigenclass.ancestors.include?( ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule03 ).should == true
206
- # include and extend
207
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock03.include_or_extend_hooked_instance( ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleIncludingMockCascadeModule03C,
208
- set,
209
- true,
210
- true,
211
- set.modules )
212
- ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleIncludingMockCascadeModule03C.ancestors.include?( ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule03 ).should == true
213
- eigenclass = class << ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleIncludingMockCascadeModule03C ; self ; end
214
- eigenclass.ancestors.include?( ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule03 ).should == true
215
-
216
- end
217
-
218
- ##########################################
219
- # cascade_modules_into_hooked_instance #
220
- ##########################################
221
-
222
- it 'can cascade modules into the hooked instance as appropriate' do
223
- # condition is a ::ModuleCluster-extended module
224
- module ::ModuleCluster::CascadeFeatures::PerformCascades::MockCascadeModule04
225
- def declaration_method( modules )
226
- @declaration_method_called = true
227
- end
228
- def called_declaration_method
229
- return @declaration_method_called
230
- end
231
- end
232
- # a module to be included/extended at hook time
233
- module ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule04A
234
- end
235
- module ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule04B
236
- end
237
- # another module includes the first module and invokes the runtime hook
238
- module ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleIncludingMockCascadeModule04
239
- end
240
- # we need a mock instance to use our methods
241
- module ::ModuleCluster::CascadeFeatures::PerformCascades::Mock04
242
- extend ::ModuleCluster::CascadeFeatures::PerformCascades
243
- end
244
- module_self = ::ModuleCluster::CascadeFeatures::PerformCascades::MockCascadeModule04
245
- hooked_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleIncludingMockCascadeModule04
246
- block_ran = false
247
- runtime_includes_block = Proc.new { block_ran = true ; ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule04B }
248
- set = ::ModuleCluster::ClusterStack::Set.new( module_self, :declaration_method, :all, :include, [ ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule04A ], runtime_includes_block )
249
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock04.cascade_modules_into_hooked_instance( module_self, hooked_instance, set, set.modules )
250
- # hooked instance should be extended with dependency module (module_self) and :declaration_method should be called on it
251
- hooked_instance_eigenclass = class << hooked_instance ; self ; end
252
- hooked_instance_eigenclass.ancestors.include?( ::ModuleCluster::CascadeFeatures::PerformCascades::MockCascadeModule04 ).should == true
253
- hooked_instance.called_declaration_method.should == true
254
- end
255
-
256
- ############################
257
- # include_extend_modules #
258
- ############################
259
-
260
- it 'can perform include and/or extend of specified modules into instance' do
261
- # condition is a ::ModuleCluster-extended module
262
- module ::ModuleCluster::CascadeFeatures::PerformCascades::MockCascadeModule05
263
- end
264
- # a module to be included/extended at hook time
265
- module ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule05
266
- end
267
- # another module includes the first module and invokes the runtime hook
268
- module ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleIncludingMockCascadeModule05A
269
- end
270
- module ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleIncludingMockCascadeModule05B
271
- end
272
- module ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleIncludingMockCascadeModule05C
273
- end
274
- # we need a mock instance to use our methods
275
- module ::ModuleCluster::CascadeFeatures::PerformCascades::Mock05
276
- extend ::ModuleCluster::CascadeFeatures::PerformCascades
277
- end
278
- module_self = ::ModuleCluster::CascadeFeatures::PerformCascades::MockCascadeModule05
279
-
280
- # include
281
- set = ::ModuleCluster::ClusterStack::Set.new( module_self, :declaration_method, :all, :include, [ ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule05 ] )
282
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock05.include_extend_modules( ::ModuleCluster::CascadeFeatures::PerformCascades::MockCascadeModule05,
283
- ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleIncludingMockCascadeModule05A,
284
- set,
285
- set.modules )
286
- ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleIncludingMockCascadeModule05A.ancestors.include?( ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule05 ).should == true
287
- eigenclass = class << ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleIncludingMockCascadeModule05A ; self ; end
288
- eigenclass.ancestors.include?( ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule05 ).should == false
289
- # extend
290
- set = ::ModuleCluster::ClusterStack::Set.new( module_self, :declaration_method, :all, :extend, [ ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule05 ] )
291
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock05.include_extend_modules( ::ModuleCluster::CascadeFeatures::PerformCascades::MockCascadeModule05,
292
- ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleIncludingMockCascadeModule05B,
293
- set,
294
- set.modules )
295
- ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleIncludingMockCascadeModule05B.ancestors.include?( ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule05 ).should == false
296
- eigenclass = class << ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleIncludingMockCascadeModule05B ; self ; end
297
- eigenclass.ancestors.include?( ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule05 ).should == true
298
- # include and extend
299
- set = ::ModuleCluster::ClusterStack::Set.new( module_self, :declaration_method, :all, :include_and_extend, [ ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule05 ] )
300
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock05.include_extend_modules( ::ModuleCluster::CascadeFeatures::PerformCascades::MockCascadeModule05,
301
- ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleIncludingMockCascadeModule05C,
302
- set,
303
- set.modules )
304
- ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleIncludingMockCascadeModule05C.ancestors.include?( ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule05 ).should == true
305
- eigenclass = class << ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleIncludingMockCascadeModule05C ; self ; end
306
- eigenclass.ancestors.include?( ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule05 ).should == true
307
-
308
- end
309
-
310
- ######################
311
- # perform_cascades #
312
- ######################
313
-
314
- it 'can perform cascade of specified modules into instance' do
315
-
316
- # condition is a ::ModuleCluster-extended module
317
- module ::ModuleCluster::CascadeFeatures::PerformCascades::MockCascadeModule06
318
- def self.should_include_or_extend?( hooked_instance )
319
- return true
320
- end
321
- def self.should_cascade?( hooked_instance )
322
- return true
323
- end
324
- def self.hooks_suspended?( action )
325
- return @hooks_suspended ||= false
326
- end
327
- def self.suspend_hooks
328
- @hooks_suspended = true
329
- end
330
- def self.unsuspend_hooks
331
- @hooks_suspended = false
332
- end
333
- def declaration_method( modules )
334
- @declaration_method_called = true
335
- end
336
- def called_declaration_method
337
- return @declaration_method_called
338
- end
339
- end
340
- # a module to be included/extended at hook time
341
- module ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule06A
342
- end
343
- module ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule06B
344
- end
345
- module ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule06C
346
- end
347
- # another module includes the first module and invokes the runtime hook
348
- module ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleIncludingMockCascadeModule06
349
- end
350
- # we need a mock instance to use our methods
351
- module ::ModuleCluster::CascadeFeatures::PerformCascades::Mock06
352
- extend ::ModuleCluster::CascadeFeatures::PerformCascades
353
- end
354
- module_self = ::ModuleCluster::CascadeFeatures::PerformCascades::MockCascadeModule06
355
- hooked_instance = ::ModuleCluster::CascadeFeatures::PerformCascades::MockModuleIncludingMockCascadeModule06
356
- set_one = ::ModuleCluster::ClusterStack::Set.new( module_self, :declaration_method, :all, :include, [ ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule06A ] )
357
- set_two = ::ModuleCluster::ClusterStack::Set.new( module_self, :declaration_method, :all, :extend, [ ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule06B ] )
358
- set_three = ::ModuleCluster::ClusterStack::Set.new( module_self, :declaration_method, :all, :include_and_extend, [ ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule06C ] )
359
- set_stack = [ set_one, set_two, set_three ]
360
-
361
- # test that suspending works - mocked for true/false
362
- module_self.suspend_hooks
363
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock06.perform_cascades( module_self, :include, hooked_instance, set_stack )
364
- hooked_instance.ancestors.include?( ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule06A ).should == false
365
- hooked_instance.ancestors.include?( ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule06C ).should == false
366
- eigenclass = class << hooked_instance ; self ; end
367
- eigenclass.ancestors.include?( ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule06B ).should == false
368
- eigenclass.ancestors.include?( ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule06C ).should == false
369
- # also our dependency module should be extended
370
- eigenclass.ancestors.include?( module_self ).should == false
371
- module_self.unsuspend_hooks
372
-
373
-
374
- ::ModuleCluster::CascadeFeatures::PerformCascades::Mock06.perform_cascades( module_self, :include, hooked_instance, set_stack )
375
- hooked_instance.ancestors.include?( ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule06A ).should == true
376
- hooked_instance.ancestors.include?( ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule06C ).should == true
377
- eigenclass = class << hooked_instance ; self ; end
378
- eigenclass.ancestors.include?( ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule06B ).should == true
379
- eigenclass.ancestors.include?( ::ModuleCluster::CascadeFeatures::PerformCascades::MockHookedIncludeModule06C ).should == true
380
- # also our dependency module should be extended
381
- eigenclass.ancestors.include?( module_self ).should == true
382
- hooked_instance.called_declaration_method.should == true
383
-
384
- end
385
-
386
- end
@@ -1,419 +0,0 @@
1
-
2
- require_relative '../../../../../lib/module-cluster.rb'
3
-
4
- describe ::ModuleCluster::ClusterStack::Set::MultiSetProxy do
5
-
6
- ###########
7
- # name= #
8
- # name #
9
- ###########
10
-
11
- it 'can set the name of each member set and retrieve the names of each member set' do
12
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock01
13
- end
14
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock02
15
- end
16
- set_one = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :all, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock01 ], nil )
17
- set_two = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :all, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock02 ], nil )
18
- set_one.name = :some_name
19
- set_two.name = :some_other_name
20
- multi_set = ::ModuleCluster::ClusterStack::Set::MultiSetProxy.new( set_one, set_two )
21
- multi_set.name.should == [ :some_name, :some_other_name ]
22
- multi_set.name = :yet_another_other_name
23
- multi_set.name.should == [ :yet_another_other_name, :yet_another_other_name ]
24
- # also make sure it works nested in another MultiSetProxy
25
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock03
26
- end
27
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock04
28
- end
29
- set_three = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :all, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock03 ], nil )
30
- set_four = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :all, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock04 ], nil )
31
- set_three.name = :some_name
32
- set_four.name = :some_other_name
33
- multi_set_two = ::ModuleCluster::ClusterStack::Set::MultiSetProxy.new( set_three, set_four )
34
- multi_multi_set = ::ModuleCluster::ClusterStack::Set::MultiSetProxy.new( multi_set, multi_set_two )
35
- multi_multi_set.name.should == [ :yet_another_other_name, :yet_another_other_name, :some_name, :some_other_name ]
36
- end
37
-
38
- ########################
39
- # dependency_module= #
40
- # dependency_module #
41
- ########################
42
-
43
- it 'can set the dependecy module of each member set and retrieve the dependency module of each member set' do
44
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock01
45
- end
46
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock02
47
- end
48
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::DependencyModuleMock01
49
- end
50
- set_one = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :all, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock01 ], nil )
51
- set_two = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :all, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock02 ], nil )
52
- multi_set = ::ModuleCluster::ClusterStack::Set::MultiSetProxy.new( set_one, set_two )
53
- multi_set.dependency_module.should == [ ::ModuleCluster::Define::Cluster, ::ModuleCluster::Define::Cluster ]
54
- multi_set.dependency_module = ::ModuleCluster::ClusterStack::Set::MultiSetProxy::DependencyModuleMock01
55
- multi_set.dependency_module.should == [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::DependencyModuleMock01, ::ModuleCluster::ClusterStack::Set::MultiSetProxy::DependencyModuleMock01 ]
56
- # also make sure it works nested in another MultiSetProxy
57
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock03
58
- end
59
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock04
60
- end
61
- set_three = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :all, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock03 ], nil )
62
- set_four = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :all, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock04 ], nil )
63
- set_three.name = :some_name
64
- set_four.name = :some_other_name
65
- multi_set_two = ::ModuleCluster::ClusterStack::Set::MultiSetProxy.new( set_three, set_four )
66
- multi_multi_set = ::ModuleCluster::ClusterStack::Set::MultiSetProxy.new( multi_set, multi_set_two )
67
- multi_multi_set.dependency_module.should == [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::DependencyModuleMock01, ::ModuleCluster::ClusterStack::Set::MultiSetProxy::DependencyModuleMock01, ::ModuleCluster::Define::Cluster, ::ModuleCluster::Define::Cluster ]
68
- end
69
-
70
- #############
71
- # method= #
72
- # method #
73
- #############
74
-
75
- it 'can set the method of each member set and retrieve the methods of each member set' do
76
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock01
77
- end
78
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock02
79
- end
80
- set_one = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :all, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock01 ], nil )
81
- set_two = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :all, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock02 ], nil )
82
- multi_set = ::ModuleCluster::ClusterStack::Set::MultiSetProxy.new( set_one, set_two )
83
- multi_set.method.should == [ :include_also_includes, :include_also_includes ]
84
- multi_set.method = :some_other_method
85
- multi_set.method.should == [ :some_other_method, :some_other_method ]
86
- # also make sure it works nested in another MultiSetProxy
87
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock03
88
- end
89
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock04
90
- end
91
- set_three = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :all, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock03 ], nil )
92
- set_four = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :all, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock04 ], nil )
93
- set_three.name = :some_name
94
- set_four.name = :some_other_name
95
- multi_set_two = ::ModuleCluster::ClusterStack::Set::MultiSetProxy.new( set_three, set_four )
96
- multi_multi_set = ::ModuleCluster::ClusterStack::Set::MultiSetProxy.new( multi_set, multi_set_two )
97
- multi_multi_set.method.should == [ :some_other_method, :some_other_method, :include_also_includes, :include_also_includes ]
98
- end
99
-
100
- ###################################
101
- # module_class_instance_or_all= #
102
- # module_class_instance_or_all #
103
- ###################################
104
-
105
- it 'can set the object to which set applies for each member set and retrieve the objects to which sets apply for all member sets' do
106
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock01
107
- end
108
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock02
109
- end
110
- set_one = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :all, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock01 ], nil )
111
- set_two = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :all, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock02 ], nil )
112
- multi_set = ::ModuleCluster::ClusterStack::Set::MultiSetProxy.new( set_one, set_two )
113
- multi_set.module_class_instance_or_all.should == [ :all, :all ]
114
- multi_set.module_class_instance_or_all = :module
115
- multi_set.module_class_instance_or_all.should == [ :module, :module ]
116
- # also make sure it works nested in another MultiSetProxy
117
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock03
118
- end
119
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock04
120
- end
121
- set_three = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :all, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock03 ], nil )
122
- set_four = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :all, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock04 ], nil )
123
- set_three.name = :some_name
124
- set_four.name = :some_other_name
125
- multi_set_two = ::ModuleCluster::ClusterStack::Set::MultiSetProxy.new( set_three, set_four )
126
- multi_multi_set = ::ModuleCluster::ClusterStack::Set::MultiSetProxy.new( multi_set, multi_set_two )
127
- multi_multi_set.module_class_instance_or_all.should == [ :module, :module, :all, :all ]
128
- end
129
-
130
- ########################
131
- # include_or_extend= #
132
- # include_or_extend #
133
- ########################
134
-
135
- it 'can set whether set should be used to include, extend, or both and retrieve whether member sets are to be included, extended, or both' do
136
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock01
137
- end
138
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock02
139
- end
140
- set_one = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :all, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock01 ], nil )
141
- set_two = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :all, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock02 ], nil )
142
- multi_set = ::ModuleCluster::ClusterStack::Set::MultiSetProxy.new( set_one, set_two )
143
- multi_set.include_or_extend.should == [ :include_also_includes, :include_also_includes ]
144
- multi_set.include_or_extend = :module
145
- multi_set.include_or_extend.should == [ :module, :module ]
146
- # also make sure it works nested in another MultiSetProxy
147
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock03
148
- end
149
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock04
150
- end
151
- set_three = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :all, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock03 ], nil )
152
- set_four = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :all, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock04 ], nil )
153
- set_three.name = :some_name
154
- set_four.name = :some_other_name
155
- multi_set_two = ::ModuleCluster::ClusterStack::Set::MultiSetProxy.new( set_three, set_four )
156
- multi_multi_set = ::ModuleCluster::ClusterStack::Set::MultiSetProxy.new( multi_set, multi_set_two )
157
- multi_multi_set.include_or_extend.should == [ :module, :module, :include_also_includes, :include_also_includes ]
158
- end
159
-
160
- ##############
161
- # modules= #
162
- # modules #
163
- ##############
164
-
165
- it 'can set the modules of each member set and retrieve the modules of each member set' do
166
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock01
167
- end
168
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock02
169
- end
170
- set_one = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :all, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock01 ], nil )
171
- set_two = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :all, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock02 ], nil )
172
- multi_set = ::ModuleCluster::ClusterStack::Set::MultiSetProxy.new( set_one, set_two )
173
- multi_set.modules.should == [ [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock01 ], [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock02 ] ]
174
- multi_set.modules = [ Module ]
175
- multi_set.modules.should == [ [ Module ], [ Module ] ]
176
- # also make sure it works nested in another MultiSetProxy
177
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock03
178
- end
179
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock04
180
- end
181
- set_three = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :all, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock03 ], nil )
182
- set_four = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :all, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock04 ], nil )
183
- set_three.name = :some_name
184
- set_four.name = :some_other_name
185
- multi_set_two = ::ModuleCluster::ClusterStack::Set::MultiSetProxy.new( set_three, set_four )
186
- multi_multi_set = ::ModuleCluster::ClusterStack::Set::MultiSetProxy.new( multi_set, multi_set_two )
187
- multi_multi_set.modules.should == [ [ Module ], [ Module ], [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock03 ], [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock04 ] ]
188
- set_five = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :all, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock03 ], nil )
189
- multi_multi_set_two = ::ModuleCluster::ClusterStack::Set::MultiSetProxy.new( multi_multi_set, set_five )
190
- multi_multi_set_two.modules.should == [ [ Module ], [ Module ], [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock03 ], [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock04 ], [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock03 ] ]
191
- end
192
-
193
- ########################################
194
- # runtime_includes_or_extends_block= #
195
- # runtime_includes_or_extends_block #
196
- ########################################
197
-
198
- it 'can set the block for runtime determination of modules for each member set and retrieve the block from each member set' do
199
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock01
200
- end
201
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock02
202
- end
203
- runtime_block = Proc.new { Module }
204
- set_one = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :all, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock01 ], runtime_block )
205
- set_two = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :all, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock02 ], runtime_block )
206
- multi_set = ::ModuleCluster::ClusterStack::Set::MultiSetProxy.new( set_one, set_two )
207
- multi_set.runtime_includes_or_extends_block.should == [ runtime_block, runtime_block ]
208
- other_block = Proc.new { Kernel }
209
- multi_set.runtime_includes_or_extends_block = other_block
210
- multi_set.runtime_includes_or_extends_block.should == [ other_block, other_block ]
211
- # also make sure it works nested in another MultiSetProxy
212
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock03
213
- end
214
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock04
215
- end
216
- set_three = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :all, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock03 ], runtime_block )
217
- set_four = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :all, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock04 ], runtime_block )
218
- set_three.name = :some_name
219
- set_four.name = :some_other_name
220
- multi_set_two = ::ModuleCluster::ClusterStack::Set::MultiSetProxy.new( set_three, set_four )
221
- multi_multi_set = ::ModuleCluster::ClusterStack::Set::MultiSetProxy.new( multi_set, multi_set_two )
222
- multi_multi_set.runtime_includes_or_extends_block.should == [ other_block, other_block, runtime_block, runtime_block ]
223
- end
224
-
225
- ################
226
- # suspended= #
227
- # suspended #
228
- # suspend #
229
- # suspended? #
230
- # resume #
231
- ################
232
-
233
- it 'can suspend and resume each member set and retrieve whether member sets are suspended' do
234
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock01
235
- end
236
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock02
237
- end
238
- set_one = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :all, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock01 ], nil )
239
- set_two = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :all, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock02 ], nil )
240
- multi_set = ::ModuleCluster::ClusterStack::Set::MultiSetProxy.new( set_one, set_two )
241
- multi_set.suspended.should == [ false, false ]
242
- multi_set.suspended?.should == [ false, false ]
243
- multi_set.suspended = true
244
- multi_set.suspended.should == [ true, true ]
245
- multi_set.resume
246
- multi_set.suspended.should == [ false, false ]
247
- multi_set.suspend
248
- multi_set.suspended.should == [ true, true ]
249
- # also make sure it works nested in another MultiSetProxy
250
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock03
251
- end
252
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock04
253
- end
254
- set_three = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :all, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock03 ], nil )
255
- set_four = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :all, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock04 ], nil )
256
- set_three.name = :some_name
257
- set_four.name = :some_other_name
258
- multi_set_two = ::ModuleCluster::ClusterStack::Set::MultiSetProxy.new( set_three, set_four )
259
- multi_set_two.suspended.should == [ false, false ]
260
- multi_multi_set = ::ModuleCluster::ClusterStack::Set::MultiSetProxy.new( multi_set, multi_set_two )
261
- multi_multi_set.suspended?.should == [ true, true, false, false ]
262
- end
263
-
264
- ################
265
- # hooks_with #
266
- ################
267
-
268
- it 'can return hooks in the set matching the description' do
269
-
270
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock01
271
- end
272
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock02
273
- end
274
- block_one = Proc.new do
275
- puts 'nothing'
276
- end
277
- block_two = Proc.new do
278
- puts 'more nothing'
279
- end
280
- set_one = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :all, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock01 ], block_one )
281
- set_two = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :instance, :extend, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock02 ], block_two )
282
- set_one.name = :name_one
283
- set_two.name = :name_two_and_three
284
- multi_set = ::ModuleCluster::ClusterStack::Set::MultiSetProxy.new( set_one, set_two )
285
- multi_set.suspended.should == [ false, false ]
286
- multi_set.suspended?.should == [ false, false ]
287
- multi_set.suspended = true
288
- multi_set.suspended.should == [ true, true ]
289
- multi_set.resume
290
- multi_set.suspended.should == [ false, false ]
291
- multi_set.suspend
292
- multi_set.suspended.should == [ true, true ]
293
- # also make sure it works nested in another MultiSetProxy
294
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock03
295
- end
296
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock04
297
- end
298
- block_four = Proc.new do
299
- puts 'another nothing'
300
- end
301
- set_three = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :class, :include_and_extend, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock03 ], nil )
302
- set_four = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :module, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock04 ], block_four )
303
- set_three.name = :name_two_and_three
304
- set_four.name = :name_four
305
- multi_set_two = ::ModuleCluster::ClusterStack::Set::MultiSetProxy.new( set_three, set_four )
306
- multi_set_two.suspended.should == [ false, false ]
307
- multi_multi_set = ::ModuleCluster::ClusterStack::Set::MultiSetProxy.new( multi_set, multi_set_two )
308
-
309
- # dependency_module
310
- multi_set.hooks_with( :dependency_module => ::ModuleCluster::Define::Cluster ).should == [ set_one, set_two ]
311
- multi_set_two.hooks_with( :dependency_module => ::ModuleCluster::Define::Cluster ).should == [ set_three, set_four ]
312
- multi_multi_set.hooks_with( :dependency_module => ::ModuleCluster::Define::Cluster ).should == [ set_one, set_two, set_three, set_four ]
313
-
314
- # method
315
- multi_set.hooks_with( :method => :include_also_includes ).should == [ set_one, set_two ]
316
- multi_set_two.hooks_with( :method => :include_also_includes ).should == [ set_three, set_four ]
317
- multi_multi_set.hooks_with( :method => :include_also_includes ).should == [ set_one, set_two, set_three, set_four ]
318
-
319
- # module_class_instance_or_all
320
- multi_set.hooks_with( :module_class_instance_or_all => :all ).should == [ set_one ]
321
- multi_set.hooks_with( :module_class_instance_or_all => :instance ).should == [ set_one, set_two ]
322
- multi_set_two.hooks_with( :module_class_instance_or_all => :class ).should == [ set_three ]
323
- multi_multi_set.hooks_with( :module_class_instance_or_all => :module ).should == [ set_one, set_four ]
324
-
325
- # include_or_extend
326
- multi_set.hooks_with( :include_or_extend => :include ).should == [ set_one ]
327
- multi_set.hooks_with( :include_or_extend => :extend ).should == [ set_two ]
328
- multi_set_two.hooks_with( :include_or_extend => :include ).should == [ set_three, set_four ]
329
- multi_multi_set.hooks_with( :include_or_extend => :extend ).should == [ set_two, set_three ]
330
- multi_multi_set.hooks_with( :include_or_extend => :include ).should == [ set_one, set_three, set_four ]
331
-
332
- # modules
333
- multi_set.hooks_with( :modules => ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock01 ).should == [ set_one ]
334
- multi_set.hooks_with( :modules => [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock02 ] ).should == [ set_two ]
335
- multi_set_two.hooks_with( :modules => [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock03 ] ).should == [ set_three ]
336
- multi_multi_set.hooks_with( :modules => ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock01 ).should == [ set_one ]
337
- multi_multi_set.hooks_with( :modules => [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock04 ] ).should == [ set_four ]
338
-
339
- # runtime_includes_or_extends_block
340
- multi_set.hooks_with( :runtime_includes_or_extends_block => block_one ).should == [ set_one ]
341
- multi_set.hooks_with( :runtime_includes_or_extends_block => block_two ).should == [ set_two ]
342
- multi_set_two.hooks_with( :runtime_includes_or_extends_block => block_four ).should == [ set_four ]
343
- multi_set_two.hooks_with( :runtime_includes_or_extends_block => nil ).should == [ set_three ]
344
- multi_multi_set.hooks_with( :runtime_includes_or_extends_block => block_four ).should == [ set_four ]
345
- multi_multi_set.hooks_with( :runtime_includes_or_extends_block => block_one ).should == [ set_one ]
346
- multi_multi_set.hooks_with( :runtime_includes_or_extends_block => nil ).should == [ set_three ]
347
-
348
- # suspended
349
- multi_set.hooks_with( :suspended => false ).should == [ ]
350
- multi_set.hooks_with( :suspended => true ).should == [ set_one, set_two ]
351
- multi_set_two.hooks_with( :suspended => false ).should == [ set_three, set_four ]
352
- multi_multi_set.hooks_with( :suspended => true ).should == [ set_one, set_two ]
353
- multi_multi_set.hooks_with( :suspended => false ).should == [ set_three, set_four ]
354
-
355
- # name
356
- multi_set.hooks_with( :name => :name_one ).should == [ set_one ]
357
- multi_set.hooks_with( :name => :name_two_and_three ).should == [ set_two ]
358
- multi_set_two.hooks_with( :name => :name_two_and_three ).should == [ set_three ]
359
- multi_multi_set.hooks_with( :name => :name_two_and_three ).should == [ set_two, set_three ]
360
- multi_multi_set.hooks_with( :name => :name_four ).should == [ set_four ]
361
-
362
- # we've ensured individual descriptions work, now we just need to make sure the logic loops
363
- # since each works individually, if the loop works then any loop should work
364
- #
365
- # name x include_or_extend
366
- multi_set.hooks_with( :name => :name_one,
367
- :include_or_extend => :extend ).should == [ ]
368
- multi_set.hooks_with( :name => :name_two_and_three,
369
- :include_or_extend => :extend ).should == [ set_two ]
370
- multi_set_two.hooks_with( :name => :name_two_and_three,
371
- :include_or_extend => :include ).should == [ set_three ]
372
- multi_multi_set.hooks_with( :name => :name_two_and_three,
373
- :include_or_extend => :include ).should == [ set_three ]
374
- multi_multi_set.hooks_with( :name => :name_four,
375
- :include_or_extend => :include ).should == [ set_four ]
376
-
377
- end
378
-
379
- ###########
380
- # hooks #
381
- ###########
382
-
383
- it 'can return a hook or set of hooks in set matching name' do
384
-
385
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock01
386
- end
387
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock02
388
- end
389
- set_one = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :all, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock01 ], nil )
390
- set_two = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :all, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock02 ], nil )
391
- set_one.name = :some_name
392
- set_two.name = :some_other_name
393
- multi_set = ::ModuleCluster::ClusterStack::Set::MultiSetProxy.new( set_one, set_two )
394
- multi_set.name.should == [ :some_name, :some_other_name ]
395
- multi_set.name = :yet_another_other_name
396
- multi_set.name.should == [ :yet_another_other_name, :yet_another_other_name ]
397
- # also make sure it works nested in another MultiSetProxy
398
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock03
399
- end
400
- module ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock04
401
- end
402
- set_three = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :all, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock03 ], nil )
403
- set_four = ::ModuleCluster::ClusterStack::Set.new( ::ModuleCluster::Define::Cluster, :include_also_includes, :all, :include, [ ::ModuleCluster::ClusterStack::Set::MultiSetProxy::Mock04 ], nil )
404
- set_three.name = :some_name
405
- set_four.name = :some_other_name
406
- multi_set_two = ::ModuleCluster::ClusterStack::Set::MultiSetProxy.new( set_three, set_four )
407
- multi_multi_set = ::ModuleCluster::ClusterStack::Set::MultiSetProxy.new( multi_set, multi_set_two )
408
- multi_multi_set.name.should == [ :yet_another_other_name, :yet_another_other_name, :some_name, :some_other_name ]
409
-
410
- multi_set.hooks( :yet_another_other_name ).should == [ set_one, set_two ]
411
- multi_set_two.hooks( :some_name ).should == [ set_three ]
412
- multi_set_two.hooks( :some_other_name ).should == [ set_four ]
413
- multi_multi_set.hooks( :yet_another_other_name ).should == [ set_one, set_two ]
414
- multi_multi_set.hooks( :some_name ).should == [ set_three ]
415
- multi_multi_set.hooks( :some_other_name ).should == [ set_four ]
416
-
417
- end
418
-
419
- end