macros4cuke 0.3.35 → 0.3.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/.yardopts +1 -1
- data/CHANGELOG.md +10 -0
- data/README.md +23 -2
- data/lib/macros4cuke/constants.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NGI3ZmQ3ZjBhZjE1MjY0ZTNkNmQ3YzVlZDdiZGUxMzJmZGViNzVhNA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OGM1ZTRjNzUyNGZmYTNhYmMxZDYwM2ViNGYxNDc3NTA1YWYzZDMzMA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MmQ3MjM3ZWU4MjVmZjg0NmMwOWQyYWRkMjBiNjMxYmYyZjdhNDI1NzhlMzRk
|
10
|
+
ODAyMDdlM2NkOGZmZjVjM2YwMDE4NDMyNjVmNzNiMTAwMDMxNDM3NjZjZjQz
|
11
|
+
YTFhZWRkZTFiZDlkNTQwNjhhYjVlYjJjYzg4YTUxMzc2MjA4OWY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YWZjMWJkOThhMjIxMDVjNzYyNmI3ZTM0NzM1ZTQwYmQ1Nzk3ZmY4YWE3M2Y0
|
14
|
+
ODQzMzk0YjZmZjM0MzJhNTU1MTQ3MmM4NWMxMzc4MDgzY2QyOWE4N2IwYmYz
|
15
|
+
ZjRkZjE1ZTNmZTMyOTIzOTQxMWFhMTU2MDM3M2Q5OTlkNTU3ZTE=
|
data/.yardopts
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
### 0.3.37 / 2013-06-27
|
2
|
+
* [FIX] File `macros4cuke.gemspec`: added README.md in extra_rdoc_files option.
|
3
|
+
* [CHANGE] File `README.md`: Re-formatting so that it is better rendered with darkfish (from YARD).
|
4
|
+
* [CHANGE] File `.yardopts` : grouped the exclude options on one line.
|
5
|
+
|
6
|
+
### 0.3.36 / 2013-06-27
|
7
|
+
* [FIX] File `macros4cuke.gemspec`: corrected the rdoc_options to exclude doc from examples, features and spec folders.
|
8
|
+
This was necessary because all but the latest versions of RDoc have difficulties to cope with utf-8.
|
9
|
+
* [CHANGE] File `.yardopts` : added more folders to exclude from documentation generation.
|
10
|
+
|
1
11
|
### 0.3.35 / 2013-06-27
|
2
12
|
* [CHANGE] File `macros4cuke.gemspec`: added rdoc_options to exclude doc from examples, features and spec folders.
|
3
13
|
This was necessary because all but the latest versions of RDoc have difficulties to cope with utf-8.
|
data/README.md
CHANGED
@@ -23,6 +23,7 @@ __Macros4Cuke__ is a lightweight library that adds a macro facility your Cucumbe
|
|
23
23
|
|
24
24
|
## A quick example ##
|
25
25
|
Here is a macro-step example taken from our demo files:
|
26
|
+
|
26
27
|
```cucumber
|
27
28
|
Given I define the step "When I [enter my userid <userid> and password <password>]" to mean:
|
28
29
|
"""
|
@@ -41,11 +42,13 @@ the macro-step is invoked(used) elsewhere in a feature file.
|
|
41
42
|
|
42
43
|
|
43
44
|
That macro-step can then be used in a scenario like this:
|
45
|
+
|
44
46
|
```cucumber
|
45
47
|
When I [enter my userid "jdoe" and password "hello-world"]
|
46
48
|
```
|
47
49
|
|
48
50
|
Once it is executing, the macro-step as the same effect as:
|
51
|
+
|
49
52
|
```cucumber
|
50
53
|
Given I landed in the homepage
|
51
54
|
When I click "Sign in"
|
@@ -107,6 +110,7 @@ Let's begin by taking a closer look at the definition part.
|
|
107
110
|
To create a macro-step, you'll need to use a __defining__ step bundled with Macros4Cuke.
|
108
111
|
It is a rather unusual Cucumber step in the sense that its sole purpose is to build another step!
|
109
112
|
The _defining step_ follows the general pattern:
|
113
|
+
|
110
114
|
```cucumber
|
111
115
|
Given I define the step "When I [some phrase]" to mean:
|
112
116
|
"""
|
@@ -139,6 +143,7 @@ A few remarks about the __phrase__ part:
|
|
139
143
|
Besides that, the text inside the phrase can be arbitrary (well, almost).
|
140
144
|
|
141
145
|
A phrase can be without argument as in:
|
146
|
+
|
142
147
|
```cucumber
|
143
148
|
# A phrase without argument
|
144
149
|
[enter my credentials]
|
@@ -146,6 +151,7 @@ A phrase can be without argument as in:
|
|
146
151
|
|
147
152
|
Alternatively, a phrase can have one or more arguments enclosed between chevrons <...>.
|
148
153
|
For instance, the next first phrase has two arguments, the second has three arguments:
|
154
|
+
|
149
155
|
```cucumber
|
150
156
|
[enter my <userid> and <password>]
|
151
157
|
[travel from <origin> to <destination> via <waypoint>]
|
@@ -159,6 +165,7 @@ the argument names are: _origin_ and _destination_. Notice that _origin_ and _de
|
|
159
165
|
#### Specifying the sub-steps of a macro-step ####
|
160
166
|
The sub-steps are placed in a Gherkin multiline text, that is, a text that is enclosed between
|
161
167
|
triple quotes ("""). In the next example,
|
168
|
+
|
162
169
|
```cucumber
|
163
170
|
Given I define the step "When I [enter my credentials]" to mean:
|
164
171
|
"""
|
@@ -173,6 +180,7 @@ the text between triple quotes enumerates the sub-steps associated with the macr
|
|
173
180
|
A pleasing aspect is the familiar syntax the sub-steps have: they closely look to genuine steps of a scenario.
|
174
181
|
Sub-steps can also have macro arguments.
|
175
182
|
For instance, the previous step sequence could have two arguments called _userid_ and _password_:
|
183
|
+
|
176
184
|
```cucumber
|
177
185
|
"""
|
178
186
|
Given I landed in the homepage
|
@@ -190,6 +198,7 @@ The syntax rules for using a given macro-step in a scenario are pretty straightf
|
|
190
198
|
|
191
199
|
#### Example 1: ####
|
192
200
|
Consider the following macro-step definition:
|
201
|
+
|
193
202
|
```cucumber
|
194
203
|
Given I define the step "When I [log in as <userid>]" to mean:
|
195
204
|
"""
|
@@ -199,6 +208,7 @@ Consider the following macro-step definition:
|
|
199
208
|
|
200
209
|
Its quoted sentence is ```"When I [log in as <userid>]"```, therefore
|
201
210
|
the macro-step can be invoked in a scenario like this:
|
211
|
+
|
202
212
|
```cucumber
|
203
213
|
Given I do this ...
|
204
214
|
When I [log in as "jdoe"]
|
@@ -207,6 +217,7 @@ Its quoted sentence is ```"When I [log in as <userid>]"```, therefore
|
|
207
217
|
|
208
218
|
#### Example 2: ####
|
209
219
|
Here is another -partial- macro-step definition:
|
220
|
+
|
210
221
|
```cucumber
|
211
222
|
Given I define the step "When I [travel from <origin> to <destination> via <stop>]" to mean:
|
212
223
|
"""
|
@@ -215,6 +226,7 @@ Here is another -partial- macro-step definition:
|
|
215
226
|
```
|
216
227
|
|
217
228
|
This macro-step can occur in a scenario as:
|
229
|
+
|
218
230
|
```cucumber
|
219
231
|
When I [travel from "San Francisco" to "New-York" via "Las Vegas"]
|
220
232
|
```
|
@@ -231,6 +243,7 @@ To enable this mechanism for a given macro, ensure that in its definition the qu
|
|
231
243
|
a terminating colon (:) character.
|
232
244
|
|
233
245
|
The next example is based on one of the demo feature files:
|
246
|
+
|
234
247
|
```cucumber
|
235
248
|
# Next step has a colon ':' after the ']': data can be passed with a table
|
236
249
|
Given I define the step "When I [enter my address as follows]:" to mean:
|
@@ -245,6 +258,7 @@ The next example is based on one of the demo feature files:
|
|
245
258
|
```
|
246
259
|
|
247
260
|
This step can be used like this:
|
261
|
+
|
248
262
|
```cucumber
|
249
263
|
When I [enter my address as follows]:"
|
250
264
|
|lastname|Doe|
|
@@ -273,6 +287,7 @@ __\!"'\#$%\&\*\+\-/,\.\:\;\=\?\(\)\<\>\[\]\{\}\\\^\`\|\~__
|
|
273
287
|
### Assigning a value to an argument ###
|
274
288
|
An argument appearing in the phrase MUST always be bound to a value at the step invokation.
|
275
289
|
Taking again a previous example of a -partial- macro-step definition:
|
290
|
+
|
276
291
|
```cucumber
|
277
292
|
Given I define the step "When I [travel from <origin> to <destination> via <stop>]" to mean:
|
278
293
|
"""
|
@@ -281,12 +296,14 @@ Taking again a previous example of a -partial- macro-step definition:
|
|
281
296
|
```
|
282
297
|
|
283
298
|
The following step invokation is invalid:
|
299
|
+
|
284
300
|
```cucumber
|
285
301
|
When I [travel from "San Francisco" to via "Las Vegas"]
|
286
302
|
```
|
287
303
|
|
288
304
|
The issue is: the destination value is missing, Macros4Cuke won't be able to find a step with that syntax.
|
289
305
|
The next invokation is syntactically correct for Macros4Cuke:
|
306
|
+
|
290
307
|
```cucumber
|
291
308
|
When I [travel from "San Francisco" to "" via "Las Vegas"]
|
292
309
|
```
|
@@ -304,6 +321,7 @@ For any argument that can receive a value through a data table, three situations
|
|
304
321
|
- __Answer__: Yes but there is a catch.
|
305
322
|
|
306
323
|
Consider the following attempt of a macro-step definition:
|
324
|
+
|
307
325
|
```cucumber
|
308
326
|
Given I define the step "* I [make a long journey]" to mean:
|
309
327
|
"""
|
@@ -327,6 +345,7 @@ is set to a triple quote sequence """.
|
|
327
345
|
- Use it everywhere you want to place nested triple quotes.
|
328
346
|
|
329
347
|
Thus to make the previous example work, one must change it like follows:
|
348
|
+
|
330
349
|
```cucumber
|
331
350
|
Given I define the step "* I [make a long journey]" to mean:
|
332
351
|
"""
|
@@ -342,7 +361,8 @@ Thus to make the previous example work, one must change it like follows:
|
|
342
361
|
|
343
362
|
## Conditional sections in substeps. ##
|
344
363
|
To make the macros more flexible, it is possible to define conditional sections in the substep sequence.
|
345
|
-
The general pattern for the conditional section is:
|
364
|
+
The general pattern for the conditional section is:
|
365
|
+
|
346
366
|
```cucumber
|
347
367
|
<?foobar>
|
348
368
|
substep1
|
@@ -376,7 +396,8 @@ Consider the following example:
|
|
376
396
|
"""
|
377
397
|
```
|
378
398
|
|
379
|
-
When invoked like this:
|
399
|
+
When invoked like this:
|
400
|
+
|
380
401
|
```cucumber
|
381
402
|
When I [fill in the form with]:
|
382
403
|
|firstname |Alice|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: macros4cuke
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.37
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dimitri Geshef
|
@@ -84,7 +84,8 @@ description: Create your own macro-steps directly in Cucumber scenarios.
|
|
84
84
|
email: famished.tiger@yahoo.com
|
85
85
|
executables: []
|
86
86
|
extensions: []
|
87
|
-
extra_rdoc_files:
|
87
|
+
extra_rdoc_files:
|
88
|
+
- README.md
|
88
89
|
files:
|
89
90
|
- .rubocop.yml
|
90
91
|
- .rspec
|
@@ -151,7 +152,7 @@ post_install_message: ! '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
151
152
|
|
152
153
|
'
|
153
154
|
rdoc_options:
|
154
|
-
- --exclude=examples
|
155
|
+
- --exclude="examples|features|spec"
|
155
156
|
require_paths:
|
156
157
|
- lib
|
157
158
|
required_ruby_version: !ruby/object:Gem::Requirement
|