dsl_maker 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changes +5 -0
- data/README.md +16 -12
- data/lib/dsl/maker.rb +2 -5
- data/lib/dsl/maker/version.rb +1 -1
- data/spec/alias_type_spec.rb +4 -4
- data/spec/args_spec.rb +11 -11
- data/spec/array_type_spec.rb +4 -4
- data/spec/class_as_subdsl_spec.rb +2 -2
- data/spec/helper_spec.rb +2 -2
- data/spec/multi_level_spec.rb +5 -5
- data/spec/single_level_spec.rb +13 -13
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99ee47867d6b31ded1c99a54a01aa793a61592f3
|
4
|
+
data.tar.gz: 5e11770909897a850465398142d13ea52e533f54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9106d1d87a86d23e4eccb86b39d4a972e413cf3ce1dd7c469f36889de039f4162494da84abc0a5247312f61e64ca2c1b5b33e5ac694e3428d8640771d8de6504
|
7
|
+
data.tar.gz: 9e1084f369c61cc4029b90ff76a555f17203b3c52913d5aaca1168b93f7725d1b8f2696170b12047e12fb936a7dc24acb0cf8e2ad24688493249a3b17db03b7e
|
data/Changes
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
Revision history for DSL::Maker (ordered by revision number).
|
2
2
|
|
3
|
+
0.1.0 Aug 11 2015
|
4
|
+
BREAKING CHANGE:
|
5
|
+
- parse_dsl() and execute_dsl() now always return an array, even if there is
|
6
|
+
only one value. This simplifies code to handle error cases.
|
7
|
+
|
3
8
|
0.0.9 Aug 11 2015
|
4
9
|
- Added the ArrayOf[<type>] type to allow for arrays to concatenate properly.
|
5
10
|
- Added the AliasOf(<name>) type to allow for use of multiple names to refer to
|
data/README.md
CHANGED
@@ -158,7 +158,7 @@ class PizzaBuilder < DSL::Maker
|
|
158
158
|
end
|
159
159
|
end
|
160
160
|
|
161
|
-
|
161
|
+
pizzas = PizzaBuilder.parse_dsl("
|
162
162
|
pizza {
|
163
163
|
cheese yes
|
164
164
|
pepperoni Yes
|
@@ -199,7 +199,7 @@ class FamilyTree < DSL::Maker
|
|
199
199
|
end
|
200
200
|
end
|
201
201
|
|
202
|
-
|
202
|
+
people = FamilyTree.parse_dsl("
|
203
203
|
person {
|
204
204
|
name 'John Smith'
|
205
205
|
mother {
|
@@ -210,6 +210,7 @@ john_smith = FamilyTree.parse_dsl("
|
|
210
210
|
}
|
211
211
|
}
|
212
212
|
")
|
213
|
+
john_smith = people[0]
|
213
214
|
```
|
214
215
|
|
215
216
|
Pretty easy. We can even refactor that a bit and end up with:
|
@@ -261,7 +262,7 @@ class FamilyTreeDSL < DSL::Maker
|
|
261
262
|
end
|
262
263
|
end
|
263
264
|
|
264
|
-
|
265
|
+
people = FamilyTreeDSL.parse_dsl("
|
265
266
|
person 'John Smith' do
|
266
267
|
age 20
|
267
268
|
mother 'Mary Smith' do
|
@@ -273,6 +274,7 @@ john_smith = FamilyTreeDSL.parse_dsl("
|
|
273
274
|
}
|
274
275
|
end
|
275
276
|
")
|
277
|
+
john_smith = people[0]
|
276
278
|
```
|
277
279
|
|
278
280
|
The result is exactly the same as before.
|
@@ -304,8 +306,10 @@ Now, we can handle an arbitrarily-deep family tree.
|
|
304
306
|
|
305
307
|
### Handling multiple items
|
306
308
|
|
307
|
-
|
308
|
-
|
309
|
+
You'll note we've been receiving an Array from `parse_dsl()`. This is because
|
310
|
+
DSL::Maker automagically handles files with multiple entries. Chef's recipe files
|
311
|
+
have many entries of different types in them. It doesn't do you any good if you
|
312
|
+
can't do the same thing.
|
309
313
|
|
310
314
|
```ruby
|
311
315
|
Car = Struct.new(:make, :model)
|
@@ -341,8 +345,8 @@ vehicles = VehicleDSL.parse_dsl("
|
|
341
345
|
```
|
342
346
|
|
343
347
|
`vehicles` is an `Array` with a `Car` and a `Truck` in it, in that order. If your
|
344
|
-
DSL snippet has only one item, you get back that item. If it
|
345
|
-
you get back an `Array` with everything in the right order.
|
348
|
+
DSL snippet has only one item, you get back an Array with just that item. If it
|
349
|
+
has multiple items, you get back an `Array` with everything in the right order.
|
346
350
|
|
347
351
|
## API
|
348
352
|
|
@@ -394,11 +398,12 @@ This creates global helpers that are available at every level of your DSLs.
|
|
394
398
|
* `parse_dsl(String)` / `execute_dsl(&block)`
|
395
399
|
|
396
400
|
You call this on your DSL class when you're ready to invoke your DSL. It will
|
397
|
-
return whatever the block provided to `add_entrypoint()`
|
401
|
+
return an array containing whatever the block provided to `add_entrypoint()`
|
402
|
+
returns.
|
398
403
|
|
399
|
-
|
400
|
-
|
401
|
-
|
404
|
+
It returns an array for the case of multiple DSL entrypoints (for example, a
|
405
|
+
normal Chef recipe). The array will contain the values in the order they were
|
406
|
+
encountered.
|
402
407
|
|
403
408
|
### Type Coercions
|
404
409
|
|
@@ -444,7 +449,6 @@ $ gem install dsl_maker
|
|
444
449
|
|
445
450
|
## TODO
|
446
451
|
|
447
|
-
* Add support for Arrays (ArrayOf[Type]?)
|
448
452
|
* Add support for generating useful errors (ideally with line numbers ... ?)
|
449
453
|
* Add support for auto-generating documentation
|
450
454
|
* Add default block that returns a Struct-of-Structs named after entrypoints
|
data/lib/dsl/maker.rb
CHANGED
@@ -109,7 +109,7 @@ class DSL::Maker
|
|
109
109
|
raise 'Must call add_entrypoint before parse_dsl' unless @klass
|
110
110
|
raise 'String required for parse_dsl' unless dsl.instance_of? String
|
111
111
|
|
112
|
-
run_dsl
|
112
|
+
run_dsl { eval dsl, @klass.new.get_binding }
|
113
113
|
end
|
114
114
|
|
115
115
|
# Execute the DSL provided in the block.
|
@@ -124,7 +124,7 @@ class DSL::Maker
|
|
124
124
|
raise 'Must call add_entrypoint before execute_dsl' unless @klass
|
125
125
|
raise 'Block required for execute_dsl' unless block_given?
|
126
126
|
|
127
|
-
run_dsl
|
127
|
+
run_dsl { @klass.new.instance_eval(&block) }
|
128
128
|
end
|
129
129
|
|
130
130
|
# This adds a type coercion that's used when creating the DSL.
|
@@ -416,9 +416,6 @@ class DSL::Maker
|
|
416
416
|
|
417
417
|
yield
|
418
418
|
|
419
|
-
if @accumulator.length <= 1
|
420
|
-
return @accumulator[0]
|
421
|
-
end
|
422
419
|
return @accumulator
|
423
420
|
end
|
424
421
|
|
data/lib/dsl/maker/version.rb
CHANGED
data/spec/alias_type_spec.rb
CHANGED
@@ -22,7 +22,7 @@ describe "Packager DSL AliasOf" do
|
|
22
22
|
pizza = dsl_class.execute_dsl {
|
23
23
|
pizza { cheese yes }
|
24
24
|
}
|
25
|
-
verify_pizza(pizza, :cheese => true)
|
25
|
+
verify_pizza(pizza[0], :cheese => true)
|
26
26
|
end
|
27
27
|
|
28
28
|
it "can alias multiple times" do
|
@@ -39,7 +39,7 @@ describe "Packager DSL AliasOf" do
|
|
39
39
|
pizza = dsl_class.execute_dsl {
|
40
40
|
pizza { fromage yes }
|
41
41
|
}
|
42
|
-
verify_pizza(pizza, :cheese => true)
|
42
|
+
verify_pizza(pizza[0], :cheese => true)
|
43
43
|
end
|
44
44
|
|
45
45
|
it "can have many different aliases" do
|
@@ -60,7 +60,7 @@ describe "Packager DSL AliasOf" do
|
|
60
60
|
bacon yes
|
61
61
|
}
|
62
62
|
}
|
63
|
-
verify_pizza(pizza, :cheese => true, :bacon => true)
|
63
|
+
verify_pizza(pizza[0], :cheese => true, :bacon => true)
|
64
64
|
end
|
65
65
|
|
66
66
|
it "can alias a DSL" do
|
@@ -86,6 +86,6 @@ describe "Packager DSL AliasOf" do
|
|
86
86
|
}
|
87
87
|
}
|
88
88
|
}
|
89
|
-
verify_pizza(pizza, :cheese => Structs::Cheese.new('mozzarrella', 'white'))
|
89
|
+
verify_pizza(pizza[0], :cheese => Structs::Cheese.new('mozzarrella', 'white'))
|
90
90
|
end
|
91
91
|
end
|
data/spec/args_spec.rb
CHANGED
@@ -16,7 +16,7 @@ describe "A DSL with argument handling describing fruit" do
|
|
16
16
|
it "can handle nil" do
|
17
17
|
fruit = dsl_class.parse_dsl("
|
18
18
|
fruit {}
|
19
|
-
")
|
19
|
+
")[0]
|
20
20
|
expect(fruit).to be_instance_of(Structs::Fruit)
|
21
21
|
expect(fruit.name).to be_nil
|
22
22
|
end
|
@@ -24,7 +24,7 @@ describe "A DSL with argument handling describing fruit" do
|
|
24
24
|
it "can handle the name in the attribute" do
|
25
25
|
fruit = dsl_class.parse_dsl("
|
26
26
|
fruit { name 'banana' }
|
27
|
-
")
|
27
|
+
")[0]
|
28
28
|
expect(fruit).to be_instance_of(Structs::Fruit)
|
29
29
|
expect(fruit.name).to eq('banana')
|
30
30
|
end
|
@@ -32,7 +32,7 @@ describe "A DSL with argument handling describing fruit" do
|
|
32
32
|
it "can handle the name in the args" do
|
33
33
|
fruit = dsl_class.parse_dsl("
|
34
34
|
fruit 'banana'
|
35
|
-
")
|
35
|
+
")[0]
|
36
36
|
expect(fruit).to be_instance_of(Structs::Fruit)
|
37
37
|
expect(fruit.name).to eq('banana')
|
38
38
|
end
|
@@ -43,7 +43,7 @@ describe "A DSL with argument handling describing fruit" do
|
|
43
43
|
fruit 'buh-nana!' do
|
44
44
|
name 'banana'
|
45
45
|
end
|
46
|
-
")
|
46
|
+
")[0]
|
47
47
|
expect(fruit).to be_instance_of(Structs::Fruit)
|
48
48
|
expect(fruit.name).to eq('banana')
|
49
49
|
end
|
@@ -67,7 +67,7 @@ describe "A DSL with argument handling describing fruit" do
|
|
67
67
|
it "can handle no arguments" do
|
68
68
|
fruit = dsl_class.parse_dsl("
|
69
69
|
fruit {}
|
70
|
-
")
|
70
|
+
")[0]
|
71
71
|
expect(fruit).to be_instance_of(Structs::Fruit)
|
72
72
|
expect(fruit.name).to be_nil
|
73
73
|
expect(fruit.color).to be_nil
|
@@ -79,7 +79,7 @@ describe "A DSL with argument handling describing fruit" do
|
|
79
79
|
fruit('banana') {
|
80
80
|
color 'yellow'
|
81
81
|
}
|
82
|
-
")
|
82
|
+
")[0]
|
83
83
|
expect(fruit).to be_instance_of(Structs::Fruit)
|
84
84
|
expect(fruit.name).to eq('banana')
|
85
85
|
expect(fruit.color).to eq('yellow')
|
@@ -89,7 +89,7 @@ describe "A DSL with argument handling describing fruit" do
|
|
89
89
|
fruit 'plantain' do
|
90
90
|
color 'green'
|
91
91
|
end
|
92
|
-
")
|
92
|
+
")[0]
|
93
93
|
expect(fruit).to be_instance_of(Structs::Fruit)
|
94
94
|
expect(fruit.name).to eq('plantain')
|
95
95
|
expect(fruit.color).to eq('green')
|
@@ -98,7 +98,7 @@ describe "A DSL with argument handling describing fruit" do
|
|
98
98
|
it "can handle everything in the args" do
|
99
99
|
fruit = dsl_class.parse_dsl("
|
100
100
|
fruit 'banana', 'yellow'
|
101
|
-
")
|
101
|
+
")[0]
|
102
102
|
expect(fruit).to be_instance_of(Structs::Fruit)
|
103
103
|
expect(fruit.name).to eq('banana')
|
104
104
|
expect(fruit.color).to eq('yellow')
|
@@ -130,7 +130,7 @@ describe "A DSL with argument handling describing fruit" do
|
|
130
130
|
name 'yellow'
|
131
131
|
}
|
132
132
|
end
|
133
|
-
")
|
133
|
+
")[0]
|
134
134
|
expect(fruit).to be_instance_of(Structs::Fruit)
|
135
135
|
expect(fruit.name).to eq('banana')
|
136
136
|
expect(fruit.color).to be_instance_of(Structs::Color)
|
@@ -142,7 +142,7 @@ describe "A DSL with argument handling describing fruit" do
|
|
142
142
|
fruit 'banana' do
|
143
143
|
color 'yellow'
|
144
144
|
end
|
145
|
-
")
|
145
|
+
")[0]
|
146
146
|
expect(fruit).to be_instance_of(Structs::Fruit)
|
147
147
|
expect(fruit.name).to eq('banana')
|
148
148
|
expect(fruit.color).to be_instance_of(Structs::Color)
|
@@ -156,7 +156,7 @@ describe "A DSL with argument handling describing fruit" do
|
|
156
156
|
name 'green'
|
157
157
|
end
|
158
158
|
end
|
159
|
-
")
|
159
|
+
")[0]
|
160
160
|
expect(fruit).to be_instance_of(Structs::Fruit)
|
161
161
|
expect(fruit.name).to eq('banana')
|
162
162
|
expect(fruit.color).to be_instance_of(Structs::Color)
|
data/spec/array_type_spec.rb
CHANGED
@@ -23,14 +23,14 @@ describe "Packager DSL ArrayOf" do
|
|
23
23
|
cheeses 'mozzarrella'
|
24
24
|
}
|
25
25
|
}
|
26
|
-
verify_pizza(pizza, :cheese => %w(cheddar mozzarrella))
|
26
|
+
verify_pizza(pizza[0], :cheese => %w(cheddar mozzarrella))
|
27
27
|
|
28
28
|
pizza = dsl_class.execute_dsl {
|
29
29
|
pizza {
|
30
30
|
cheeses 'cheddar', 'mozzarrella'
|
31
31
|
}
|
32
32
|
}
|
33
|
-
verify_pizza(pizza, :cheese => %w(cheddar mozzarrella))
|
33
|
+
verify_pizza(pizza[0], :cheese => %w(cheddar mozzarrella))
|
34
34
|
end
|
35
35
|
|
36
36
|
it "can array a DSL" do
|
@@ -62,7 +62,7 @@ describe "Packager DSL ArrayOf" do
|
|
62
62
|
}
|
63
63
|
}
|
64
64
|
}
|
65
|
-
verify_pizza(pizza, :cheese => [
|
65
|
+
verify_pizza(pizza[0], :cheese => [
|
66
66
|
Structs::Cheese.new('mozzarrella', 'white'),
|
67
67
|
Structs::Cheese.new('cheddar', 'orange'),
|
68
68
|
])
|
@@ -127,7 +127,7 @@ describe "Packager DSL ArrayOf" do
|
|
127
127
|
end
|
128
128
|
}
|
129
129
|
}
|
130
|
-
verify_pizza(pizza, :cheese => [
|
130
|
+
verify_pizza(pizza[0], :cheese => [
|
131
131
|
Structs::Cheese.new('mozzarrella', 'white'),
|
132
132
|
Structs::Cheese.new('cheddar', 'orange'),
|
133
133
|
])
|
@@ -29,7 +29,7 @@ describe "Passing a class into generate_dsl" do
|
|
29
29
|
size 26
|
30
30
|
end
|
31
31
|
end
|
32
|
-
end
|
32
|
+
end[0]
|
33
33
|
expect(car).to be_instance_of(Structs::Car)
|
34
34
|
expect(car.maker).to eq('honda')
|
35
35
|
expect(car.wheel).to be_instance_of(Structs::Wheel)
|
@@ -70,7 +70,7 @@ describe "Passing a class into generate_dsl" do
|
|
70
70
|
size 26
|
71
71
|
end
|
72
72
|
end
|
73
|
-
end
|
73
|
+
end[0]
|
74
74
|
expect(car).to be_instance_of(Structs::Car)
|
75
75
|
expect(car.maker).to eq('honda')
|
76
76
|
expect(car.wheel).to be_instance_of(Structs::Wheel)
|
data/spec/helper_spec.rb
CHANGED
@@ -18,7 +18,7 @@ describe "A DSL with helpers" do
|
|
18
18
|
car {
|
19
19
|
maker transform('Honda')
|
20
20
|
}
|
21
|
-
")
|
21
|
+
")[0]
|
22
22
|
expect(car).to be_instance_of(Structs::Car)
|
23
23
|
expect(car.maker).to eq('HONDA')
|
24
24
|
end
|
@@ -51,7 +51,7 @@ describe "A DSL with helpers" do
|
|
51
51
|
maker transform2('goodyear')
|
52
52
|
}
|
53
53
|
}
|
54
|
-
")
|
54
|
+
")[0]
|
55
55
|
expect(car).to be_instance_of(Structs::Car)
|
56
56
|
expect(car.maker).to eq('Honda')
|
57
57
|
expect(car.wheel).to be_instance_of(Structs::Wheel)
|
data/spec/multi_level_spec.rb
CHANGED
@@ -18,7 +18,7 @@ describe 'A multi-level DSL making family-trees' do
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
person = dsl_class.parse_dsl('person { name "Tom" }')
|
21
|
+
person = dsl_class.parse_dsl('person { name "Tom" }')[0]
|
22
22
|
expect(person).to be_instance_of(Structs::Person)
|
23
23
|
expect(person.name).to eq('Tom')
|
24
24
|
expect(person.child).to be_nil
|
@@ -45,7 +45,7 @@ describe 'A multi-level DSL making family-trees' do
|
|
45
45
|
name 'Bill'
|
46
46
|
}
|
47
47
|
}
|
48
|
-
")
|
48
|
+
")[0]
|
49
49
|
expect(person).to be_instance_of(Structs::Person)
|
50
50
|
expect(person.name).to eq('Tom')
|
51
51
|
expect(person.child).to be_instance_of(Structs::Person)
|
@@ -81,7 +81,7 @@ describe 'A multi-level DSL making family-trees' do
|
|
81
81
|
}
|
82
82
|
}
|
83
83
|
}
|
84
|
-
")
|
84
|
+
")[0]
|
85
85
|
expect(person).to be_instance_of(Structs::Person)
|
86
86
|
expect(person.name).to eq('Tom')
|
87
87
|
expect(person.child).to be_instance_of(Structs::Person)
|
@@ -137,7 +137,7 @@ describe 'A multi-level DSL making family-trees' do
|
|
137
137
|
}
|
138
138
|
}
|
139
139
|
}
|
140
|
-
")
|
140
|
+
")[0]
|
141
141
|
|
142
142
|
[
|
143
143
|
'Adam', 'Seth', 'Enos', 'Cainan', 'Mahalaleel', 'Jared',
|
@@ -170,7 +170,7 @@ describe 'A multi-level DSL making family-trees' do
|
|
170
170
|
name 'Tom Smith'
|
171
171
|
}
|
172
172
|
}
|
173
|
-
")
|
173
|
+
")[0]
|
174
174
|
|
175
175
|
expect(person).to be_instance_of(Structs::OtherPerson)
|
176
176
|
expect(person.name).to eq('John Smith')
|
data/spec/single_level_spec.rb
CHANGED
@@ -28,7 +28,7 @@ describe 'A single-level DSL for pizza' do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
pizza = dsl_class.parse_dsl('')
|
31
|
-
expect(pizza).to be(nil)
|
31
|
+
expect(pizza[0]).to be(nil)
|
32
32
|
end
|
33
33
|
|
34
34
|
it 'with :execute_dsl' do
|
@@ -39,7 +39,7 @@ describe 'A single-level DSL for pizza' do
|
|
39
39
|
end
|
40
40
|
|
41
41
|
pizza = dsl_class.execute_dsl {}
|
42
|
-
expect(pizza).to be(nil)
|
42
|
+
expect(pizza[0]).to be(nil)
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
@@ -51,7 +51,7 @@ describe 'A single-level DSL for pizza' do
|
|
51
51
|
end
|
52
52
|
|
53
53
|
pizza = dsl_class.parse_dsl('pizza {}')
|
54
|
-
verify_pizza(pizza)
|
54
|
+
verify_pizza(pizza[0])
|
55
55
|
end
|
56
56
|
|
57
57
|
# This tests all the possible Boolean invocations
|
@@ -68,39 +68,39 @@ describe 'A single-level DSL for pizza' do
|
|
68
68
|
# retrieve the value from within the DSL. Therefore, we assume it's a getter
|
69
69
|
# and don't default the value to true. Otherwise, false values wouldn't work.
|
70
70
|
pizza = dsl_class.parse_dsl('pizza { cheese }')
|
71
|
-
verify_pizza(pizza, :cheese => false)
|
71
|
+
verify_pizza(pizza[0], :cheese => false)
|
72
72
|
|
73
73
|
# Test the Ruby booleans and falsey's.
|
74
74
|
[ true, false, nil ].each do |cheese|
|
75
75
|
pizza = dsl_class.parse_dsl("pizza { cheese #{cheese} }")
|
76
|
-
verify_pizza(pizza, :cheese => !!cheese)
|
76
|
+
verify_pizza(pizza[0], :cheese => !!cheese)
|
77
77
|
end
|
78
78
|
|
79
79
|
# Test the true values we provide
|
80
80
|
%w(Yes On True yes on).each do |cheese|
|
81
81
|
pizza = dsl_class.parse_dsl("pizza { cheese #{cheese} }")
|
82
|
-
verify_pizza(pizza, :cheese => true)
|
82
|
+
verify_pizza(pizza[0], :cheese => true)
|
83
83
|
end
|
84
84
|
|
85
85
|
# Test the false values we provide
|
86
86
|
%w(No Off False no off).each do |cheese|
|
87
87
|
pizza = dsl_class.parse_dsl("pizza { cheese #{cheese} }")
|
88
|
-
verify_pizza(pizza, :cheese => false)
|
88
|
+
verify_pizza(pizza[0], :cheese => false)
|
89
89
|
end
|
90
90
|
|
91
91
|
# Test the boolean-ized strings we provide
|
92
92
|
%w(Yes On True yes on true).each do |cheese|
|
93
93
|
pizza = dsl_class.parse_dsl("pizza { cheese '#{cheese}' }")
|
94
|
-
verify_pizza(pizza, :cheese => true)
|
94
|
+
verify_pizza(pizza[0], :cheese => true)
|
95
95
|
end
|
96
96
|
%w(No Off False no off false nil).each do |cheese|
|
97
97
|
pizza = dsl_class.parse_dsl("pizza { cheese '#{cheese}' }")
|
98
|
-
verify_pizza(pizza, :cheese => false)
|
98
|
+
verify_pizza(pizza[0], :cheese => false)
|
99
99
|
end
|
100
100
|
|
101
101
|
# Test some other things which should all be true
|
102
102
|
pizza = dsl_class.parse_dsl("pizza { cheese 5 }")
|
103
|
-
verify_pizza(pizza, :cheese => true)
|
103
|
+
verify_pizza(pizza[0], :cheese => true)
|
104
104
|
end
|
105
105
|
|
106
106
|
it 'makes a saucy pizza' do
|
@@ -121,7 +121,7 @@ describe 'A single-level DSL for pizza' do
|
|
121
121
|
else
|
122
122
|
raise "Unexpected class #{level.class}"
|
123
123
|
end
|
124
|
-
verify_pizza(pizza, :sauce => level.to_s)
|
124
|
+
verify_pizza(pizza[0], :sauce => level.to_s)
|
125
125
|
end
|
126
126
|
end
|
127
127
|
|
@@ -147,7 +147,7 @@ describe 'A single-level DSL for pizza' do
|
|
147
147
|
sauce :extra
|
148
148
|
}
|
149
149
|
")
|
150
|
-
verify_pizza(pizza,
|
150
|
+
verify_pizza(pizza[0],
|
151
151
|
:sauce => 'extra',
|
152
152
|
:pepperoni => true,
|
153
153
|
:bacon => false,
|
@@ -177,7 +177,7 @@ describe 'A single-level DSL for pizza' do
|
|
177
177
|
sauce :extra
|
178
178
|
}
|
179
179
|
end
|
180
|
-
verify_pizza(pizza,
|
180
|
+
verify_pizza(pizza[0],
|
181
181
|
:sauce => 'extra',
|
182
182
|
:pepperoni => true,
|
183
183
|
:bacon => false,
|