cascading_classes 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +165 -64
- data/spec/basics/basic_spec.rb +71 -76
- data/spec/basics/block_spec.rb +10 -10
- data/spec/basics/container_spec.rb +90 -90
- data/spec/basics/inherit_spec.rb +156 -156
- data/spec/basics/proc_spec.rb +94 -94
- data/spec/class_helper_methods/parents_for_spec.rb +5 -5
- data/spec/custom_classes/hash_like_spec.rb +11 -11
- data/spec/helper_spec.rb +11 -11
- data/spec/instances/basics.rb +39 -39
- data/spec/preset_classes/array_spec.rb +39 -39
- data/spec/preset_classes/hash_spec.rb +38 -38
- data/spec/preset_classes/strings.rb +53 -53
- data/spec/preset_classes/undefined.rb +4 -4
- data/spec/usage/block_spec.rb +6 -6
- data/spec/usage/proc_spec.rb +8 -8
- data/todo +21 -0
- metadata +1 -2
- data/README-part-ii.md +0 -1020
data/spec/basics/proc_spec.rb
CHANGED
@@ -36,58 +36,58 @@ describe "proc properties" do
|
|
36
36
|
end
|
37
37
|
|
38
38
|
it "inherits by default" do
|
39
|
-
@props[:weather][:inherit].
|
40
|
-
@props[:mood][:inherit].
|
41
|
-
@props[:color][:inherit].
|
39
|
+
@props[:weather][:inherit].should == true # sanity
|
40
|
+
@props[:mood][:inherit].should == true
|
41
|
+
@props[:color][:inherit].should == true
|
42
42
|
end
|
43
43
|
|
44
44
|
describe "a property of type :Proc" do
|
45
45
|
it "evaluates the proc on each invocation of the property" do
|
46
|
-
A.weather.
|
47
|
-
A.mood.
|
48
|
-
A.color.
|
46
|
+
A.weather.should == :sunny
|
47
|
+
A.mood.should == "content"
|
48
|
+
A.color.should == "rosy"
|
49
49
|
|
50
50
|
A.weather = :rainy
|
51
|
-
A.mood.
|
52
|
-
A.color.
|
51
|
+
A.mood.should == "depressed"
|
52
|
+
A.color.should == "blue"
|
53
53
|
end
|
54
54
|
|
55
55
|
it "has second parameter that is a list of parents" do
|
56
56
|
A.mood = Proc.new{|me, parents| parents}
|
57
57
|
|
58
|
-
A.mood.
|
59
|
-
B.mood.
|
60
|
-
C.mood.
|
58
|
+
A.mood.should == []
|
59
|
+
B.mood.should == [A]
|
60
|
+
C.mood.should == [B, A]
|
61
61
|
|
62
|
-
A.new.mood.
|
63
|
-
B.new.mood.
|
64
|
-
C.new.mood.
|
62
|
+
A.new.mood.should == [A]
|
63
|
+
B.new.mood.should == [B, A]
|
64
|
+
C.new.mood.should == [C, B, A]
|
65
65
|
end
|
66
66
|
|
67
67
|
describe "blank descendents" do
|
68
68
|
it "inherits from its nearest non-blank ancestor" do
|
69
|
-
B.mood_is_blank?.
|
70
|
-
C.mood_is_blank?.
|
69
|
+
B.mood_is_blank?.should == true
|
70
|
+
C.mood_is_blank?.should == true
|
71
71
|
|
72
72
|
A.weather = :sunny
|
73
|
-
B.mood.
|
74
|
-
C.mood.
|
75
|
-
B.color.
|
76
|
-
C.color.
|
73
|
+
B.mood.should == "content"
|
74
|
+
C.mood.should == "content"
|
75
|
+
B.color.should == "rosy"
|
76
|
+
C.color.should == "rosy"
|
77
77
|
|
78
78
|
A.weather = :rainy
|
79
79
|
|
80
|
-
B.mood.
|
81
|
-
C.mood.
|
82
|
-
B.color.
|
83
|
-
C.color.
|
80
|
+
B.mood.should == "depressed"
|
81
|
+
C.mood.should == "depressed"
|
82
|
+
B.color.should == "blue"
|
83
|
+
C.color.should == "blue"
|
84
84
|
end
|
85
85
|
|
86
86
|
it "uses its own proc if not blank" do
|
87
87
|
B.mood = Proc.new{ "angry" }
|
88
88
|
|
89
|
-
B.mood.
|
90
|
-
B.color.
|
89
|
+
B.mood.should == "angry"
|
90
|
+
B.color.should == "blue"
|
91
91
|
end
|
92
92
|
|
93
93
|
describe "the parent redefines the proc property" do
|
@@ -99,9 +99,9 @@ describe "proc properties" do
|
|
99
99
|
A.weather = :sunny
|
100
100
|
B.weather = :rainy
|
101
101
|
|
102
|
-
A.color.
|
103
|
-
B.color.
|
104
|
-
C.color.
|
102
|
+
A.color.should == "A: rosy"
|
103
|
+
B.color.should == "B: blue"
|
104
|
+
C.color.should == "C: blue"
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
@@ -115,46 +115,46 @@ describe "proc properties" do
|
|
115
115
|
it "inherits the new proc by default" do
|
116
116
|
A.weather = :sunny
|
117
117
|
|
118
|
-
A.mood.
|
119
|
-
B.mood.
|
120
|
-
C.mood.
|
118
|
+
A.mood.should == "content"
|
119
|
+
B.mood.should == "angry"
|
120
|
+
C.mood.should == "angry"
|
121
121
|
|
122
|
-
A.color.
|
123
|
-
B.color.
|
124
|
-
C.color.
|
122
|
+
A.color.should == "rosy"
|
123
|
+
B.color.should == "B: blue"
|
124
|
+
C.color.should == "C: blue"
|
125
125
|
end
|
126
126
|
|
127
127
|
describe "descendents can any inheritance, using the default instead" do
|
128
128
|
it "accepts ':default' syntax" do
|
129
129
|
A.weather = :sunny
|
130
130
|
|
131
|
-
A.mood.
|
132
|
-
B.mood.
|
133
|
-
C.mood(:default).
|
131
|
+
A.mood.should == "content"
|
132
|
+
B.mood.should == "angry"
|
133
|
+
C.mood(:default).should == "content"
|
134
134
|
end
|
135
135
|
|
136
136
|
it "accepts ':inherit => false' syntax" do
|
137
137
|
A.weather = :sunny
|
138
138
|
|
139
|
-
A.mood.
|
140
|
-
B.mood.
|
141
|
-
C.mood(:inherit => false).
|
139
|
+
A.mood.should == "content"
|
140
|
+
B.mood.should == "angry"
|
141
|
+
C.mood(:inherit => false).should == "content"
|
142
142
|
|
143
|
-
A.color.
|
144
|
-
B.color.
|
145
|
-
C.color(:inherit => false).
|
143
|
+
A.color.should == "rosy"
|
144
|
+
B.color.should == "B: blue"
|
145
|
+
C.color(:inherit => false).should == "blue" # ***** take note: C.mood = "depressed" *****
|
146
146
|
end
|
147
147
|
|
148
148
|
it "accepts ':inherit, false' syntax" do
|
149
149
|
A.weather = :sunny
|
150
150
|
|
151
|
-
A.mood.
|
152
|
-
B.mood.
|
153
|
-
C.mood(:inherit, false).
|
151
|
+
A.mood.should == "content"
|
152
|
+
B.mood.should == "angry"
|
153
|
+
C.mood(:inherit, false).should == "content"
|
154
154
|
|
155
|
-
A.color.
|
156
|
-
B.color.
|
157
|
-
C.color(:inherit, false).
|
155
|
+
A.color.should == "rosy"
|
156
|
+
B.color.should == "B: blue"
|
157
|
+
C.color(:inherit, false).should == "blue"
|
158
158
|
end
|
159
159
|
end
|
160
160
|
end
|
@@ -174,27 +174,27 @@ describe "proc properties" do
|
|
174
174
|
end
|
175
175
|
|
176
176
|
it "does not inherit" do
|
177
|
-
@props[:weather][:inherit].
|
178
|
-
@props[:mood][:inherit].
|
179
|
-
@props[:color][:inherit].
|
177
|
+
@props[:weather][:inherit].should == true # sanity
|
178
|
+
@props[:mood][:inherit].should == false
|
179
|
+
@props[:color][:inherit].should == false
|
180
180
|
end
|
181
181
|
|
182
182
|
describe "descendents" do
|
183
183
|
it "propogates the initial proc value, but not any descendents' proc" do
|
184
|
-
B.color_is_blank?.
|
185
|
-
C.mood_is_blank?.
|
184
|
+
B.color_is_blank?.should == true
|
185
|
+
C.mood_is_blank?.should == true
|
186
186
|
|
187
|
-
A.weather.
|
188
|
-
B.weather.
|
189
|
-
C.weather.
|
187
|
+
A.weather.should == :sunny # sanity
|
188
|
+
B.weather.should == :sunny # sanity
|
189
|
+
C.weather.should == :sunny
|
190
190
|
|
191
|
-
A.mood.
|
192
|
-
B.mood.
|
193
|
-
C.mood.
|
191
|
+
A.mood.should == "content" # sanity
|
192
|
+
B.mood.should == "angry" # sanity
|
193
|
+
C.mood.should == "content"
|
194
194
|
|
195
|
-
A.color.
|
196
|
-
B.color.
|
197
|
-
C.color.
|
195
|
+
A.color.should == "A: rosy" # sanity
|
196
|
+
B.color.should == "B: blue" # sanity
|
197
|
+
C.color.should == "C: rosy"
|
198
198
|
end
|
199
199
|
end
|
200
200
|
end
|
@@ -208,16 +208,16 @@ describe "proc properties" do
|
|
208
208
|
end
|
209
209
|
|
210
210
|
it "inherits the property" do
|
211
|
-
@props[:ingredients][:inherit].
|
212
|
-
@props[:sweet_tooth][:inherit].
|
211
|
+
@props[:ingredients][:inherit].should == true
|
212
|
+
@props[:sweet_tooth][:inherit].should == true
|
213
213
|
|
214
|
-
A.ingredients.
|
215
|
-
B.ingredients.
|
216
|
-
C.ingredients.
|
214
|
+
A.ingredients.should == Set.new([:sugar, :butter, :flour, :eggs])
|
215
|
+
B.ingredients.should == Set.new([:sugar, :butter, :flour, :eggs])
|
216
|
+
C.ingredients.should == Set.new([:sugar, :butter, :flour, :eggs])
|
217
217
|
|
218
|
-
A.sweet_tooth.
|
219
|
-
B.sweet_tooth.
|
220
|
-
C.sweet_tooth.
|
218
|
+
A.sweet_tooth.should == false
|
219
|
+
B.sweet_tooth.should == false
|
220
|
+
C.sweet_tooth.should == false
|
221
221
|
end
|
222
222
|
|
223
223
|
describe "a descendent redefines the property with a proc" do
|
@@ -244,18 +244,18 @@ describe "proc properties" do
|
|
244
244
|
C.diabetic = true
|
245
245
|
D.diabetic = false
|
246
246
|
|
247
|
-
B.diabetic.
|
248
|
-
C.diabetic.
|
249
|
-
D.diabetic.
|
247
|
+
B.diabetic.should == false
|
248
|
+
C.diabetic.should == true
|
249
|
+
D.diabetic.should == false
|
250
250
|
|
251
|
-
B.ingredients.
|
252
|
-
C.ingredients.
|
253
|
-
D.ingredients.
|
251
|
+
B.ingredients.should == Set.new([:sugar, :butter, :flour, :eggs])
|
252
|
+
C.ingredients.should == Set.new([:splenda, :butter, :flour, :eggs])
|
253
|
+
D.ingredients.should == Set.new([:sugar, :butter, :flour, :eggs])
|
254
254
|
|
255
|
-
A.sweet_tooth.
|
256
|
-
B.sweet_tooth.
|
257
|
-
C.sweet_tooth.
|
258
|
-
D.sweet_tooth.
|
255
|
+
A.sweet_tooth.should == false
|
256
|
+
B.sweet_tooth.should == true
|
257
|
+
C.sweet_tooth.should == false
|
258
|
+
D.sweet_tooth.should == true
|
259
259
|
end
|
260
260
|
|
261
261
|
describe "descendents redefine the property, but not to a proc" do
|
@@ -265,11 +265,11 @@ describe "proc properties" do
|
|
265
265
|
end
|
266
266
|
|
267
267
|
it "descendents reflect the new 'static' settings" do
|
268
|
-
C.ingredients.
|
269
|
-
D.ingredients.
|
268
|
+
C.ingredients.should == Set.new([:equal, :butter, :flour, :eggs])
|
269
|
+
D.ingredients.should == Set.new([:equal, :butter, :flour, :eggs])
|
270
270
|
|
271
|
-
C.sweet_tooth.
|
272
|
-
D.sweet_tooth.
|
271
|
+
C.sweet_tooth.should == false
|
272
|
+
D.sweet_tooth.should == false
|
273
273
|
end
|
274
274
|
end
|
275
275
|
end
|
@@ -285,19 +285,19 @@ describe "proc properties" do
|
|
285
285
|
"green"
|
286
286
|
}
|
287
287
|
|
288
|
-
B.color.
|
289
|
-
who_am_i.
|
290
|
-
which_parents.
|
288
|
+
B.color.should ==("green")
|
289
|
+
who_am_i.should ==(B)
|
290
|
+
which_parents.should ==([A])
|
291
291
|
end
|
292
292
|
|
293
293
|
it "evaluates to the property value" do
|
294
294
|
B.color = Proc.new{ "green" }
|
295
|
-
B.color.
|
295
|
+
B.color.should == "green"
|
296
296
|
|
297
297
|
C.color = Proc.new{|me, parents|
|
298
298
|
"#{me} #{parents.first.color.capitalize}"
|
299
299
|
}
|
300
|
-
C.color.
|
300
|
+
C.color.should == "C Green"
|
301
301
|
end
|
302
302
|
end
|
303
303
|
end
|
@@ -333,9 +333,9 @@ describe "examples" do
|
|
333
333
|
end
|
334
334
|
|
335
335
|
it "works" do
|
336
|
-
A.merged_opts.
|
337
|
-
B.merged_opts.
|
338
|
-
C.merged_opts.
|
336
|
+
A.merged_opts.should ==({:color => "black", :music => ["Rolling Stones"]})
|
337
|
+
B.merged_opts.should ==({:color => "black", :music => ["Arcade Fire"]})
|
338
|
+
C.merged_opts.should ==({:color => "blond", :music => ["Arcade Fire"]})
|
339
339
|
end
|
340
340
|
end
|
341
341
|
end
|
@@ -26,11 +26,11 @@ describe "parents_for()" do
|
|
26
26
|
end
|
27
27
|
|
28
28
|
it "lists ancestors for given property" do
|
29
|
-
A.parents_for(:color).
|
30
|
-
B.parents_for(:color).
|
31
|
-
C.parents_for(:color).
|
29
|
+
A.parents_for(:color).should == []
|
30
|
+
B.parents_for(:color).should == [A]
|
31
|
+
C.parents_for(:color).should == [B, A]
|
32
32
|
|
33
|
-
B.parents_for(:score).
|
34
|
-
C.parents_for(:score).
|
33
|
+
B.parents_for(:score).should == []
|
34
|
+
C.parents_for(:score).should == [B]
|
35
35
|
end
|
36
36
|
end
|
@@ -33,34 +33,34 @@ describe "custom hash-like class" do
|
|
33
33
|
|
34
34
|
describe "by default" do
|
35
35
|
it "is set to not inherit by default" do
|
36
|
-
@props[:beta][:inherit].
|
36
|
+
@props[:beta][:inherit].should == false
|
37
37
|
end
|
38
38
|
|
39
39
|
it "descendents (including instances) do not inherit" do
|
40
|
-
Parent.new.beta.
|
41
|
-
Child.beta.
|
42
|
-
Child.new.beta.
|
43
|
-
GrandChild.beta.
|
44
|
-
GrandChild.new.beta.
|
40
|
+
Parent.new.beta.should == MyCustom.new
|
41
|
+
Child.beta.should == MyCustom.new
|
42
|
+
Child.new.beta.should == MyCustom.new
|
43
|
+
GrandChild.beta.should == MyCustom.new
|
44
|
+
GrandChild.new.beta.should == MyCustom.new
|
45
45
|
end
|
46
46
|
|
47
47
|
it "'Parent' has 'default' value" do
|
48
|
-
Parent.beta.
|
48
|
+
Parent.beta.should == MyCustom.new(:rank, 4, :color, "red")
|
49
49
|
end
|
50
50
|
|
51
51
|
it "has type ':MyCustom'" do
|
52
|
-
@props[:beta][:type].
|
52
|
+
@props[:beta][:type].should == :MyCustom
|
53
53
|
end
|
54
54
|
|
55
55
|
it "has blank value of empty 'MyCustom' object" do
|
56
56
|
mc = MyCustom.new
|
57
|
-
mc.empty?.
|
57
|
+
mc.empty?.should == true
|
58
58
|
|
59
|
-
@props[:beta][:blank].call(mc).
|
59
|
+
@props[:beta][:blank].call(mc).should == true
|
60
60
|
end
|
61
61
|
|
62
62
|
it "has new value of empty 'MyCustom' object" do
|
63
|
-
@props[:beta][:new].call.
|
63
|
+
@props[:beta][:new].call.should == MyCustom.new
|
64
64
|
end
|
65
65
|
|
66
66
|
it "nonblank values never inherit" do
|
data/spec/helper_spec.rb
CHANGED
@@ -7,33 +7,33 @@ require 'minitest/autorun'
|
|
7
7
|
## end
|
8
8
|
|
9
9
|
def blank_inherit_helper(obj, property, expected_depth, expected_val, empty)
|
10
|
-
obj.send("#{property}_is_blank?").
|
10
|
+
obj.send("#{property}_is_blank?").should be_true
|
11
11
|
|
12
12
|
dont_inherit = (expected_depth < 0) ? [0] : (0...expected_depth).to_a
|
13
13
|
dont_inherit << false << nil
|
14
14
|
dont_inherit.each do |i|
|
15
|
-
obj.send(property, i).
|
16
|
-
obj.send(property, :inherit => i).
|
17
|
-
obj.send(property, :inherit, i).
|
15
|
+
obj.send(property, i).should == empty
|
16
|
+
obj.send(property, :inherit => i).should == empty
|
17
|
+
obj.send(property, :inherit, i).should == empty
|
18
18
|
end
|
19
19
|
|
20
20
|
do_inherit = (expected_depth < 0) ? [] : (expected_depth..(expected_depth+1)).to_a
|
21
21
|
do_inherit << true << -1
|
22
22
|
do_inherit.each do |i|
|
23
|
-
obj.send(property, i).
|
24
|
-
obj.send(property, :inherit => i).
|
25
|
-
obj.send(property, :inherit, i).
|
23
|
+
obj.send(property, i).should eq(expected_val)
|
24
|
+
obj.send(property, :inherit => i).should eq(expected_val)
|
25
|
+
obj.send(property, :inherit, i).should eq(expected_val)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
29
|
def nonblank_helper(obj, property, expected)
|
30
|
-
obj.send("#{property}_is_blank?").
|
30
|
+
obj.send("#{property}_is_blank?").should be_false
|
31
31
|
|
32
32
|
vals = [0, 1, 2, 3, -1, false, true, nil]
|
33
33
|
vals.each do |i|
|
34
|
-
obj.send(property, i).
|
35
|
-
obj.send(property, :inherit => i).
|
36
|
-
obj.send(property, :inherit, i).
|
34
|
+
obj.send(property, i).should == expected
|
35
|
+
obj.send(property, :inherit => i).should == expected
|
36
|
+
obj.send(property, :inherit, i).should == expected
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
data/spec/instances/basics.rb
CHANGED
@@ -9,71 +9,71 @@ end
|
|
9
9
|
# defaults: hash of defaults
|
10
10
|
def getters(obj, defaults)
|
11
11
|
defaults.each do |key, val|
|
12
|
-
obj.send(key).
|
12
|
+
obj.send(key).should == val
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
16
|
def container_getters(obj, depth)
|
17
|
-
obj.urls(false).
|
18
|
-
obj.urls(nil).
|
17
|
+
obj.urls(false).should == Array.new
|
18
|
+
obj.urls(nil).should == Array.new
|
19
19
|
0.upto(depth-1).each do |i|
|
20
|
-
obj.urls(i).
|
20
|
+
obj.urls(i).should == Array.new
|
21
21
|
end
|
22
22
|
depth.upto(depth+1).each do |i|
|
23
|
-
obj.urls(i).
|
23
|
+
obj.urls(i).should == ["www.google.com"]
|
24
24
|
end
|
25
|
-
obj.urls(-1).
|
26
|
-
obj.urls(true).
|
25
|
+
obj.urls(-1).should == ["www.google.com"]
|
26
|
+
obj.urls(true).should == ["www.google.com"]
|
27
27
|
|
28
|
-
obj.name(false).
|
29
|
-
obj.name(nil).
|
28
|
+
obj.name(false).should == Hash.new
|
29
|
+
obj.name(nil).should == Hash.new
|
30
30
|
0.upto(depth-1).each do |i|
|
31
|
-
obj.name(i).
|
31
|
+
obj.name(i).should == Hash.new
|
32
32
|
end
|
33
33
|
depth.upto(depth+1).each do |i|
|
34
|
-
obj.name(i).
|
34
|
+
obj.name(i).should ==({:first => 'jon', :last => 'smith'})
|
35
35
|
end
|
36
|
-
obj.name(true).
|
37
|
-
obj.name(-1).
|
36
|
+
obj.name(true).should ==({:first => 'jon', :last => 'smith'})
|
37
|
+
obj.name(-1).should ==({:first => 'jon', :last => 'smith'})
|
38
38
|
end
|
39
39
|
|
40
40
|
def setters(obj)
|
41
41
|
obj.color = "blue"
|
42
|
-
obj.color.
|
42
|
+
obj.color.should == "blue"
|
43
43
|
|
44
44
|
obj.setting = :rural
|
45
|
-
obj.setting.
|
45
|
+
obj.setting.should == :rural
|
46
46
|
|
47
47
|
obj.score = 28.1
|
48
|
-
obj.score.
|
48
|
+
obj.score.should == 28.1
|
49
49
|
|
50
50
|
obj.num = 15
|
51
|
-
obj.num.
|
51
|
+
obj.num.should == 15
|
52
52
|
|
53
53
|
obj.available = false
|
54
|
-
obj.available.
|
54
|
+
obj.available.should == false
|
55
55
|
|
56
56
|
obj.urls << "www.yahoo.com" << "www.bing.com"
|
57
|
-
obj.urls.
|
57
|
+
obj.urls.should == ["www.yahoo.com", "www.bing.com"]
|
58
58
|
|
59
59
|
obj.urls = ["www.nytimes.com"]
|
60
|
-
obj.urls.
|
60
|
+
obj.urls.should == ["www.nytimes.com"]
|
61
61
|
|
62
|
-
obj.verify.
|
63
|
-
obj.verify2.
|
62
|
+
obj.verify.should == false # doesn't inherit name
|
63
|
+
obj.verify2.should == true # inherits name
|
64
64
|
|
65
65
|
obj.name[:first] = 'thomas'
|
66
66
|
obj.name[:last] = 'smith'
|
67
|
-
obj.name.
|
67
|
+
obj.name.should ==({:first => 'thomas', :last => 'smith'})
|
68
68
|
|
69
|
-
obj.verify.
|
70
|
-
obj.verify2.
|
69
|
+
obj.verify.should == true
|
70
|
+
obj.verify2.should == true
|
71
71
|
|
72
72
|
obj.verify = Proc.new{|me| me.name[:first] !~ /mas/}
|
73
73
|
obj.verify2 = Proc.new{|me| me.name(true)[:first] !~ /mas/}
|
74
74
|
|
75
|
-
obj.verify.
|
76
|
-
obj.verify2.
|
75
|
+
obj.verify.should == false
|
76
|
+
obj.verify2.should == false
|
77
77
|
end
|
78
78
|
|
79
79
|
describe "instances: via 'extend'" do
|
@@ -107,8 +107,8 @@ describe "instances: via 'extend'" do
|
|
107
107
|
a = A.new
|
108
108
|
[:color, :setting, :score, :num, :available,
|
109
109
|
:urls, :name, :verify].each do |t|
|
110
|
-
@props[t][:instances_too].
|
111
|
-
a.respond_to?(:t).
|
110
|
+
@props[t][:instances_too].should == false
|
111
|
+
a.respond_to?(:t).should == false
|
112
112
|
end
|
113
113
|
end
|
114
114
|
end
|
@@ -132,17 +132,17 @@ describe "instances: via 'extend'" do
|
|
132
132
|
a = A.new
|
133
133
|
[:color, :setting, :score, :num, :available,
|
134
134
|
:urls, :name, :verify, :verify2].each do |t|
|
135
|
-
@props[t][:instances_too].
|
136
|
-
a.respond_to?(t).
|
135
|
+
@props[t][:instances_too].should == true
|
136
|
+
a.respond_to?(t).should == true
|
137
137
|
end
|
138
138
|
end
|
139
139
|
|
140
140
|
it "inherits all non-container properties" do
|
141
141
|
[:color, :setting, :score, :num, :available, :verify, :verify2].each do |t|
|
142
|
-
@props[t][:inherit].
|
142
|
+
@props[t][:inherit].should == true
|
143
143
|
end
|
144
|
-
@props[:urls][:inherit].
|
145
|
-
@props[:name][:inherit].
|
144
|
+
@props[:urls][:inherit].should == false
|
145
|
+
@props[:name][:inherit].should == false
|
146
146
|
|
147
147
|
defaults = A.to_hash # assumes 'to_hash' works; ie: likely testing it too
|
148
148
|
[:urls, :name, :verify, :verify2].each{|j| defaults.delete j}
|
@@ -201,17 +201,17 @@ describe "instances: via 'include'" do
|
|
201
201
|
a = A.new
|
202
202
|
[:color, :setting, :score, :num, :available,
|
203
203
|
:urls, :name, :verify, :verify2].each do |t|
|
204
|
-
@props[t][:instances_too].
|
205
|
-
a.respond_to?(t).
|
204
|
+
@props[t][:instances_too].should == true
|
205
|
+
a.respond_to?(t).should == true
|
206
206
|
end
|
207
207
|
end
|
208
208
|
|
209
209
|
it "inherits all non-container properties" do
|
210
210
|
[:color, :setting, :score, :num, :available, :verify, :verify2].each do |t|
|
211
|
-
@props[t][:inherit].
|
211
|
+
@props[t][:inherit].should == true
|
212
212
|
end
|
213
|
-
@props[:urls][:inherit].
|
214
|
-
@props[:name][:inherit].
|
213
|
+
@props[:urls][:inherit].should == false
|
214
|
+
@props[:name][:inherit].should == false
|
215
215
|
|
216
216
|
defaults = A.to_hash # assumes 'to_hash' works; ie: likely testing it too
|
217
217
|
[:urls, :name, :verify, :verify2].each{|j| defaults.delete j}
|