macros4cuke 0.3.37 → 0.3.38
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.rubocop.yml +8 -1
- data/CHANGELOG.md +6 -0
- data/features/demo04.feature +1 -1
- data/features/demo05.feature +1 -1
- data/features/demo06.feature +2 -2
- data/lib/macros4cuke/constants.rb +3 -3
- data/lib/macros4cuke/exceptions.rb +3 -2
- data/lib/macros4cuke/macro-collection.rb +1 -1
- data/lib/macros4cuke/macro-step-support.rb +2 -2
- data/lib/macros4cuke/macro-step.rb +5 -5
- data/lib/macros4cuke/templating/engine.rb +13 -10
- data/spec/macros4cuke/macro-step_spec.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YTdkMzhjY2JkYzQ0MGE1YTMyNWVkZDZiYzliMTUxYzY1ZTU3OTdjZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YmFlNzQ0ODQ1MTQ0MjY0MjkxN2JjNTRlOTFlN2E0ZTRkNWI0YmE2OA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
M2I5ZWJhNTRhMTU0MjM5ZmQ3YzcyNWEwZjMyYTliZmI3YmU5MmEwNjY4OWUz
|
10
|
+
MGM4NzE0MTMyNWQ4OGJjNjUyYzgzYWFlNTM2NzlhZjQ4YzM2NjNlMWMyMjA3
|
11
|
+
NjVhNmMwOWYxYzQ0ZWM5ZGE0MmZmMzQ2NmVhYmNhNTQ0MjUzNjA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NTI4MmIyN2UyMDgxODYxMmZlMWIzMzk5M2JlZDJkMTQzNDQzNThmNDhmYmU3
|
14
|
+
YzdhMmQzZGRmOGY3MGIwMDc1ZmNjM2ZmOTJmMDE5ZDIzYzNhYzYwNjRkMTU4
|
15
|
+
MjE5MjU2N2Q3NmE5YWYwNjhiZDAwZDhkOTUyODllY2JjNjc3YTk=
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
### 0.3.38 / 2013-07-15
|
2
|
+
* [FIX] In method AmbiguousArgumentValue#initialize: An method argument was not string-interpolated in the error message.
|
3
|
+
* [CHANGE] File 'macro-step_spec.rb' Test updated to cope with the previous fix.
|
4
|
+
* [CHANGE] Minor changes in code to please Rubocop 0.9.1
|
5
|
+
* [CHANGE] File `.rubocop.yml` : exclude /examples and /spec folders from Rubocop checks.
|
6
|
+
|
1
7
|
### 0.3.37 / 2013-06-27
|
2
8
|
* [FIX] File `macros4cuke.gemspec`: added README.md in extra_rdoc_files option.
|
3
9
|
* [CHANGE] File `README.md`: Re-formatting so that it is better rendered with darkfish (from YARD).
|
data/features/demo04.feature
CHANGED
@@ -19,7 +19,7 @@ Scenario: Defining a macro to be used with multiple arguments in a table
|
|
19
19
|
And I click "Submit"
|
20
20
|
"""
|
21
21
|
|
22
|
-
Scenario:
|
22
|
+
Scenario: Let's use the macro we created above
|
23
23
|
# Here the macro is invoked. Actual value for the argument are passed in a table argument.
|
24
24
|
When I [enter my credentials as]:
|
25
25
|
|userid|guest|
|
data/features/demo05.feature
CHANGED
@@ -18,7 +18,7 @@ Scenario: Defining a macro to be used with multiple arguments in a table
|
|
18
18
|
And I click "Save"
|
19
19
|
"""
|
20
20
|
|
21
|
-
Scenario:
|
21
|
+
Scenario: Let's use the macro we created above
|
22
22
|
# Here the macro is invoked. Actual value for the argument are passed in a table argument.
|
23
23
|
When I [enter my profile as]:
|
24
24
|
|location|Nowhere-City|
|
data/features/demo06.feature
CHANGED
@@ -28,7 +28,7 @@ Scenario: An exception is forced by invoking the above macro with a triple quote
|
|
28
28
|
When I generate a DataTableNotFound exception
|
29
29
|
|
30
30
|
|
31
|
-
Scenario:
|
31
|
+
Scenario: Let's use the macro-step WITHOUT the optional argument values.
|
32
32
|
When I [fill in the form with]:
|
33
33
|
|firstname|Alice|
|
34
34
|
|lastname| Inn |
|
@@ -51,7 +51,7 @@ Scenario: # Let's use the macro-step WITHOUT the optional argument values.
|
|
51
51
|
"""
|
52
52
|
|
53
53
|
|
54
|
-
Scenario:
|
54
|
+
Scenario: Let's use the macro-step WITH the optional argument values.
|
55
55
|
# Redo, now with e-mail and comment
|
56
56
|
When I [fill in the form with]:
|
57
57
|
|firstname|Alice|
|
@@ -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.3.
|
6
|
+
Version = '0.3.38'
|
7
7
|
|
8
8
|
# Brief description of the gem.
|
9
9
|
Description = 'Macros for Cucumber'
|
@@ -17,8 +17,8 @@ module Macros4Cuke # Module used as a namespace
|
|
17
17
|
# The root folder of Macros4Cuke.
|
18
18
|
RootDir = begin
|
19
19
|
require 'pathname' # Load Pathname class from standard library
|
20
|
-
rootdir = Pathname(__FILE__).dirname.parent.parent.expand_path
|
21
|
-
rootdir.to_s
|
20
|
+
rootdir = Pathname(__FILE__).dirname.parent.parent.expand_path
|
21
|
+
rootdir.to_s + '/' # Append trailing slash character to it
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end # module
|
@@ -40,8 +40,9 @@ end # class
|
|
40
40
|
# and that argument name does not appear in any sub-step.
|
41
41
|
class AmbiguousArgumentValue < Macros4CukeError
|
42
42
|
def initialize(anArgName, valuePhrase, valueTable)
|
43
|
-
|
44
|
-
|
43
|
+
msg1 = "The macro argument '#{anArgName}' has value "
|
44
|
+
msg2 = "'#{valuePhrase}' and '#{valueTable}'."
|
45
|
+
super(msg1 + msg2)
|
45
46
|
end
|
46
47
|
end # class
|
47
48
|
|
@@ -37,7 +37,7 @@ public
|
|
37
37
|
# Multiple rows with same argument name are acceptable.
|
38
38
|
def invoke_macro(aPhraseInstance, rawData = nil)
|
39
39
|
# Generate a text rendition of the step to be executed.
|
40
|
-
collection = MacroCollection.instance
|
40
|
+
collection = MacroCollection.instance
|
41
41
|
rendered_steps = collection.render_steps(aPhraseInstance, rawData)
|
42
42
|
|
43
43
|
# Let Cucumber execute the sub-steps
|
@@ -49,7 +49,7 @@ public
|
|
49
49
|
# After this, we are in the same situation when no macro-step
|
50
50
|
# was ever defined.
|
51
51
|
def clear_macros()
|
52
|
-
MacroCollection.instance.clear
|
52
|
+
MacroCollection.instance.clear
|
53
53
|
end
|
54
54
|
|
55
55
|
end # module
|
@@ -162,12 +162,12 @@ private
|
|
162
162
|
# Return the validated row.
|
163
163
|
# @param a_row [Array] A 2-elements Array (i.e. a couple) of the form:
|
164
164
|
# [macro argument name, a value].
|
165
|
-
# @param
|
166
|
-
def validate_row(a_row,
|
165
|
+
# @param params [Hash] The pairs phrase argument name => value
|
166
|
+
def validate_row(a_row, params)
|
167
167
|
(a_key, value) = a_row
|
168
168
|
raise UnknownArgumentError.new(a_key) unless args.include? a_key
|
169
|
-
if (phrase_args.include? a_key) && (
|
170
|
-
raise AmbiguousArgumentValue.new(a_key,
|
169
|
+
if (phrase_args.include? a_key) && (params[a_key] != value)
|
170
|
+
raise AmbiguousArgumentValue.new(a_key, params[a_key], value)
|
171
171
|
end
|
172
172
|
|
173
173
|
return a_row
|
@@ -236,7 +236,7 @@ private
|
|
236
236
|
end
|
237
237
|
end
|
238
238
|
|
239
|
-
return thePhraseArgs.dup
|
239
|
+
return thePhraseArgs.dup
|
240
240
|
end
|
241
241
|
|
242
242
|
|
@@ -107,7 +107,7 @@ public
|
|
107
107
|
when String
|
108
108
|
actual_value
|
109
109
|
else
|
110
|
-
actual_value.to_s
|
110
|
+
actual_value.to_s
|
111
111
|
end
|
112
112
|
|
113
113
|
return result
|
@@ -231,7 +231,7 @@ class Engine
|
|
231
231
|
# Use concatenation (+) to work around Ruby bug!
|
232
232
|
forbidden = ' !"#' + "$%&'()*+,-./:;<=>?[\\]^`{|}~"
|
233
233
|
all_escaped = []
|
234
|
-
forbidden.each_char
|
234
|
+
forbidden.each_char { |ch| all_escaped << Regexp.escape(ch) }
|
235
235
|
pattern = all_escaped.join('|')
|
236
236
|
Regexp.new(pattern)
|
237
237
|
end
|
@@ -363,7 +363,7 @@ private
|
|
363
363
|
end
|
364
364
|
|
365
365
|
compiled_lines = raw_lines.map { |line| compile_line(line) }
|
366
|
-
return compile_sections(compiled_lines.flatten
|
366
|
+
return compile_sections(compiled_lines.flatten)
|
367
367
|
end
|
368
368
|
|
369
369
|
# Convert the array of raw entries (per line)
|
@@ -405,7 +405,7 @@ private
|
|
405
405
|
# Otherwise, end the line with a eoline marker.
|
406
406
|
def line_rep_ending(theLineRep)
|
407
407
|
if theLineRep.last.is_a?(SectionEndMarker)
|
408
|
-
section_end = theLineRep.pop
|
408
|
+
section_end = theLineRep.pop
|
409
409
|
theLineRep << EOLine.new
|
410
410
|
theLineRep << section_end
|
411
411
|
else
|
@@ -464,7 +464,7 @@ private
|
|
464
464
|
|
465
465
|
when SectionEndMarker
|
466
466
|
validate_section_end(element, open_sections)
|
467
|
-
subResult << open_sections.pop
|
467
|
+
subResult << open_sections.pop
|
468
468
|
|
469
469
|
else
|
470
470
|
if open_sections.empty?
|
@@ -483,15 +483,18 @@ private
|
|
483
483
|
return compiled
|
484
484
|
end
|
485
485
|
|
486
|
-
# Validate the given end of section marker taking into account
|
486
|
+
# Validate the given end of section marker taking into account
|
487
|
+
# the open sections.
|
487
488
|
def validate_section_end(marker, sections)
|
489
|
+
msg_prefix = "End of section</#{marker.name}> "
|
490
|
+
|
488
491
|
if sections.empty?
|
489
|
-
msg =
|
490
|
-
raise StandardError, msg
|
492
|
+
msg = 'found while no corresponding section is open.'
|
493
|
+
raise StandardError, msg_prefix + msg
|
491
494
|
end
|
492
495
|
if marker.name != sections.last.name
|
493
|
-
msg = "
|
494
|
-
raise StandardError, msg
|
496
|
+
msg = "doesn't match current section '#{sections.last.name}'."
|
497
|
+
raise StandardError, msg_prefix + msg
|
495
498
|
end
|
496
499
|
end
|
497
500
|
|
@@ -120,7 +120,7 @@ SNIPPET
|
|
120
120
|
it 'should complain when argument gets a value from phrase and table' do
|
121
121
|
# Error case: there is no macro argument called <unknown>
|
122
122
|
phrase = %Q|enter my credentials as "nobody"|
|
123
|
-
msg = "The macro argument 'userid' has value 'nobody' and '
|
123
|
+
msg = "The macro argument 'userid' has value 'nobody' and 'someone'."
|
124
124
|
args = [ %w(userid someone), %w(password no-secret) ]
|
125
125
|
expect { subject.expand(phrase, args) }.to raise_error(
|
126
126
|
AmbiguousArgumentValue, msg)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.38
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dimitri Geshef
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|
@@ -80,7 +80,7 @@ dependencies:
|
|
80
80
|
- - ! '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 2.0.0
|
83
|
-
description:
|
83
|
+
description: Expand Cucumber with macro-steps.
|
84
84
|
email: famished.tiger@yahoo.com
|
85
85
|
executables: []
|
86
86
|
extensions: []
|