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.
@@ -27,50 +27,50 @@ describe "array syntax" do
27
27
 
28
28
  props = Parent.singleton_class.properties
29
29
 
30
- props[:colors_a][:type].must_equal :Array
31
- props[:colors_b][:type].must_equal :Array
32
- props[:colors_c][:type].must_equal :undefined_type
33
- Parent.colors_a.must_equal [:red, :blue, :yellow]
34
- Parent.colors_b.must_equal []
35
- Parent.colors_c.must_equal nil
30
+ props[:colors_a][:type].should == :Array
31
+ props[:colors_b][:type].should == :Array
32
+ props[:colors_c][:type].should == :undefined_type
33
+ Parent.colors_a.should == [:red, :blue, :yellow]
34
+ Parent.colors_b.should == []
35
+ Parent.colors_c.should == nil
36
36
 
37
37
  Parent.colors_b << :red << :blue << :yellow
38
38
  Parent.colors_c = [:red, :blue, :yellow]
39
39
 
40
- props[:colors_c][:type].must_equal :Array
41
- Parent.colors_b.must_equal [:red, :blue, :yellow]
42
- Parent.colors_c.must_equal [:red, :blue, :yellow]
40
+ props[:colors_c][:type].should == :Array
41
+ Parent.colors_b.should == [:red, :blue, :yellow]
42
+ Parent.colors_c.should == [:red, :blue, :yellow]
43
43
 
44
44
  Parent.cascade [:colors_d, [:red, :blue, :yellow]], :colors_e
45
45
  Parent.cascade [:colors_f, [:red, :blue, :yellow]]
46
46
  Parent.cascade :colors_g
47
47
 
48
- props[:colors_d][:type].must_equal :Array
49
- props[:colors_e][:type].must_equal :undefined_type
50
- props[:colors_f][:type].must_equal :Array
51
- props[:colors_g][:type].must_equal :undefined_type
52
- Parent.colors_d.must_equal [:red, :blue, :yellow]
53
- Parent.colors_e.must_equal nil
54
- Parent.colors_f.must_equal [:red, :blue, :yellow]
55
- Parent.colors_g.must_equal nil
48
+ props[:colors_d][:type].should == :Array
49
+ props[:colors_e][:type].should == :undefined_type
50
+ props[:colors_f][:type].should == :Array
51
+ props[:colors_g][:type].should == :undefined_type
52
+ Parent.colors_d.should == [:red, :blue, :yellow]
53
+ Parent.colors_e.should == nil
54
+ Parent.colors_f.should == [:red, :blue, :yellow]
55
+ Parent.colors_g.should == nil
56
56
 
57
57
  Parent.colors_e = [:red, :blue, :yellow]
58
58
  Parent.colors_g = [:red, :blue, :yellow]
59
59
 
60
- props[:colors_e][:type].must_equal :Array
61
- props[:colors_g][:type].must_equal :Array
62
- Parent.colors_e.must_equal [:red, :blue, :yellow]
63
- Parent.colors_g.must_equal [:red, :blue, :yellow]
60
+ props[:colors_e][:type].should == :Array
61
+ props[:colors_g][:type].should == :Array
62
+ Parent.colors_e.should == [:red, :blue, :yellow]
63
+ Parent.colors_g.should == [:red, :blue, :yellow]
64
64
  end
65
65
 
66
66
  it "is all the same" do
67
- Parent.colors_a.must_equal [:red, :blue, :yellow]
68
- Parent.colors_b.must_equal [:red, :blue, :yellow]
69
- Parent.colors_c.must_equal [:red, :blue, :yellow]
70
- Parent.colors_d.must_equal [:red, :blue, :yellow]
71
- Parent.colors_e.must_equal [:red, :blue, :yellow]
72
- Parent.colors_f.must_equal [:red, :blue, :yellow]
73
- Parent.colors_g.must_equal [:red, :blue, :yellow]
67
+ Parent.colors_a.should == [:red, :blue, :yellow]
68
+ Parent.colors_b.should == [:red, :blue, :yellow]
69
+ Parent.colors_c.should == [:red, :blue, :yellow]
70
+ Parent.colors_d.should == [:red, :blue, :yellow]
71
+ Parent.colors_e.should == [:red, :blue, :yellow]
72
+ Parent.colors_f.should == [:red, :blue, :yellow]
73
+ Parent.colors_g.should == [:red, :blue, :yellow]
74
74
  end
75
75
  end
76
76
  end
@@ -94,32 +94,32 @@ describe "array syntax" do
94
94
 
95
95
  describe "by default" do
96
96
  it "is set to not 'inherit' by default" do
97
- @props[:fruit][:inherit].must_equal(false)
98
- Child.fruit.must_equal []
97
+ @props[:fruit][:inherit].should ==(false)
98
+ Child.fruit.should == []
99
99
  end
100
100
 
101
101
  it "descendents (including instances) do not inherit" do
102
- Parent.new.fruit.must_equal []
103
- Child.fruit.must_equal []
104
- Child.new.fruit.must_equal []
105
- GrandChild.fruit.must_equal []
106
- GrandChild.new.fruit.must_equal []
102
+ Parent.new.fruit.should == []
103
+ Child.fruit.should == []
104
+ Child.new.fruit.should == []
105
+ GrandChild.fruit.should == []
106
+ GrandChild.new.fruit.should == []
107
107
  end
108
108
 
109
109
  it "'Parent' has default value" do
110
- Parent.fruit.must_equal [:orange, :apple, :pear]
110
+ Parent.fruit.should == [:orange, :apple, :pear]
111
111
  end
112
112
 
113
113
  it "has type ':Array'" do
114
- @props[:fruit][:type].must_equal :Array
114
+ @props[:fruit][:type].should == :Array
115
115
  end
116
116
 
117
117
  it "has blank value of empty array" do
118
- @props[:fruit][:blank].call([]).must_equal true
118
+ @props[:fruit][:blank].call([]).should == true
119
119
  end
120
120
 
121
121
  it "has new value of empty array" do
122
- @props[:fruit][:new].call.must_equal []
122
+ @props[:fruit][:new].call.should == []
123
123
  end
124
124
 
125
125
  it "nonblank values never inherit" do
@@ -29,46 +29,46 @@ describe "hash syntax" do
29
29
 
30
30
  props = Parent.singleton_class.properties
31
31
 
32
- props[:person_a][:type].must_equal :Hash
33
- props[:person_b][:type].must_equal :Hash
34
- props[:person_c][:type].must_equal :undefined_type
35
- Parent.person_a.must_equal({:name => ['williamson', 'charles']})
36
- Parent.person_b.must_equal({})
37
- Parent.person_c.must_equal nil
32
+ props[:person_a][:type].should == :Hash
33
+ props[:person_b][:type].should == :Hash
34
+ props[:person_c][:type].should == :undefined_type
35
+ Parent.person_a.should ==({:name => ['williamson', 'charles']})
36
+ Parent.person_b.should ==({})
37
+ Parent.person_c.should == nil
38
38
 
39
39
  Parent.person_b[:name] = ['williamson', 'charles']
40
40
  Parent.person_c = {:name => ['williamson', 'charles']}
41
- props[:person_c][:type].must_equal :Hash
42
- Parent.person_b.must_equal({:name => ['williamson', 'charles']})
43
- Parent.person_c.must_equal({:name => ['williamson', 'charles']})
41
+ props[:person_c][:type].should == :Hash
42
+ Parent.person_b.should ==({:name => ['williamson', 'charles']})
43
+ Parent.person_c.should ==({:name => ['williamson', 'charles']})
44
44
 
45
45
  Parent.cascade [:person_d, {:name => ['williamson', 'charles']}], :person_e
46
46
  Parent.cascade [:person_f, {:name => ['williamson', 'charles']}]
47
47
  Parent.cascade :person_g
48
- props[:person_d][:type].must_equal :Hash
49
- props[:person_e][:type].must_equal :undefined_type
50
- props[:person_f][:type].must_equal :Hash
51
- props[:person_g][:type].must_equal :undefined_type
52
- Parent.person_d.must_equal({:name => ['williamson', 'charles']})
53
- Parent.person_e.must_equal nil
54
- Parent.person_f.must_equal({:name => ['williamson', 'charles']})
55
- Parent.person_g.must_equal nil
48
+ props[:person_d][:type].should == :Hash
49
+ props[:person_e][:type].should == :undefined_type
50
+ props[:person_f][:type].should == :Hash
51
+ props[:person_g][:type].should == :undefined_type
52
+ Parent.person_d.should ==({:name => ['williamson', 'charles']})
53
+ Parent.person_e.should == nil
54
+ Parent.person_f.should ==({:name => ['williamson', 'charles']})
55
+ Parent.person_g.should == nil
56
56
 
57
57
  Parent.person_e = Parent.person_g = {:name => ['williamson', 'charles']}
58
- props[:person_e][:type].must_equal :Hash
59
- props[:person_g][:type].must_equal :Hash
60
- Parent.person_e.must_equal({:name => ['williamson', 'charles']})
61
- Parent.person_g.must_equal({:name => ['williamson', 'charles']})
58
+ props[:person_e][:type].should == :Hash
59
+ props[:person_g][:type].should == :Hash
60
+ Parent.person_e.should ==({:name => ['williamson', 'charles']})
61
+ Parent.person_g.should ==({:name => ['williamson', 'charles']})
62
62
  end
63
63
 
64
64
  it 'is all the same' do
65
- Parent.person_a.must_equal({:name => ['williamson', 'charles']})
66
- Parent.person_b.must_equal({:name => ['williamson', 'charles']})
67
- Parent.person_c.must_equal({:name => ['williamson', 'charles']})
68
- Parent.person_d.must_equal({:name => ['williamson', 'charles']})
69
- Parent.person_e.must_equal({:name => ['williamson', 'charles']})
70
- Parent.person_f.must_equal({:name => ['williamson', 'charles']})
71
- Parent.person_g.must_equal({:name => ['williamson', 'charles']})
65
+ Parent.person_a.should ==({:name => ['williamson', 'charles']})
66
+ Parent.person_b.should ==({:name => ['williamson', 'charles']})
67
+ Parent.person_c.should ==({:name => ['williamson', 'charles']})
68
+ Parent.person_d.should ==({:name => ['williamson', 'charles']})
69
+ Parent.person_e.should ==({:name => ['williamson', 'charles']})
70
+ Parent.person_f.should ==({:name => ['williamson', 'charles']})
71
+ Parent.person_g.should ==({:name => ['williamson', 'charles']})
72
72
  end
73
73
  end
74
74
  end
@@ -92,31 +92,31 @@ describe "hash usage" do
92
92
 
93
93
  describe "by default" do
94
94
  it "is set to not 'inherit' by default" do
95
- @props[:eyes][:inherit].must_equal false
95
+ @props[:eyes][:inherit].should == false
96
96
  end
97
97
 
98
98
  it "descendents (including instances) do not inherit" do
99
- Parent.new.eyes.must_equal({})
100
- Child.eyes.must_equal({})
101
- Child.new.eyes.must_equal({})
102
- GrandChild.eyes.must_equal({})
103
- GrandChild.new.eyes.must_equal({})
99
+ Parent.new.eyes.should ==({})
100
+ Child.eyes.should ==({})
101
+ Child.new.eyes.should ==({})
102
+ GrandChild.eyes.should ==({})
103
+ GrandChild.new.eyes.should ==({})
104
104
  end
105
105
 
106
106
  it "'Parent' has 'default' value" do
107
- Parent.eyes.must_equal({:color => "red"})
107
+ Parent.eyes.should ==({:color => "red"})
108
108
  end
109
109
 
110
110
  it "has type ':Hash'" do
111
- @props[:eyes][:type].must_equal :Hash
111
+ @props[:eyes][:type].should == :Hash
112
112
  end
113
113
 
114
114
  it "has blank value of empty hash" do
115
- @props[:eyes][:blank].call({}).must_equal true
115
+ @props[:eyes][:blank].call({}).should == true
116
116
  end
117
117
 
118
118
  it "has new value of empty hash" do
119
- @props[:eyes][:new].call.must_equal({})
119
+ @props[:eyes][:new].call.should ==({})
120
120
  end
121
121
 
122
122
  it "nonblank values never inherit" do
@@ -27,46 +27,46 @@ describe "string - base" do
27
27
 
28
28
  props = Parent.singleton_class.properties
29
29
 
30
- props[:color_a][:type].must_equal :String
31
- props[:color_b][:type].must_equal :String
32
- props[:color_c][:type].must_equal :Object
33
- Parent.color_a.must_equal "white"
34
- Parent.color_b.must_equal ''
35
- Parent.color_c.must_equal nil
30
+ props[:color_a][:type].should == :String
31
+ props[:color_b][:type].should == :String
32
+ props[:color_c][:type].should == :Object
33
+ Parent.color_a.should == "white"
34
+ Parent.color_b.should == ''
35
+ Parent.color_c.should == nil
36
36
 
37
37
  Parent.color_b = "white"
38
38
  Parent.color_c = "white"
39
- props[:color_c][:type].must_equal :String
40
- Parent.color_b.must_equal "white"
41
- Parent.color_c.must_equal "white"
39
+ props[:color_c][:type].should == :String
40
+ Parent.color_b.should == "white"
41
+ Parent.color_c.should == "white"
42
42
 
43
43
  Parent.cascade [:color_d, "white"], :color_e
44
44
  Parent.cascade [:color_f, "white"]
45
45
  Parent.cascade :color_g
46
- props[:color_d][:type].must_equal :String
47
- props[:color_e][:type].must_equal :Object
48
- props[:color_f][:type].must_equal :String
49
- props[:color_g][:type].must_equal :Object
50
- Parent.color_d.must_equal "white"
51
- Parent.color_e.must_equal nil
52
- Parent.color_f.must_equal "white"
53
- Parent.color_g.must_equal nil
46
+ props[:color_d][:type].should == :String
47
+ props[:color_e][:type].should == :Object
48
+ props[:color_f][:type].should == :String
49
+ props[:color_g][:type].should == :Object
50
+ Parent.color_d.should == "white"
51
+ Parent.color_e.should == nil
52
+ Parent.color_f.should == "white"
53
+ Parent.color_g.should == nil
54
54
 
55
55
  Parent.color_e = Parent.color_g = "white"
56
- props[:color_e][:type].must_equal :String
57
- props[:color_g][:type].must_equal :String
58
- Parent.color_e.must_equal "white"
59
- Parent.color_g.must_equal "white"
56
+ props[:color_e][:type].should == :String
57
+ props[:color_g][:type].should == :String
58
+ Parent.color_e.should == "white"
59
+ Parent.color_g.should == "white"
60
60
  end
61
61
 
62
62
  it "is all the same" do
63
- Parent.color_a.must_equal "white"
64
- Parent.color_b.must_equal "white"
65
- Parent.color_c.must_equal "white"
66
- Parent.color_d.must_equal "white"
67
- Parent.color_e.must_equal "white"
68
- Parent.color_f.must_equal "white"
69
- Parent.color_g.must_equal "white"
63
+ Parent.color_a.should == "white"
64
+ Parent.color_b.should == "white"
65
+ Parent.color_c.should == "white"
66
+ Parent.color_d.should == "white"
67
+ Parent.color_e.should == "white"
68
+ Parent.color_f.should == "white"
69
+ Parent.color_g.should == "white"
70
70
  end
71
71
  end
72
72
  end
@@ -90,19 +90,19 @@ describe "string" do
90
90
 
91
91
  describe "by default" do
92
92
  it "has type :String" do
93
- @props[:color][:type].must_equal :String
93
+ @props[:color][:type].should == :String
94
94
  end
95
95
 
96
96
  it "inherits by default" do
97
- @props[:color][:inherit].must_equal true
97
+ @props[:color][:inherit].should == true
98
98
  end
99
99
 
100
100
  it "has blank value of empty string" do
101
- @props[:color][:blank].call('').must_equal true
101
+ @props[:color][:blank].call('').should == true
102
102
  end
103
103
 
104
104
  it "has new value of empty string" do
105
- @props[:color][:new].call.must_equal ''
105
+ @props[:color][:new].call.should == ''
106
106
  end
107
107
  end
108
108
 
@@ -142,29 +142,29 @@ describe "string" do
142
142
  end
143
143
 
144
144
  it "has blank value of nil and new value of empty string" do
145
- @props[:city][:blank].call('').must_equal false
146
- @props[:city][:blank].call(nil).must_equal true
145
+ @props[:city][:blank].call('').should == false
146
+ @props[:city][:blank].call(nil).should == true
147
147
 
148
148
  new_val = @props[:city][:new].call
149
149
 
150
- Parent.city.must_equal "new york"
151
- Parent.city_is_blank?.must_equal false
152
- Child.city.must_equal new_val
153
- Child.city_is_blank?.must_equal false
154
- GrandChild.city.must_equal new_val
155
- GrandChild.city_is_blank?.must_equal false
150
+ Parent.city.should == "new york"
151
+ Parent.city_is_blank?.should == false
152
+ Child.city.should == new_val
153
+ Child.city_is_blank?.should == false
154
+ GrandChild.city.should == new_val
155
+ GrandChild.city_is_blank?.should == false
156
156
 
157
157
  GrandChild.city = nil
158
- GrandChild.city_is_blank?.must_equal true
159
- GrandChild.city.must_equal Child.city
158
+ GrandChild.city_is_blank?.should == true
159
+ GrandChild.city.should == Child.city
160
160
 
161
161
  Child.city = nil
162
- Child.city_is_blank?.must_equal true
163
- Child.city.must_equal Parent.city
162
+ Child.city_is_blank?.should == true
163
+ Child.city.should == Parent.city
164
164
 
165
165
  Parent.city = nil
166
- Parent.city.must_equal nil
167
- Parent.city_is_blank?.must_equal true
166
+ Parent.city.should == nil
167
+ Parent.city_is_blank?.should == true
168
168
  end
169
169
  end
170
170
 
@@ -176,15 +176,15 @@ describe "string" do
176
176
  end
177
177
 
178
178
  it "has blank value of nil and new value of nil" do
179
- @props[:state][:blank].call('').must_equal false
180
- @props[:state][:blank].call(nil).must_equal true
181
- @props[:state][:new].call.must_equal nil
179
+ @props[:state][:blank].call('').should == false
180
+ @props[:state][:blank].call(nil).should == true
181
+ @props[:state][:new].call.should == nil
182
182
 
183
- Child.state_is_blank?.must_equal true
184
- GrandChild.state_is_blank?.must_equal true
183
+ Child.state_is_blank?.should == true
184
+ GrandChild.state_is_blank?.should == true
185
185
 
186
- Child.state(false).must_equal nil
187
- GrandChild.state(false).must_equal nil
186
+ Child.state(false).should == nil
187
+ GrandChild.state(false).should == nil
188
188
  end
189
189
  end
190
190
  end
@@ -34,22 +34,22 @@ describe "null syntax" do
34
34
  it "has ':Object' type" do
35
35
  [:string, :int, :float, :sym, :bool, :hash, :array, :set].each do |type|
36
36
  name = "future_#{type}".to_sym
37
- @props[name][:type].must_equal :Object
37
+ @props[name][:type].should == :Object
38
38
  end
39
39
  end
40
40
 
41
41
  it "is nil for parent class" do
42
42
  [:string, :int, :float, :sym, :bool, :hash, :array, :set].each do |type|
43
43
  name = "future_#{type}".to_sym
44
- Parent.send(name).must_equal nil
44
+ Parent.send(name).should == nil
45
45
  end
46
46
  end
47
47
 
48
48
  it "is nil for subclasses" do
49
49
  [:string, :int, :float, :sym, :bool, :hash, :array, :set].each do |type|
50
50
  name = "future_#{type}".to_sym
51
- Child.send(name).must_equal nil
52
- GrandChild.send(name).must_equal nil
51
+ Child.send(name).should == nil
52
+ GrandChild.send(name).should == nil
53
53
  end
54
54
  end
55
55
  end
@@ -21,17 +21,17 @@ describe "options" do
21
21
 
22
22
  it "has a global default" do
23
23
  CC.block_inst_exec = true
24
- CC.block_inst_exec?.must_equal true
24
+ CC.block_inst_exec?.should == true
25
25
 
26
26
  CC.block_inst_exec = false
27
- CC.block_inst_exec?.must_equal false
27
+ CC.block_inst_exec?.should == false
28
28
  end
29
29
 
30
30
  it "defaults to global setting" do
31
31
  props = A.cascade do
32
32
  color
33
33
  end
34
- props[:color][:block_inst_exec].must_equal(CC.block_inst_exec?)
34
+ props[:color][:block_inst_exec].should ==(CC.block_inst_exec?)
35
35
  end
36
36
 
37
37
  it "can be set in the 'cascade' block, overruling the global default" do
@@ -39,7 +39,7 @@ describe "options" do
39
39
  props = A.cascade do
40
40
  color :block_inst_exec => false
41
41
  end
42
- props[:color][:block_inst_exec].must_equal false
42
+ props[:color][:block_inst_exec].should == false
43
43
  end
44
44
 
45
45
  it "can be set in 'opts' hash of property method, overruling others" do
@@ -52,8 +52,8 @@ describe "options" do
52
52
  who_is_self_1 = A.color(:inherit, 0){|me, parents| self}
53
53
  who_is_self_2 = A.color(:inherit, 0, {:block_inst_exec => true}){|me, parents| self}
54
54
 
55
- who_is_self_1.must_equal who_am_i
56
- who_is_self_2.must_equal A
55
+ who_is_self_1.should == who_am_i
56
+ who_is_self_2.should == A
57
57
  end
58
58
  end
59
59
  end