macros4cuke 0.2.21 → 0.2.22

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.2.22 / 2013-05-08
2
+ [CHANGE] File `README.md`: expanded the section on macro arguments.
3
+
1
4
  ## 0.2.21 / 2013-05-08
2
5
  * [NEW] Added new class `Templating::UnaryElement`.
3
6
  * [CHANGE] Made `Placeholder` class inherit from `UnaryElement`.
data/README.md CHANGED
@@ -245,7 +245,9 @@ Here are few observations worth noticing:
245
245
  the value "Main Street, 22".
246
246
  - Data rows don't have to follow strictly the order of the arguments in the sub-step sequence.
247
247
 
248
- ## Naming macro-step arguments ##
248
+ ## Macro-step arguments ##
249
+
250
+ ### Argument names ###
249
251
  In line with most computer languages, Macros4Cuke accepts argument names containing alphanumeric characters and
250
252
  underscores.
251
253
  In fact, the only characters that are not allowed in argument names are the following punctuation or delimiting
@@ -253,6 +255,36 @@ signs:
253
255
  __\!"'\#$%\&\*\+\-/,\.\:\;\=\?\(\)\<\>\[\]\{\}\\\^\`\|\~__
254
256
 
255
257
 
258
+ ### Assigning a value to an argument ###
259
+ An argument appearing in the phrase MUST always be bound to a value at the step invokation.
260
+ Taking again a previous example of a -partial- macro-step definition:
261
+ ```cucumber
262
+ Given I define the step "When I [travel from <origin> to <destination> via <stop>]" to mean:
263
+ """
264
+ # Sub-steps come here...
265
+ """
266
+ ```
267
+
268
+ The following step invokation is invalid:
269
+ ```cucumber
270
+ When I [travel from "San Francisco" to via "Las Vegas"]
271
+ ```
272
+
273
+ The issue is: the destination value is missing, Macros4Cuke won't be able to find a step with that syntax.
274
+ The next invokation is syntactically correct for Macros4Cuke:
275
+ ```cucumber
276
+ When I [travel from "San Francisco" to "" via "Las Vegas"]
277
+ ```
278
+
279
+ The _destination_ argument gets an empty text as actual value.
280
+
281
+ For any argument that can receive a value through a data table, three situations can occur:
282
+ 1. A row for that argument together with a text value are specified at invokation. The argument is bound to that text value.
283
+ 2. A row for that argument and an empty text value are specified at invokation. The argument is bound to an empty text.
284
+ 3. There is no row for that argument. The argument is unbound (nil) but is rendered as an empty text.
285
+
286
+
287
+
256
288
  ## With great power comes great responsibility. ##
257
289
  _Stan Lee_
258
290
 
@@ -3,7 +3,7 @@
3
3
 
4
4
  module Macros4Cuke # Module used as a namespace
5
5
  # The version number of the gem.
6
- Version = '0.2.21'
6
+ Version = '0.2.22'
7
7
 
8
8
  # Brief description of the gem.
9
9
  Description = "Macros for Cucumber"
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.2.21
4
+ version: 0.2.22
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: