macros4cuke 0.5.07 → 0.5.08
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.rubocop.yml +4 -0
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/Rakefile +0 -2
- data/features/support/use_macros4cuke.rb +11 -0
- data/lib/macros4cuke/application.rb +0 -3
- data/lib/macros4cuke/cli/cmd-line.rb +0 -7
- data/lib/macros4cuke/coll-walker-factory.rb +0 -7
- data/lib/macros4cuke/constants.rb +1 -1
- data/lib/macros4cuke/exceptions.rb +0 -3
- data/lib/macros4cuke/formatter/all-notifications.rb +20 -24
- data/lib/macros4cuke/formatter/to-gherkin.rb +0 -6
- data/lib/macros4cuke/formatter/to-null.rb +70 -79
- data/lib/macros4cuke/formatter/to-trace.rb +64 -70
- data/lib/macros4cuke/formatting-service.rb +0 -3
- data/lib/macros4cuke/macro-collection.rb +0 -3
- data/lib/macros4cuke/macro-step-support.rb +0 -3
- data/lib/macros4cuke/macro-step.rb +1 -4
- data/lib/macros4cuke/templating/comment.rb +37 -43
- data/lib/macros4cuke/templating/engine.rb +4 -14
- data/lib/macros4cuke/templating/eo-line.rb +10 -19
- data/lib/macros4cuke/templating/placeholder.rb +0 -8
- data/lib/macros4cuke/templating/section.rb +0 -11
- data/lib/macros4cuke/templating/static-text.rb +28 -33
- data/lib/macros4cuke/templating/unary-element.rb +0 -4
- data/spec/macros4cuke/application_spec.rb +0 -5
- data/spec/macros4cuke/cli/cmd-line_spec.rb +213 -223
- data/spec/macros4cuke/coll-walker-factory_spec.rb +0 -6
- data/spec/macros4cuke/formatter/to-gherkin_spec.rb +0 -9
- data/spec/macros4cuke/formatter/to-null_spec.rb +0 -6
- data/spec/macros4cuke/formatter/to-trace_spec.rb +0 -6
- data/spec/macros4cuke/formatting-service_spec.rb +0 -5
- data/spec/macros4cuke/macro-collection_spec.rb +1 -8
- data/spec/macros4cuke/macro-step-support_spec.rb +0 -9
- data/spec/macros4cuke/macro-step_spec.rb +0 -7
- data/spec/macros4cuke/templating/comment_spec.rb +0 -7
- data/spec/macros4cuke/templating/engine_spec.rb +0 -10
- data/spec/macros4cuke/templating/eo-line_spec.rb +1 -8
- data/spec/macros4cuke/templating/placeholder_spec.rb +0 -9
- data/spec/macros4cuke/templating/section_spec.rb +0 -13
- data/spec/macros4cuke/templating/static_text_spec.rb +0 -6
- data/spec/macros4cuke/use-sample-collection.rb +0 -3
- metadata +3 -2
@@ -9,7 +9,6 @@ require_relative 'use-sample-collection'
|
|
9
9
|
require_relative '../../lib/macros4cuke/coll-walker-factory'
|
10
10
|
|
11
11
|
module Macros4Cuke # Open this namespace to avoid module qualifier prefixes
|
12
|
-
|
13
12
|
describe CollWalkerFactory do
|
14
13
|
include UseSampleCollection # Add convenience methods for sample collection
|
15
14
|
|
@@ -28,7 +27,6 @@ describe CollWalkerFactory do
|
|
28
27
|
it 'should be created without parameter' do
|
29
28
|
expect { CollWalkerFactory.new }.not_to raise_error
|
30
29
|
end
|
31
|
-
|
32
30
|
end # context
|
33
31
|
|
34
32
|
context 'Provided factory services:' do
|
@@ -247,7 +245,6 @@ describe CollWalkerFactory do
|
|
247
245
|
end
|
248
246
|
end
|
249
247
|
expect { subject.next }.to raise_error(StopIteration)
|
250
|
-
|
251
248
|
end
|
252
249
|
|
253
250
|
# Must be last test script since it pollutes the macro-collection
|
@@ -258,11 +255,8 @@ describe CollWalkerFactory do
|
|
258
255
|
err_msg = "Don't know how to format a Symbol."
|
259
256
|
expect { subject.each { |_| } }.to raise_error(err_type, err_msg)
|
260
257
|
end
|
261
|
-
|
262
258
|
end # context
|
263
|
-
|
264
259
|
end # describe
|
265
|
-
|
266
260
|
end # module
|
267
261
|
|
268
262
|
|
@@ -14,10 +14,7 @@ require_relative '../../../lib/macros4cuke/formatting-service'
|
|
14
14
|
require_relative '../../../lib/macros4cuke/formatter/to-gherkin'
|
15
15
|
|
16
16
|
module Macros4Cuke
|
17
|
-
|
18
17
|
module Formatter # Open this namespace to get rid of module qualifier prefixes
|
19
|
-
|
20
|
-
|
21
18
|
describe ToGherkin do
|
22
19
|
include UseSampleCollection # Add convenience methods for sample collection
|
23
20
|
|
@@ -35,12 +32,10 @@ describe ToGherkin do
|
|
35
32
|
|
36
33
|
|
37
34
|
context 'Creation and initialization:' do
|
38
|
-
|
39
35
|
it 'should be created with an IO object' do
|
40
36
|
an_io = StringIO.new
|
41
37
|
expect { ToGherkin.new(an_io) }.not_to raise_error
|
42
38
|
end
|
43
|
-
|
44
39
|
end # context
|
45
40
|
|
46
41
|
context 'Provided services:' do
|
@@ -117,13 +112,9 @@ SNIPPET
|
|
117
112
|
|
118
113
|
expect(actual_lines).to eq(expected_lines)
|
119
114
|
end
|
120
|
-
|
121
115
|
end # context
|
122
|
-
|
123
116
|
end # describe
|
124
|
-
|
125
117
|
end # module
|
126
|
-
|
127
118
|
end # module
|
128
119
|
|
129
120
|
# End of file
|
@@ -11,9 +11,7 @@ require_relative '../../../lib/macros4cuke/formatting-service'
|
|
11
11
|
require_relative '../../../lib/macros4cuke/formatter/to-null'
|
12
12
|
|
13
13
|
module Macros4Cuke
|
14
|
-
|
15
14
|
module Formatter # Open this namespace to get rid of module qualifier prefixes
|
16
|
-
|
17
15
|
describe ToNull do
|
18
16
|
include UseSampleCollection # Add convenience methods for sample collection
|
19
17
|
|
@@ -37,7 +35,6 @@ describe ToNull do
|
|
37
35
|
instance = ToNull.new
|
38
36
|
expect(instance.implements).to eq(Formatter::AllNotifications)
|
39
37
|
end
|
40
|
-
|
41
38
|
end # context
|
42
39
|
|
43
40
|
|
@@ -51,11 +48,8 @@ describe ToNull do
|
|
51
48
|
expect { service.start!(macro_coll) }.not_to raise_error
|
52
49
|
end
|
53
50
|
end # context
|
54
|
-
|
55
51
|
end # describe
|
56
|
-
|
57
52
|
end # module
|
58
|
-
|
59
53
|
end # module
|
60
54
|
|
61
55
|
|
@@ -12,9 +12,7 @@ require_relative '../../../lib/macros4cuke/formatting-service'
|
|
12
12
|
require_relative '../../../lib/macros4cuke/formatter/to-trace'
|
13
13
|
|
14
14
|
module Macros4Cuke
|
15
|
-
|
16
15
|
module Formatter # Open this namespace to get rid of module qualifier prefixes
|
17
|
-
|
18
16
|
describe ToTrace do
|
19
17
|
include UseSampleCollection # Add convenience methods for sample collection
|
20
18
|
|
@@ -40,7 +38,6 @@ describe ToTrace do
|
|
40
38
|
instance = ToTrace.new(destination)
|
41
39
|
expect(instance.implements).to eq(Formatter::AllNotifications)
|
42
40
|
end
|
43
|
-
|
44
41
|
end # context
|
45
42
|
|
46
43
|
|
@@ -144,11 +141,8 @@ SNIPPET
|
|
144
141
|
expect(subject.io.string).to eq(expected_trace)
|
145
142
|
end
|
146
143
|
end # context
|
147
|
-
|
148
144
|
end # describe
|
149
|
-
|
150
145
|
end # module
|
151
|
-
|
152
146
|
end # module
|
153
147
|
|
154
148
|
|
@@ -10,7 +10,6 @@ require_relative 'use-sample-collection'
|
|
10
10
|
require_relative '../../lib/macros4cuke/formatting-service'
|
11
11
|
|
12
12
|
module Macros4Cuke # Open this namespace to avoid module qualifier prefixes
|
13
|
-
|
14
13
|
describe FormattingService do
|
15
14
|
include UseSampleCollection # Add convenience methods for sample collection
|
16
15
|
|
@@ -36,7 +35,6 @@ describe FormattingService do
|
|
36
35
|
it 'has no formatter at start' do
|
37
36
|
expect(subject.formatters).to be_empty
|
38
37
|
end
|
39
|
-
|
40
38
|
end # context
|
41
39
|
|
42
40
|
|
@@ -133,10 +131,7 @@ describe FormattingService do
|
|
133
131
|
subject.start!(macro_coll)
|
134
132
|
end
|
135
133
|
end # context
|
136
|
-
|
137
|
-
|
138
134
|
end # describe
|
139
|
-
|
140
135
|
end # module
|
141
136
|
|
142
137
|
|
@@ -6,9 +6,7 @@ require_relative '../spec_helper'
|
|
6
6
|
require_relative '../../lib/macros4cuke/macro-collection'
|
7
7
|
|
8
8
|
module Macros4Cuke # Open this namespace to avoid module qualifier prefixes
|
9
|
-
|
10
9
|
describe MacroCollection do
|
11
|
-
|
12
10
|
let(:singleton) { MacroCollection.instance }
|
13
11
|
|
14
12
|
before(:all) do
|
@@ -19,8 +17,7 @@ describe MacroCollection do
|
|
19
17
|
it 'should be empty' do
|
20
18
|
expect(singleton.macro_steps).to be_empty
|
21
19
|
end
|
22
|
-
|
23
|
-
end
|
20
|
+
end # context
|
24
21
|
|
25
22
|
context 'Provided services:' do
|
26
23
|
let(:sample_substeps) do
|
@@ -60,12 +57,8 @@ SNIPPET
|
|
60
57
|
SNIPPET
|
61
58
|
expect(rendered).to eq(expected)
|
62
59
|
end
|
63
|
-
|
64
60
|
end # context
|
65
|
-
|
66
61
|
end # describe
|
67
|
-
|
68
62
|
end # module
|
69
63
|
|
70
|
-
|
71
64
|
# End of file
|
@@ -7,7 +7,6 @@ require_relative '../../lib/macros4cuke/macro-step-support'
|
|
7
7
|
|
8
8
|
|
9
9
|
module Macros4Cuke # Open the module to avoid lengthy qualified names
|
10
|
-
|
11
10
|
# Class created just for testing purposes.
|
12
11
|
class MyWorld
|
13
12
|
include Macros4Cuke::MacroStepSupport
|
@@ -20,8 +19,6 @@ class MyWorld
|
|
20
19
|
@substeps ||= []
|
21
20
|
@substeps << substep_text
|
22
21
|
end
|
23
|
-
|
24
|
-
|
25
22
|
end # class
|
26
23
|
|
27
24
|
describe MacroStepSupport do
|
@@ -71,7 +68,6 @@ SNIPPET
|
|
71
68
|
end # context
|
72
69
|
|
73
70
|
context 'Invoking macro(s):' do
|
74
|
-
|
75
71
|
it 'should complain when invoking an unknown macro-step' do
|
76
72
|
phrase_unknown = 'dream of a perfect world'
|
77
73
|
msg = "Unknown macro-step with phrase: 'dream of a perfect world'."
|
@@ -88,22 +84,17 @@ SNIPPET
|
|
88
84
|
expected_text = m1_substeps.gsub(/<\S+>/, param_assignments)
|
89
85
|
expect(world.substeps.first).to eq(expected_text)
|
90
86
|
end
|
91
|
-
|
92
87
|
end # context
|
93
88
|
|
94
89
|
context 'Clearing macro(s):' do
|
95
|
-
|
96
90
|
it 'should clear all macros' do
|
97
91
|
expect { world.clear_macros }.not_to raise_error
|
98
92
|
|
99
93
|
# Control the post-condition
|
100
94
|
expect(MacroCollection.instance.macro_steps).to be_empty
|
101
95
|
end
|
102
|
-
|
103
96
|
end # context
|
104
|
-
|
105
97
|
end # describe
|
106
|
-
|
107
98
|
end # module
|
108
99
|
|
109
100
|
|
@@ -7,7 +7,6 @@ require_relative '../../lib/macros4cuke/macro-step' # The class under test
|
|
7
7
|
|
8
8
|
|
9
9
|
module Macros4Cuke # Open the module to avoid lengthy qualified names
|
10
|
-
|
11
10
|
describe MacroStep do
|
12
11
|
let(:sample_phrase) { 'enter my credentials as <userid>' }
|
13
12
|
|
@@ -66,12 +65,10 @@ SNIPPET
|
|
66
65
|
it 'should know the tags(placeholders) from its phrase and template' do
|
67
66
|
expect(subject.args).to eq(%w(userid password))
|
68
67
|
end
|
69
|
-
|
70
68
|
end # context
|
71
69
|
|
72
70
|
|
73
71
|
context 'Provided services:' do
|
74
|
-
|
75
72
|
let(:phrase_instance) { 'enter my credentials as "nobody"' }
|
76
73
|
it 'should render the substeps' do
|
77
74
|
text = subject.expand(phrase_instance, [ %w(password no-secret) ])
|
@@ -150,12 +147,8 @@ SNIPPET
|
|
150
147
|
expected = substeps.gsub(/<quotes>/, '"""')
|
151
148
|
expect(actual).to eq(expected)
|
152
149
|
end
|
153
|
-
|
154
|
-
|
155
150
|
end # context
|
156
|
-
|
157
151
|
end # describe
|
158
|
-
|
159
152
|
end # module
|
160
153
|
|
161
154
|
# End of file
|
@@ -6,10 +6,7 @@ require_relative '../../spec_helper'
|
|
6
6
|
require_relative '../../../lib/macros4cuke/templating/comment'
|
7
7
|
|
8
8
|
module Macros4Cuke
|
9
|
-
|
10
9
|
module Templating # Open this namespace to get rid of module qualifier prefixes
|
11
|
-
|
12
|
-
|
13
10
|
describe Comment do
|
14
11
|
let(:sample_text) { 'Some text' }
|
15
12
|
|
@@ -33,13 +30,9 @@ describe Comment do
|
|
33
30
|
|
34
31
|
expect(subject.render(context, locals)).to be_empty
|
35
32
|
end
|
36
|
-
|
37
33
|
end # context
|
38
|
-
|
39
34
|
end # describe
|
40
|
-
|
41
35
|
end # module
|
42
|
-
|
43
36
|
end # module
|
44
37
|
|
45
38
|
# End of file
|
@@ -7,10 +7,7 @@ require_relative '../../../lib/macros4cuke/templating/engine'
|
|
7
7
|
|
8
8
|
|
9
9
|
module Macros4Cuke
|
10
|
-
|
11
10
|
module Templating # Open this namespace to get rid of module qualifier prefixes
|
12
|
-
|
13
|
-
|
14
11
|
describe Engine do
|
15
12
|
# Sample template (consisting of a sequence of steps)
|
16
13
|
let(:sample_template) do
|
@@ -176,11 +173,9 @@ SNIPPET
|
|
176
173
|
expect { Engine.parse(sample_text) }.to raise_error(
|
177
174
|
StandardError, error_message)
|
178
175
|
end
|
179
|
-
|
180
176
|
end # context
|
181
177
|
|
182
178
|
context 'Creation and initialization:' do
|
183
|
-
|
184
179
|
it 'should accept an empty template text' do
|
185
180
|
expect { Engine.new '' }.not_to raise_error
|
186
181
|
end
|
@@ -246,11 +241,9 @@ SNIPPET
|
|
246
241
|
' while no corresponding section is open.'
|
247
242
|
expect { Engine.new wrong_end }.to raise_error(StandardError, msg)
|
248
243
|
end
|
249
|
-
|
250
244
|
end # context
|
251
245
|
|
252
246
|
context 'Provided services:' do
|
253
|
-
|
254
247
|
it 'should know the variable(s) it contains' do
|
255
248
|
# Case using the sample template
|
256
249
|
expect(subject.variables).to be == %w(userid password)
|
@@ -352,11 +345,8 @@ SNIPPET
|
|
352
345
|
expect(rendered_text).to eq(expected)
|
353
346
|
end
|
354
347
|
end # context
|
355
|
-
|
356
348
|
end # describe
|
357
|
-
|
358
349
|
end # module
|
359
|
-
|
360
350
|
end # module
|
361
351
|
|
362
352
|
# End of file
|
@@ -6,18 +6,14 @@ require_relative '../../spec_helper'
|
|
6
6
|
require_relative '../../../lib/macros4cuke/templating/eo-line'
|
7
7
|
|
8
8
|
module Macros4Cuke
|
9
|
-
|
10
9
|
module Templating # Open this namespace to get rid of module qualifier prefixes
|
11
|
-
|
12
|
-
|
13
10
|
describe EOLine do
|
14
11
|
subject { EOLine.new }
|
15
12
|
|
16
13
|
context 'Creation and initialization:' do
|
17
14
|
it 'should be created without argument' do
|
18
15
|
expect { EOLine.new }.not_to raise_error
|
19
|
-
end
|
20
|
-
|
16
|
+
end
|
21
17
|
end # context
|
22
18
|
|
23
19
|
context 'Provided services:' do
|
@@ -29,11 +25,8 @@ describe EOLine do
|
|
29
25
|
end
|
30
26
|
|
31
27
|
end # context
|
32
|
-
|
33
28
|
end # describe
|
34
|
-
|
35
29
|
end # module
|
36
|
-
|
37
30
|
end # module
|
38
31
|
|
39
32
|
# End of file
|
@@ -6,16 +6,12 @@ require_relative '../../spec_helper'
|
|
6
6
|
require_relative '../../../lib/macros4cuke/templating/placeholder'
|
7
7
|
|
8
8
|
module Macros4Cuke
|
9
|
-
|
10
9
|
module Templating # Open this namespace to get rid of module qualifier prefixes
|
11
|
-
|
12
|
-
|
13
10
|
describe Placeholder do
|
14
11
|
# Default instantiation rule
|
15
12
|
subject { Placeholder.new('foobar') }
|
16
13
|
|
17
14
|
context 'Creation and initialization:' do
|
18
|
-
|
19
15
|
it 'should be created with a variable name' do
|
20
16
|
expect { Placeholder.new('foobar') }.not_to raise_error
|
21
17
|
end
|
@@ -23,7 +19,6 @@ describe Placeholder do
|
|
23
19
|
it 'should know the name of its variable' do
|
24
20
|
expect(subject.name).to eq('foobar')
|
25
21
|
end
|
26
|
-
|
27
22
|
end # context
|
28
23
|
|
29
24
|
context 'Provided services:' do
|
@@ -58,13 +53,9 @@ describe Placeholder do
|
|
58
53
|
rendered_text = subject.render(context, {})
|
59
54
|
expect(rendered_text).to eq('world')
|
60
55
|
end
|
61
|
-
|
62
56
|
end # context
|
63
|
-
|
64
57
|
end # describe
|
65
|
-
|
66
58
|
end # module
|
67
|
-
|
68
59
|
end # module
|
69
60
|
|
70
61
|
# End of file
|
@@ -9,9 +9,7 @@ require_relative '../../../lib/macros4cuke/templating/section'
|
|
9
9
|
|
10
10
|
|
11
11
|
module Macros4Cuke
|
12
|
-
|
13
12
|
module Templating # Open this namespace to get rid of module qualifier prefixes
|
14
|
-
|
15
13
|
# Spec for abstract class Section.
|
16
14
|
describe Section do
|
17
15
|
# Default instantiation rule
|
@@ -26,7 +24,6 @@ describe Section do
|
|
26
24
|
end
|
27
25
|
|
28
26
|
context 'Creation and initialization' do
|
29
|
-
|
30
27
|
it 'should be created with a variable name' do
|
31
28
|
expect { Section.new('foobar') }.not_to raise_error
|
32
29
|
end
|
@@ -38,7 +35,6 @@ describe Section do
|
|
38
35
|
it 'should have no child at start' do
|
39
36
|
expect(subject.children).to be_empty
|
40
37
|
end
|
41
|
-
|
42
38
|
end # context
|
43
39
|
|
44
40
|
context 'Provided services:' do
|
@@ -75,18 +71,14 @@ describe Section do
|
|
75
71
|
expect { subject.send(:render, Object.new, {}) }.to raise_error(
|
76
72
|
NotImplementedError, error_message)
|
77
73
|
end
|
78
|
-
|
79
74
|
end # context
|
80
|
-
|
81
75
|
end # describe
|
82
76
|
|
83
77
|
|
84
78
|
|
85
79
|
|
86
80
|
describe ConditionalSection do
|
87
|
-
|
88
81
|
context 'Creation and initialization:' do
|
89
|
-
|
90
82
|
it 'should be created with a variable name and a boolean' do
|
91
83
|
expect { ConditionalSection.new('foobar', false) }.not_to raise_error
|
92
84
|
expect { ConditionalSection.new('foobar', true) }.not_to raise_error
|
@@ -98,7 +90,6 @@ describe ConditionalSection do
|
|
98
90
|
expect(instance.existence).to eq(existence)
|
99
91
|
end
|
100
92
|
end
|
101
|
-
|
102
93
|
end # context
|
103
94
|
|
104
95
|
context 'Provided services:' do
|
@@ -157,13 +148,9 @@ describe ConditionalSection do
|
|
157
148
|
rendered_text = instance.render(Object.new, locals)
|
158
149
|
expect(rendered_text).to eq('')
|
159
150
|
end
|
160
|
-
|
161
151
|
end # context
|
162
|
-
|
163
152
|
end # describe
|
164
|
-
|
165
153
|
end # module
|
166
|
-
|
167
154
|
end # module
|
168
155
|
|
169
156
|
# End of file
|