macros4cuke 0.3.24 → 0.3.25
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +63 -55
- data/README.md +34 -0
- data/features/step_definitions/demo_steps.rb +2 -1
- data/lib/macros4cuke/constants.rb +1 -1
- data/lib/macros4cuke/exceptions.rb +11 -0
- data/lib/macros4cuke/macro-step.rb +5 -2
- data/spec/macros4cuke/macro-step_spec.rb +11 -2
- metadata +2 -2
data/CHANGELOG.md
CHANGED
@@ -1,29 +1,37 @@
|
|
1
|
-
|
1
|
+
### 0.3.25 / 2013-05-30
|
2
|
+
* [NEW] File `exceptions.rb`: New exception class AmbiguousArgumentValue.
|
3
|
+
* [CHANGE] Method `MacroStep#validate_params`: an AmbiguousArgumentValue is raised when a macro argument get its value from phrase and data table at the same time.
|
4
|
+
* [CHANGE] File `macro-step_spec.rb`: Added specific test for new exception.
|
5
|
+
* [CHANGE] File `README.md`: Added a pre-requisites section and a FAQ section.
|
6
|
+
* [CHANGE] File `demo_steps.rb`: Removed one Rubocop's complain 'Line is too long'.
|
7
|
+
* [CHANGE] File `CHANGELOG.md`: change in headings style.
|
8
|
+
|
9
|
+
### 0.3.24 / 2013-05-28
|
2
10
|
* [CHANGE] File `.rubocop.yml`: A few new Rubocop 0.8.0 checks are disabled.
|
3
11
|
* [CHANGE] Many source files refactored to satisfy new "cops" from Rubocop 0.8.0
|
4
12
|
|
5
|
-
|
13
|
+
### 0.3.23 / 2013-05-26
|
6
14
|
* [CHANGE] Demo file `table.feature`: Added one scenario combining argument passing via the phrase and table.
|
7
15
|
|
8
|
-
|
16
|
+
### 0.3.22 / 2013-05-25
|
9
17
|
* [CHANGE] File `macro-collection_spec.rb`: Added one test for the `MacroCollection#render_steps` method.
|
10
18
|
|
11
|
-
|
19
|
+
### 0.3.21 / 2013-05-24
|
12
20
|
* [CHANGE] File `.rubocop.yml`: StringLiterals cop is now enabled.
|
13
21
|
* [CHANGE] Many file: replaced double quotes by single quotes in order to pass the StringLiterals Robocop rule.
|
14
22
|
|
15
|
-
|
23
|
+
### 0.3.20 / 2013-05-23
|
16
24
|
* [CHANGE] File `.travis.yml`: Added more CI environments: ruby-head and jruby-head.
|
17
25
|
* [CHANGE] File `Rakefile`: Added task to push gem to Rubygems.
|
18
26
|
|
19
|
-
|
27
|
+
### 0.3.19 / 2013-05-22
|
20
28
|
* [CHANGE] File `.rubocop.yml`: Reduced MethodLength to 30 (lines in a method).
|
21
29
|
* [CHANGE] Method `Engine#compile_line refactored: Extract Method pattern => new method line_rep_ending added.
|
22
30
|
* [CHANGE] Method `Engine#compile_sections refactored: Extract Method pattern => new method validate_section_end added.
|
23
31
|
* [FIX] File `exceptions.rb`: Removal of useless assignment (detected by Rubocop). No runtime impact.
|
24
32
|
|
25
33
|
|
26
|
-
|
34
|
+
### 0.3.18 / 2013-05-21
|
27
35
|
* [FEATURE] Support for sub-steps having multiline text arguments (docstring).
|
28
36
|
* [CHANGE] Method `MacroStep#expand passes` also built-in arguments to template engine.
|
29
37
|
* [CHANGE] Method `MacroStep#validate_phrase_args` does not apply validations on built-in arguments.
|
@@ -31,66 +39,66 @@
|
|
31
39
|
* [NEW] File `multiline.feature` added in examples/features/ folder.
|
32
40
|
* [CHANGE] File `README.md`: Added section 'Sub-steps with multiline text argument'
|
33
41
|
|
34
|
-
|
42
|
+
### 0.3.17 / 2013-05-20
|
35
43
|
* [CHANGE] File `README.md`: Added dynamic dependencies badge (Gemnasium).
|
36
44
|
|
37
|
-
|
45
|
+
### 0.3.16 / 2013-05-20
|
38
46
|
* [CHANGE] File `demo06.feature`: Added a scenario that causes a specific exception to be raised.
|
39
47
|
* [CHANGE] File `demo_steps.rb`: Added a specific step that raises a TableNotException. It is captured and compared to expectations.
|
40
48
|
* [CHANGE] File `engine.rb`: Removed two lines that were never executed.
|
41
49
|
|
42
|
-
|
50
|
+
### 0.3.15 / 2013-05-20
|
43
51
|
* [FIX] File `.CHANGELOG.md` Date entries weren't incremented.
|
44
52
|
* [CHANGE] File `.rubocop.yml`: Added more configuration entries.
|
45
53
|
* [CHANGE] Spec files updated to better please Rubocop.
|
46
54
|
|
47
|
-
|
55
|
+
### 0.3.14 / 2013-05-18
|
48
56
|
* [FIX] lib/ folder in secondary local repository was messed up. Gem was OK.
|
49
57
|
|
50
|
-
|
58
|
+
### 0.3.13 / 2013-05-18
|
51
59
|
* [NEW] File `.rubocop.yml` Added.
|
52
60
|
* [CHANGE] Many source files changed to please Rubocop.
|
53
61
|
|
54
|
-
|
62
|
+
### 0.3.12 / 2013-05-17
|
55
63
|
* [NEW] File `.ruby-gemset` Added (for RVM users).
|
56
64
|
* [NEW] File `.ruby-version` Added (for RVM users).
|
57
65
|
|
58
|
-
|
66
|
+
### 0.3.11 / 2013-05-16
|
59
67
|
* [CHANGE] File `README.md`: Minor reformating.
|
60
68
|
* [CHANGE] File `basic.feature` (in examples/): Added one more macro-step example.
|
61
69
|
|
62
|
-
|
70
|
+
### 0.3.10 / 2013-05-15
|
63
71
|
* [CHANGE] File `README.md`: Expanded section on conditional section.
|
64
72
|
* [CHANGE] Method `Templating::Engine::parse` slightly refactored in order to decrease its complexity.
|
65
73
|
|
66
|
-
|
74
|
+
### 0.3.09 / 2013-05-14
|
67
75
|
* [CHANGE] File `.travis.yml`: Added jruby as a target Ruby
|
68
76
|
|
69
|
-
|
77
|
+
### 0.3.08 / 2013-05-13
|
70
78
|
* [CHANGE] File `README.md`: Added Gem Version badge
|
71
79
|
|
72
|
-
|
80
|
+
### 0.3.07 / 2013-05-12
|
73
81
|
* [CHANGE] File `README.md`: Added Codeclimate badge
|
74
82
|
|
75
|
-
|
83
|
+
### 0.3.06 / 2013-05-12
|
76
84
|
* [FIX] File `README.md`: Fixed formatting issue of Travis CI status badge
|
77
85
|
|
78
|
-
|
86
|
+
### 0.3.05 / 2013-05-12 Unreleased
|
79
87
|
* [CHANGE] File `README.md`: Added Travis CI status badge
|
80
88
|
|
81
|
-
|
89
|
+
### 0.3.04 / 2013-05-12 Unreleased
|
82
90
|
* [NEW] File `.travis.yml`: Added for integration with Travis CI
|
83
91
|
* [NEW] File `Gemfile`: Added for integration with Bundler
|
84
92
|
* [NEW] File `Rakefile`: Added with test tasks
|
85
93
|
* [CHANGE] File `macros4cuke.gemspec`: added development dependency on rake.
|
86
94
|
|
87
|
-
|
95
|
+
### 0.3.03 / 2013-05-11
|
88
96
|
* [CHANGE] File `README.md`: added section on conditional section.
|
89
97
|
|
90
|
-
|
98
|
+
### 0.3.02 / 2013-05-11
|
91
99
|
* [FIX] File `macro_steps.rb`: Recovered. Was missing in the 0.3.01 gem!
|
92
100
|
|
93
|
-
|
101
|
+
### 0.3.01 / 2013-05-10
|
94
102
|
* [NEW] features/ folder: added `demo06.feature` file showing the new conditional section.
|
95
103
|
* [NEW] File `placeholder_spec.rb`: Added a RSpec file to test the Placeholder class.
|
96
104
|
* [CHANGE] File `macro_steps.rb` Macro-step definition accepts the '*' Gherkin keyword.
|
@@ -102,15 +110,15 @@
|
|
102
110
|
* [CHANGE] examples/ folder expanded and reorganized
|
103
111
|
* [FIX] Method `Section#render` fixed typo in call to __method__
|
104
112
|
|
105
|
-
|
113
|
+
### 0.3.00 / 2013-05-09 Version number bumped
|
106
114
|
* [CHANGE] Class `Templating::Engine` can handle conditional tags (TODO: document).
|
107
115
|
* [CHANGE] File `engine_spec.rb`: Added a RSpec examples to test the conditional tags.
|
108
116
|
|
109
117
|
|
110
|
-
|
118
|
+
### 0.2.22 / 2013-05-08
|
111
119
|
[CHANGE] File `README.md`: expanded the section on macro arguments.
|
112
120
|
|
113
|
-
|
121
|
+
### 0.2.21 / 2013-05-08
|
114
122
|
* [NEW] Added new class `Templating::UnaryElement`.
|
115
123
|
* [CHANGE] Made `Placeholder` class inherit from `UnaryElement`.
|
116
124
|
* [NEW] Added new class `Templating::Section`, a subclass of `UnaryElement`.
|
@@ -118,52 +126,52 @@
|
|
118
126
|
* [CHANGE] Method Engine#parse_tag modified in prevision of conditional tags.
|
119
127
|
* [NEW] File `section_spec.rb`: Added a RSpec file to test the Conditional class.
|
120
128
|
|
121
|
-
|
129
|
+
### 0.2.20 / 2013-05-07
|
122
130
|
* [NEW] Added `examples` folder with a first example of an internationalized customisation of __Macros4Cuke__.
|
123
131
|
|
124
|
-
|
132
|
+
### 0.2.19 / 2013-05-07
|
125
133
|
* [CHANGE] Added validation of macro argument names in new `Engine::parse_tag` method.
|
126
134
|
* [CHANGE] InvalidCharError exception added.
|
127
135
|
* [CHANGE] File `engine_spec.rb`: Added one RSpec example for an invalid argument name.
|
128
136
|
* [CHANGE] File `README.md`: added a new section on naming macro arguments.
|
129
137
|
|
130
|
-
|
138
|
+
### 0.2.18 / 2013-05-06
|
131
139
|
* [CHANGE] Amended spec files and added a new demo feature. SimpleCov code coverage raised to more than 97%.
|
132
140
|
* [CHANGE] Macro-step arguments can be multivalued (experimental)
|
133
141
|
|
134
|
-
|
142
|
+
### 0.2.17 / 2013-05-05
|
135
143
|
* [CHANGE] File `engine_spec.rb`: Added more RSpec examples. SimpleCov code coverage raised to more than 96%.
|
136
144
|
* [CHANGE] Added section in README.md
|
137
145
|
|
138
146
|
|
139
|
-
|
147
|
+
### 0.2.16 / 2013-05-04
|
140
148
|
* [FEATURE] Added dependency to SimpleCov. It is used to measure test code coverage (the combination of Cucumber and RSpec result in 95.9% code coverage).
|
141
149
|
* [CHANGE] File `macro-step-support_spec.rb`: Added one RSpec example
|
142
150
|
|
143
|
-
|
151
|
+
### 0.2.15 / 2013-05-03
|
144
152
|
* [CHANGE] File `macro-step-support_spec.rb`: Added one RSpec example.
|
145
153
|
* [FIX] Updated gemspec.
|
146
154
|
|
147
155
|
|
148
|
-
|
156
|
+
### 0.2.14 / 2013-05-03
|
149
157
|
* [CHANGE] Code comments reformatted to YARD. The command line `yard stats`display a 100% documented score!
|
150
158
|
* [CHANGE] Moved all classes related to the template engine to the new module Templating.
|
151
159
|
* [CHANGE] Classes `StaticRep, EOLRep, VariableRep, TemplateEngine` renamed to `StaticText, EOLine, Placeholder, Engine` respectively.
|
152
160
|
* [CHANGE] Added spec file for `MacroStepSupport` module.
|
153
161
|
* [CHANGE] Initialization of `MacroStepSupport` singleton changed (no dependency on `extended` hook).
|
154
162
|
|
155
|
-
|
163
|
+
### 0.2.13 / 2013-05-02
|
156
164
|
* [NEW] File `macro-collection_spec.rb`: partial spec file for the `MacroCollection` class.
|
157
165
|
* [FIX] `DuplicateMacroError#initialize`: Removed superfluous [ in error message.
|
158
166
|
|
159
|
-
|
167
|
+
### 0.2.12 / 2013-05-01
|
160
168
|
* [CHANGE] Method `Macros4Cuke#compile` raise an `EmptyArgumentError` exception when a line contains an empty or blank argument.
|
161
169
|
* [CHANGE] File `template-engine_spec.rb`: Added an example for error case mentioned in previous line.
|
162
170
|
|
163
|
-
|
171
|
+
### 0.2.11 / 2013-05-01
|
164
172
|
* [CHANGE] File `macros4cuke.gemspec`: Removed dependency on Rake.
|
165
173
|
|
166
|
-
|
174
|
+
### 0.2.10 / 2013-04-30
|
167
175
|
|
168
176
|
* [CHANGE] `CHANGELOG.md` replaces `HISTORY.md` file. Partial reformatting of historical entries to [Changelogs Convention](tech-angels.github.com/vandamme/#changelogs-convention)
|
169
177
|
* [CHANGE] Method `MacroStep#initialize`: added the detection of two inconsistencies in macro arguments.
|
@@ -173,13 +181,13 @@
|
|
173
181
|
* [CHANGE] File `macro-step_spec.rb`: Added examples covering the new validation rules in `MacroStep#initialize` method.
|
174
182
|
* [FIX] `UnknownArgumentError#initialize` Typo in error message.
|
175
183
|
|
176
|
-
|
184
|
+
### 0.2.09 / 2013-04-29
|
177
185
|
|
178
186
|
* [CHANGE] Added one capturing group in regexp of macro defining step to detect data passing via table.
|
179
187
|
* [CHANGE] Class `MacroStep`: added an explicit argument for data passing via table mode.
|
180
188
|
|
181
189
|
|
182
|
-
|
190
|
+
### 0.2.08 / 2013-04-29
|
183
191
|
|
184
192
|
* [CHANGE] Signature of `MacroStep#expand` changed.
|
185
193
|
* [CHANGE] `MacroStep#validate_params` method is now private
|
@@ -188,45 +196,45 @@
|
|
188
196
|
* [CHANGE] File `macro-step_spec.rb`: added test case when a macro is called with unknown argument.
|
189
197
|
* [FIX] macro-step.rb: added a missing `require 'exceptions'`.
|
190
198
|
|
191
|
-
|
199
|
+
### 0.2.07 / 2013-04-29
|
192
200
|
|
193
201
|
* [FIX] Editorial improvements in `README.md`, corrected one inaccurate sentence.
|
194
202
|
|
195
203
|
|
196
|
-
|
204
|
+
### 0.2.06 / 2013-04-28
|
197
205
|
|
198
206
|
* [CHANGE] Formatting improvements in `README.md`.
|
199
207
|
|
200
208
|
|
201
|
-
|
209
|
+
### 0.2.05 / 2013-04-28
|
202
210
|
|
203
211
|
* [CHANGE] Expanded `README.md` with macro-step invokation, passing data value via a table.
|
204
212
|
|
205
213
|
|
206
|
-
|
214
|
+
### 0.2.04 / 2013-4-27
|
207
215
|
|
208
216
|
* [FIX] `MacroCollection#add_macro method`: typo correction.
|
209
217
|
|
210
218
|
|
211
|
-
|
219
|
+
### 0.2.03 / Unreleased
|
212
220
|
|
213
221
|
* [CHANGE] Regexp of defining step is more general: it accepts the Gherkin adverbs `Given, When, Then, And`.
|
214
222
|
|
215
223
|
|
216
|
-
|
224
|
+
### 0.2.02 / 2013-4-26
|
217
225
|
|
218
226
|
* [CHANGE] Added an example in `template-engine_spec.rb` file.
|
219
227
|
* [CHANGE] Expanded `README.md` file.
|
220
228
|
|
221
229
|
|
222
|
-
|
230
|
+
### 0.2.01 / 2013-4-26
|
223
231
|
|
224
232
|
* [CHANGE] Regexps in step definitions accept escape character sequence.
|
225
233
|
* [CHANGE] Expanded `README.md` file.
|
226
234
|
* [FIX] Corrected remnant of Mustache template in `travelling_demo.feature` file.
|
227
235
|
|
228
236
|
|
229
|
-
|
237
|
+
### 0.2.00 / 2013-4-25 Version number was bumped
|
230
238
|
|
231
239
|
* [CHANGE] Replaced the Mustache template engine by own lightweight TemplateEngine
|
232
240
|
* [CHANGE] Macro-step arguments have a syntax that is closer to Gherkin's scenario outlines.
|
@@ -236,42 +244,42 @@
|
|
236
244
|
* [CHANGE] examples in `README.md` updated.
|
237
245
|
|
238
246
|
|
239
|
-
|
247
|
+
### 0.1.07 / 2013-4-24
|
240
248
|
|
241
249
|
* [CHANGE] Added new class `TemplateEngine`.
|
242
250
|
|
243
251
|
|
244
|
-
|
252
|
+
### 0.1.06 / 2013-4-24
|
245
253
|
|
246
254
|
* [FIX] Format fix in README.md
|
247
255
|
* [FIX] `HISTORY.md` file updated with missing entries/
|
248
256
|
|
249
257
|
|
250
|
-
|
258
|
+
### 0.1.05 / Unreleased
|
251
259
|
|
252
260
|
* [CHANGE] `demo_steps.rb`. Added few step definitions that emit output to the screen (so that at least something is shown in the demo).
|
253
261
|
* [CHANGE] `MacroStep` class: regexp slightly reworked to accept escaped double quotes in actual values.
|
254
262
|
* [CHANGE] `travelling_demo.feature`: Added one example with escaped quotes in actual value.
|
255
263
|
|
256
264
|
|
257
|
-
|
265
|
+
### 0.1.04 / 2013-4-23
|
258
266
|
|
259
267
|
* [ENHANCEMENT] Gherkin comments are allowed in sub-steps sequence. Previous version supported only Mustache comments.
|
260
268
|
* [CHANGE] Added a few more examples in the `travelling-demo.feature` file.
|
261
269
|
|
262
270
|
|
263
|
-
|
271
|
+
### 0.1.03 / 2013-4-23
|
264
272
|
|
265
273
|
* [CHANGE] `README.md` slightly reworked and added link to Mustache.
|
266
274
|
* [CHANGE] File `env.rb`: moved all dependencies on Macros4Cuke to the file `macro_support.rb`
|
267
275
|
* [CHANGE] File `travelling-demo.feature`: Demo feature file with output on the screen (the other demos don't display any result).
|
268
276
|
|
269
277
|
|
270
|
-
|
278
|
+
### 0.0.02 / 2013-04-21
|
271
279
|
|
272
280
|
* [CHANGE] `README.md`: added a reference to the features folder.
|
273
281
|
|
274
282
|
|
275
|
-
|
283
|
+
### 0.0.01 / 2013-04-21
|
276
284
|
|
277
285
|
* [FEATURE] Initial public working version
|
data/README.md
CHANGED
@@ -59,6 +59,11 @@ Macros4Cuke not only helps in getting rid of the repeated step sequences,
|
|
59
59
|
See also the working examples in the ```features/``` folder.
|
60
60
|
|
61
61
|
## Setup ##
|
62
|
+
### Pre-requisites ###
|
63
|
+
Macros4Cuke works with:
|
64
|
+
- MRI Ruby 1.9.x and 2.0.x.
|
65
|
+
- JRuby (was tested with version 1.7.3 and above).
|
66
|
+
|
62
67
|
### Installation ###
|
63
68
|
To install the macros4cuke gem:
|
64
69
|
```bash
|
@@ -406,6 +411,35 @@ Think of specific UI-events that can trigger some special system response.
|
|
406
411
|
|
407
412
|
|
408
413
|
|
414
|
+
## FAQ ##
|
415
|
+
__Q__: Can I define a macro in one scenario and invoke it in another scenario in the same feature file?
|
416
|
+
__A__: Yes. Once a macro is defined in a feature file it can be invoked in any scenario that follows the definition.
|
417
|
+
In fact, the macro can be invoked in any scenario from any feature file, provided the invokation takes place _after_ the
|
418
|
+
macro definition.
|
419
|
+
|
420
|
+
__Q__: So, a macro can be shared between multiple files.
|
421
|
+
__A__: Indeed. This is similar to genuine step definitions which are global (accessible to every feature files).
|
422
|
+
For macro-steps, again, they can be used anywhere after their definition.
|
423
|
+
|
424
|
+
__Q__: How should I pass arguments: via the phrase or a data table?
|
425
|
+
__A__: Both data passing mechanisms can be used at the same time. Favour data value passing
|
426
|
+
via the phrase when the number of macro arguments is small (say, <= 2).
|
427
|
+
|
428
|
+
__Q__: Can I define a macro-step in a Background section?
|
429
|
+
__A__: No. Here is why: Every step from the Background section is executed in each scenario (outline).
|
430
|
+
If a macro were defined in the Background, then the macro definition will occur multiple times, which is
|
431
|
+
flagged as an error by Macros4Cuke.
|
432
|
+
|
433
|
+
__Q__: Can I define a macro-step in a Scenario Outline?
|
434
|
+
__A__: No, if the scenario outline has multiple rows then an error will occur. Bear in mind,
|
435
|
+
that steps in a scenario outline are repeating n times, n being the number of rows in the example table.
|
436
|
+
Since a macro can only be defined once, placing a macro definition in a scenario outline will
|
437
|
+
most likely cause an error.
|
438
|
+
|
439
|
+
__Q__: Can I invoke/call a macro-step in a Background or Scenario Outline?
|
440
|
+
__A__: Yes. A macro-step can be invoked many times.
|
441
|
+
|
442
|
+
|
409
443
|
|
410
444
|
## With great power comes great responsibility. ##
|
411
445
|
_Stan Lee_
|
@@ -32,7 +32,8 @@ SNIPPET
|
|
32
32
|
begin
|
33
33
|
steps(wrong)
|
34
34
|
rescue Macros4Cuke::DataTableNotFound => exc
|
35
|
-
|
35
|
+
phrase = '[fill in the form with]:'
|
36
|
+
msg = "The step with phrase #{phrase} requires a data table."
|
36
37
|
exc.message.should == msg
|
37
38
|
end
|
38
39
|
end
|
@@ -36,6 +36,17 @@ class UnreachableSubstepArgument < Macros4CukeError
|
|
36
36
|
end # class
|
37
37
|
|
38
38
|
|
39
|
+
# Raised when one passes one value for an argument via the macro-step's phrase
|
40
|
+
# and a value for that same argument via the the data table.
|
41
|
+
# and that argument name does not appear in any sub-step.
|
42
|
+
class AmbiguousArgumentValue < Macros4CukeError
|
43
|
+
def initialize(anArgName, valuePhrase, valueTable)
|
44
|
+
msg = "The macro argument '#{anArgName}' has value '#{valuePhrase}' and 'valueTable'."
|
45
|
+
super(msg)
|
46
|
+
end
|
47
|
+
end # class
|
48
|
+
|
49
|
+
|
39
50
|
|
40
51
|
# Raised when a sub-step has an empty or blank argument name.
|
41
52
|
class EmptyArgumentError < Macros4CukeError
|
@@ -136,14 +136,17 @@ private
|
|
136
136
|
macro_parameters = {}
|
137
137
|
|
138
138
|
# Retrieve the value(s) per variable in the phrase.
|
139
|
-
quoted_values = scan_arguments(aPhrase, :invokation)
|
139
|
+
quoted_values = scan_arguments(aPhrase, :invokation)
|
140
140
|
quoted_values.each_with_index do |val, index|
|
141
141
|
macro_parameters[phrase_args[index]] = val
|
142
142
|
end
|
143
|
-
|
143
|
+
|
144
144
|
unless rawData.nil?
|
145
145
|
rawData.each do |(a_key, value)|
|
146
146
|
raise UnknownArgumentError.new(a_key) unless @args.include? a_key
|
147
|
+
if (phrase_args.include? a_key) && (macro_parameters[a_key] != value)
|
148
|
+
raise AmbiguousArgumentValue.new(a_key, macro_parameters[a_key], value)
|
149
|
+
end
|
147
150
|
if macro_parameters.include? a_key
|
148
151
|
if macro_parameters[a_key].kind_of?(Array)
|
149
152
|
macro_parameters[a_key] << value
|
@@ -67,7 +67,6 @@ end
|
|
67
67
|
context 'Provided services:' do
|
68
68
|
|
69
69
|
let(:phrase_instance) { %Q|enter my credentials as "nobody"| }
|
70
|
-
|
71
70
|
it 'should render the substeps' do
|
72
71
|
text = subject.expand(phrase_instance, [ %w(password no-secret) ])
|
73
72
|
expectation = <<-SNIPPET
|
@@ -117,6 +116,16 @@ SNIPPET
|
|
117
116
|
->(){ subject.expand(phrase_instance, args) }.should raise_error(
|
118
117
|
UnknownArgumentError, error_message)
|
119
118
|
end
|
119
|
+
|
120
|
+
|
121
|
+
it 'should complain when argument gets a value from phrase and table' do
|
122
|
+
# Error case: there is no macro argument called <unknown>
|
123
|
+
phrase = %Q|enter my credentials as "nobody"|
|
124
|
+
msg = "The macro argument 'userid' has value 'nobody' and 'valueTable'."
|
125
|
+
args = [ %w(userid someone), %w(password no-secret) ]
|
126
|
+
->(){ subject.expand(phrase, args) }.should raise_error(
|
127
|
+
AmbiguousArgumentValue, msg)
|
128
|
+
end
|
120
129
|
|
121
130
|
|
122
131
|
it 'should expand built-in variables' do
|
@@ -135,7 +144,7 @@ SNIPPET
|
|
135
144
|
expected = substeps.gsub(/<quotes>/, '"""')
|
136
145
|
actual.should == expected
|
137
146
|
end
|
138
|
-
|
147
|
+
|
139
148
|
|
140
149
|
end # context
|
141
150
|
|
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.25
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cucumber
|