macros4cuke 0.4.08 → 0.4.09

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.
Files changed (49) hide show
  1. checksums.yaml +8 -8
  2. data/.rubocop.yml +3 -0
  3. data/.travis.yml +6 -0
  4. data/CHANGELOG.md +4 -0
  5. data/README.md +5 -3
  6. data/features/{1_Basics → 1_the_basics}/README.md +0 -0
  7. data/features/{1_Basics → 1_the_basics}/demo01.feature +5 -5
  8. data/features/{2_Macros_with_arguments → 2_macros_with_arguments}/README.md +0 -0
  9. data/features/{2_Macros_with_arguments → 2_macros_with_arguments}/demo02.feature +10 -10
  10. data/features/{2_Macros_with_arguments → 2_macros_with_arguments}/demo03.feature +5 -5
  11. data/features/{3_Macros_with_table_arguments → 3_macros_with_table_arguments}/README.md +0 -0
  12. data/features/{3_Macros_with_table_arguments → 3_macros_with_table_arguments}/demo04.feature +5 -5
  13. data/features/{3_Macros_with_table_arguments → 3_macros_with_table_arguments}/demo05.feature +4 -4
  14. data/features/{4_Conditional_steps → 4_conditional_steps}/demo06.feature +18 -16
  15. data/features/{5_Goodies → 5_goodies}/demo07.feature +6 -5
  16. data/features/{5_Goodies → 5_goodies}/demo08.feature +0 -0
  17. data/features/step_definitions/demo_steps.rb +5 -4
  18. data/lib/macro_steps.rb +6 -6
  19. data/lib/macros4cuke/coll-walker-factory.rb +12 -12
  20. data/lib/macros4cuke/constants.rb +4 -4
  21. data/lib/macros4cuke/formatter/all-notifications.rb +8 -8
  22. data/lib/macros4cuke/formatter/to-gherkin.rb +2 -2
  23. data/lib/macros4cuke/formatter/to-null.rb +10 -10
  24. data/lib/macros4cuke/formatting-service.rb +74 -74
  25. data/lib/macros4cuke/macro-collection.rb +13 -13
  26. data/lib/macros4cuke/macro-step-support.rb +19 -12
  27. data/lib/macros4cuke/macro-step.rb +48 -48
  28. data/lib/macros4cuke/templating/engine.rb +79 -79
  29. data/lib/macros4cuke/templating/placeholder.rb +52 -52
  30. data/lib/macros4cuke/templating/section.rb +116 -116
  31. data/lib/macros4cuke/templating/template-element.rb +88 -88
  32. data/lib/macros4cuke/templating/unary-element.rb +37 -37
  33. data/lib/macros4cuke.rb +1 -1
  34. data/spec/macros4cuke/coll-walker-factory_spec.rb +269 -269
  35. data/spec/macros4cuke/formatter/to-gherkin_spec.rb +5 -5
  36. data/spec/macros4cuke/formatter/to-null_spec.rb +62 -62
  37. data/spec/macros4cuke/formatter/to-trace_spec.rb +8 -8
  38. data/spec/macros4cuke/formatting-service_spec.rb +7 -7
  39. data/spec/macros4cuke/macro-collection_spec.rb +3 -3
  40. data/spec/macros4cuke/macro-step-support_spec.rb +4 -4
  41. data/spec/macros4cuke/macro-step_spec.rb +8 -8
  42. data/spec/macros4cuke/templating/comment_spec.rb +45 -0
  43. data/spec/macros4cuke/templating/engine_spec.rb +23 -23
  44. data/spec/macros4cuke/templating/eo-line_spec.rb +39 -0
  45. data/spec/macros4cuke/templating/section_spec.rb +1 -1
  46. data/spec/macros4cuke/templating/static_text_spec.rb +45 -0
  47. data/spec/macros4cuke/use-sample-collection.rb +7 -7
  48. data/spec/spec_helper.rb +3 -3
  49. metadata +31 -14
@@ -1,62 +1,62 @@
1
- # File: to-null_spec.rb
2
-
3
- require_relative '../../spec_helper'
4
-
5
- # Load mix-in module for creating a sample collection of macro-steps
6
- require_relative '../use-sample-collection'
7
-
8
-
9
- require_relative '../../../lib/macros4cuke/formatting-service'
10
- # Load the class under test
11
- require_relative '../../../lib/macros4cuke/formatter/to-null'
12
-
13
- module Macros4Cuke
14
-
15
- module Formatter # Open this namespace to get rid of module qualifier prefixes
16
-
17
- describe ToNull do
18
- include UseSampleCollection # Add convenience methods for sample collection
19
-
20
- before(:all) do
21
- # Fill the collection of macro-steps with sample steps
22
- fill_collection
23
- end
24
-
25
- after(:all) do
26
- # Clear the collection to prevent interference between spec files
27
- macro_coll.clear
28
- end
29
-
30
-
31
- context 'Initialization:' do
32
- it 'should be created without parameter' do
33
- expect { ToNull.new }.not_to raise_error
34
- end
35
-
36
- it 'should react to all the notifications' do
37
- instance = ToNull.new
38
- expect(instance.implements).to eq(Formatter::AllNotifications)
39
- end
40
-
41
- end # context
42
-
43
-
44
- context 'Provided services:' do
45
- # Default instantiation rule
46
- subject { ToNull.new }
47
-
48
- it 'should render a given macro-step collection' do
49
- service = FormattingService.new
50
- service.register(subject)
51
- expect { service.start!(macro_coll) }.not_to raise_error
52
- end
53
- end # context
54
-
55
- end # describe
56
-
57
- end # module
58
-
59
- end # module
60
-
61
-
62
- # End of file
1
+ # File: to-null_spec.rb
2
+
3
+ require_relative '../../spec_helper'
4
+
5
+ # Load mix-in module for creating a sample collection of macro-steps
6
+ require_relative '../use-sample-collection'
7
+
8
+
9
+ require_relative '../../../lib/macros4cuke/formatting-service'
10
+ # Load the class under test
11
+ require_relative '../../../lib/macros4cuke/formatter/to-null'
12
+
13
+ module Macros4Cuke
14
+
15
+ module Formatter # Open this namespace to get rid of module qualifier prefixes
16
+
17
+ describe ToNull do
18
+ include UseSampleCollection # Add convenience methods for sample collection
19
+
20
+ before(:all) do
21
+ # Fill the collection of macro-steps with sample steps
22
+ fill_collection
23
+ end
24
+
25
+ after(:all) do
26
+ # Clear the collection to prevent interference between spec files
27
+ macro_coll.clear
28
+ end
29
+
30
+
31
+ context 'Initialization:' do
32
+ it 'should be created without parameter' do
33
+ expect { ToNull.new }.not_to raise_error
34
+ end
35
+
36
+ it 'should react to all the notifications' do
37
+ instance = ToNull.new
38
+ expect(instance.implements).to eq(Formatter::AllNotifications)
39
+ end
40
+
41
+ end # context
42
+
43
+
44
+ context 'Provided services:' do
45
+ # Default instantiation rule
46
+ subject { ToNull.new }
47
+
48
+ it 'should render a given macro-step collection' do
49
+ service = FormattingService.new
50
+ service.register(subject)
51
+ expect { service.start!(macro_coll) }.not_to raise_error
52
+ end
53
+ end # context
54
+
55
+ end # describe
56
+
57
+ end # module
58
+
59
+ end # module
60
+
61
+
62
+ # End of file
@@ -17,7 +17,7 @@ module Formatter # Open this namespace to get rid of module qualifier prefixes
17
17
 
18
18
  describe ToTrace do
19
19
  include UseSampleCollection # Add convenience methods for sample collection
20
-
20
+
21
21
  let(:destination) { StringIO.new }
22
22
 
23
23
  before(:all) do
@@ -26,7 +26,7 @@ describe ToTrace do
26
26
  end
27
27
 
28
28
  after(:all) do
29
- # Clear the collection to prevent interference between spec files
29
+ # Clear the collection to prevent interference between spec files
30
30
  macro_coll.clear
31
31
  end
32
32
 
@@ -35,19 +35,19 @@ describe ToTrace do
35
35
  it 'should be created with an IO parameter' do
36
36
  expect { ToTrace.new(destination) }.not_to raise_error
37
37
  end
38
-
38
+
39
39
  it 'should react to all the notifications' do
40
40
  instance = ToTrace.new(destination)
41
41
  expect(instance.implements).to eq(Formatter::AllNotifications)
42
42
  end
43
43
 
44
44
  end # context
45
-
46
-
45
+
46
+
47
47
  context 'Provided services:' do
48
48
  # Default instantiation rule
49
49
  subject { ToTrace.new(destination) }
50
-
50
+
51
51
  # The expected event trace for the sample collection
52
52
  let(:expected_trace) do
53
53
  trace_details = <<-SNIPPET
@@ -135,8 +135,8 @@ SNIPPET
135
135
 
136
136
  trace_details
137
137
  end
138
-
139
-
138
+
139
+
140
140
  it 'should render the trace event for a given macro-step collection' do
141
141
  service = FormattingService.new
142
142
  service.register(subject)
@@ -66,10 +66,10 @@ describe FormattingService do
66
66
 
67
67
  it 'should complain when a formatter uses an unknown formatting event' do
68
68
  notifications = [
69
- :on_collection,
70
- :on_collection_end,
71
- :non_standard,
72
- :on_step,
69
+ :on_collection,
70
+ :on_collection_end,
71
+ :non_standard,
72
+ :on_step,
73
73
  :on_step_end
74
74
  ]
75
75
  formatter = double('formatter')
@@ -84,9 +84,9 @@ describe FormattingService do
84
84
  # Case: formatter that supports a few notifications only
85
85
  formatter1 = double('formatter')
86
86
  supported_notifications = [
87
- :on_collection,
88
- :on_collection_end,
89
- :on_step,
87
+ :on_collection,
88
+ :on_collection_end,
89
+ :on_step,
90
90
  :on_step_end
91
91
  ]
92
92
  formatter1.should_receive(:implements)
@@ -10,7 +10,7 @@ module Macros4Cuke # Open this namespace to avoid module qualifier prefixes
10
10
  describe MacroCollection do
11
11
 
12
12
  let(:singleton) { MacroCollection.instance }
13
-
13
+
14
14
  before(:all) do
15
15
  MacroCollection.instance.clear
16
16
  end
@@ -49,7 +49,7 @@ SNIPPET
49
49
 
50
50
  it 'should return the rendition of a given macro-step' do
51
51
  phrase = '[enter my credentials]'
52
- input_values = [ %w[userid nobody], %w[password no-secret] ]
52
+ input_values = [ %w(userid nobody), %w(password no-secret) ]
53
53
  rendered = singleton.render_steps(phrase, input_values)
54
54
  expected = <<-SNIPPET
55
55
  Given I landed in the homepage
@@ -60,7 +60,7 @@ SNIPPET
60
60
  SNIPPET
61
61
  expect(rendered).to eq(expected)
62
62
  end
63
-
63
+
64
64
  end # context
65
65
 
66
66
  end # describe
@@ -6,7 +6,7 @@ require_relative '../spec_helper'
6
6
  require_relative '../../lib/macros4cuke/macro-step-support'
7
7
 
8
8
 
9
- module Macros4Cuke # Open the module to avoid lengthy qualified names
9
+ module Macros4Cuke # Open the module to avoid lengthy qualified names
10
10
 
11
11
  # Class created just for testing purposes.
12
12
  class MyWorld
@@ -40,7 +40,7 @@ describe MacroStepSupport do
40
40
  SNIPPET
41
41
  ssteps
42
42
  end
43
-
43
+
44
44
  # Start from a clean situation
45
45
  before(:all) do
46
46
  MacroCollection.instance.clear
@@ -81,8 +81,8 @@ SNIPPET
81
81
 
82
82
  it "should call the 'steps' method with substeps and variables" do
83
83
  # Notice that the call syntax can be used inside step definitions
84
- world.invoke_macro(phrase1, [%w[userid nobody], %w[password none]])
85
-
84
+ world.invoke_macro(phrase1, [%w(userid nobody), %w(password none)])
85
+
86
86
  # Check that the 'steps' method was indeed called with correct argument
87
87
  param_assignments = { '<userid>' => 'nobody', '<password>' => 'none' }
88
88
  expected_text = m1_substeps.gsub(/<\S+>/, param_assignments)
@@ -2,11 +2,11 @@
2
2
 
3
3
 
4
4
  require_relative '../spec_helper'
5
- require_relative '../../lib/macros4cuke/macro-step' # The class under test
5
+ require_relative '../../lib/macros4cuke/macro-step' # The class under test
6
6
 
7
7
 
8
8
 
9
- module Macros4Cuke # Open the module to avoid lengthy qualified names
9
+ module Macros4Cuke # Open the module to avoid lengthy qualified names
10
10
 
11
11
  describe MacroStep do
12
12
  let(:sample_phrase) { 'enter my credentials as <userid>' }
@@ -54,17 +54,17 @@ SNIPPET
54
54
  it 'should know its phrase' do
55
55
  expect(subject.phrase).to eq(sample_phrase)
56
56
  end
57
-
57
+
58
58
  it 'should know its key' do
59
59
  expect(subject.key).to eq('enter_my_credentials_as_X_T')
60
60
  end
61
61
 
62
62
  it 'should know the tags(placeholders) from its phrase' do
63
- expect(subject.phrase_args).to eq(%w[userid])
63
+ expect(subject.phrase_args).to eq(%w(userid))
64
64
  end
65
65
 
66
66
  it 'should know the tags(placeholders) from its phrase and template' do
67
- expect(subject.args).to eq(%w[userid password])
67
+ expect(subject.args).to eq(%w(userid password))
68
68
  end
69
69
 
70
70
  end # context
@@ -72,7 +72,7 @@ SNIPPET
72
72
 
73
73
  context 'Provided services:' do
74
74
 
75
- let(:phrase_instance) { %Q|enter my credentials as "nobody"| }
75
+ let(:phrase_instance) { %Q(enter my credentials as "nobody") }
76
76
  it 'should render the substeps' do
77
77
  text = subject.expand(phrase_instance, [ %w(password no-secret) ])
78
78
  expectation = <<-SNIPPET
@@ -101,7 +101,7 @@ SNIPPET
101
101
  end
102
102
 
103
103
  it 'should un-escape the double-quotes for phrase arguments' do
104
- specific_phrase = %q|enter my credentials as "quotable\""|
104
+ specific_phrase = %q(enter my credentials as "quotable\"")
105
105
  text = subject.expand(specific_phrase, [ %w(password no-secret) ])
106
106
  expectation = <<-SNIPPET
107
107
  Given I landed in the homepage
@@ -126,7 +126,7 @@ SNIPPET
126
126
 
127
127
  it 'should complain when argument gets a value from phrase and table' do
128
128
  # Error case: there is no macro argument called <unknown>
129
- phrase = %Q|enter my credentials as "nobody"|
129
+ phrase = %Q(enter my credentials as "nobody")
130
130
  msg = "The macro argument 'userid' has value 'nobody' and 'someone'."
131
131
  args = [ %w(userid someone), %w(password no-secret) ]
132
132
  expect { subject.expand(phrase, args) }.to raise_error(
@@ -0,0 +1,45 @@
1
+ # File: comment_spec.rb
2
+
3
+ require_relative '../../spec_helper'
4
+
5
+ # Load the classes under test
6
+ require_relative '../../../lib/macros4cuke/templating/template-element'
7
+
8
+ module Macros4Cuke
9
+
10
+ module Templating # Open this namespace to get rid of module qualifier prefixes
11
+
12
+
13
+ describe Comment do
14
+ let(:sample_text) { 'Some text' }
15
+
16
+ subject { Comment.new(sample_text) }
17
+
18
+ context 'Creation and initialization:' do
19
+ it 'should be created with a text' do
20
+ expect { Comment.new(sample_text) }.not_to raise_error
21
+ end
22
+
23
+ it 'should know its source text' do
24
+ expect(subject.source).to eq(sample_text)
25
+ end
26
+
27
+ end # context
28
+
29
+ context 'Provided services:' do
30
+ it 'should render tan empty text' do
31
+ context = double('fake_context')
32
+ locals = double('fake_locals')
33
+
34
+ expect(subject.render(context, locals)).to be_empty
35
+ end
36
+
37
+ end # context
38
+
39
+ end # describe
40
+
41
+ end # module
42
+
43
+ end # module
44
+
45
+ # End of file
@@ -23,7 +23,7 @@ SNIPPET
23
23
 
24
24
  source
25
25
  end
26
-
26
+
27
27
  # Template containing two conditional sections
28
28
  let(:sophisticated_template) do
29
29
  source = <<-SNIPPET
@@ -39,9 +39,9 @@ SNIPPET
39
39
  SNIPPET
40
40
 
41
41
  source
42
- end
43
-
44
-
42
+ end
43
+
44
+
45
45
 
46
46
  # Rule for default instantiation
47
47
  subject { Engine.new sample_template }
@@ -63,7 +63,7 @@ SNIPPET
63
63
  sample_text = 'Mary has a little lamb'
64
64
  result = Engine.parse(sample_text)
65
65
 
66
- # Expectation: an array with one couple:
66
+ # Expectation: an array with one couple:
67
67
  # [:static, the source text]
68
68
  expect(result).to have(1).items
69
69
  expect(result[0]).to eq([:static, sample_text])
@@ -73,7 +73,7 @@ SNIPPET
73
73
  sample_text = '<some_tag>'
74
74
  result = Engine.parse(sample_text)
75
75
 
76
- # Expectation: an array with one couple:
76
+ # Expectation: an array with one couple:
77
77
  # [:static, the source text]
78
78
  expect(result).to have(1).items
79
79
  expect(result[0]).to eq([:dynamic, strip_chevrons(sample_text)])
@@ -83,7 +83,7 @@ SNIPPET
83
83
  sample_text = '<some_tag>some text'
84
84
  result = Engine.parse(sample_text)
85
85
 
86
- # Expectation: an array with two couples:
86
+ # Expectation: an array with two couples:
87
87
  # [dynamic, 'some_tag'][:static, some text]
88
88
  expect(result).to have(2).items
89
89
  expect(result[0]).to eq([:dynamic, 'some_tag'])
@@ -94,7 +94,7 @@ SNIPPET
94
94
  sample_text = 'some text<some_tag>'
95
95
  result = Engine.parse(sample_text)
96
96
 
97
- # Expectation: an array with two couples:
97
+ # Expectation: an array with two couples:
98
98
  # [:static, some text] [dynamic, 'some_tag']
99
99
  expect(result).to have(2).items
100
100
  expect(result[0]).to eq([:static, 'some text'])
@@ -196,7 +196,7 @@ SNIPPET
196
196
  instance = Engine.new ''
197
197
  expect(instance.source).to be_empty
198
198
  end
199
-
199
+
200
200
  it 'should accept conditional section' do
201
201
  expect { Engine.new sophisticated_template }.not_to raise_error
202
202
  instance = Engine.new sophisticated_template
@@ -220,7 +220,7 @@ SNIPPET
220
220
  expect { Engine.new text_w_empty_arg }.to raise_error(
221
221
  Macros4Cuke::InvalidCharError, msg)
222
222
  end
223
-
223
+
224
224
  it 'should complain when a section has no closing tag' do
225
225
  # Removing an end of section tag...
226
226
  text_w_open_section = sophisticated_template.sub(/<\/address>/, '')
@@ -229,7 +229,7 @@ SNIPPET
229
229
  expect { Engine.new text_w_open_section }.to raise_error(
230
230
  StandardError, error_message)
231
231
  end
232
-
232
+
233
233
  it 'should complain when a closing tag has no corresponding opening tag' do
234
234
  # Replacing an end of section tag by another...
235
235
  text_w_wrong_end = sophisticated_template.sub(/<\/address>/, '</foobar>')
@@ -238,22 +238,22 @@ SNIPPET
238
238
  expect { Engine.new text_w_wrong_end }.to raise_error(
239
239
  StandardError, msg)
240
240
  end
241
-
241
+
242
242
  it 'should complain when a closing tag is found without opening tag' do
243
243
  # Replacing an end of section tag by another...
244
244
  wrong_end = sophisticated_template.sub(/<\?birthdate>/, '</foobar>')
245
245
  msg = 'End of section</foobar> found'\
246
246
  ' while no corresponding section is open.'
247
247
  expect { Engine.new wrong_end }.to raise_error(StandardError, msg)
248
- end
249
-
248
+ end
249
+
250
250
  end # context
251
251
 
252
252
  context 'Provided services:' do
253
253
 
254
254
  it 'should know the variable(s) it contains' do
255
255
  # Case using the sample template
256
- expect(subject.variables).to be == %w[userid password]
256
+ expect(subject.variables).to be == %w(userid password)
257
257
 
258
258
  # Case of an empty source template text
259
259
  instance = Engine.new ''
@@ -302,13 +302,13 @@ SNIPPET
302
302
  instance = Engine.new ''
303
303
  expect(instance.render(nil, {})).to be_empty
304
304
  end
305
-
306
-
305
+
306
+
307
307
  it 'should render conditional sections' do
308
308
  instance = Engine.new(sophisticated_template)
309
-
310
- locals = {
311
- 'firstname' => 'Anon',
309
+
310
+ locals = {
311
+ 'firstname' => 'Anon',
312
312
  'lastname' => 'Eemoos' ,
313
313
  'birthdate' => '1976-04-21'
314
314
  }
@@ -321,11 +321,11 @@ SNIPPET
321
321
  SNIPPET
322
322
 
323
323
  expect(rendered_text).to eq(expected)
324
-
324
+
325
325
  # Redo with another context
326
326
  locals['birthdate'] = nil
327
327
  locals['address'] = '122, Mercer Street'
328
-
328
+
329
329
  rendered_text = instance.render(Object.new, locals)
330
330
  expected = <<-SNIPPET
331
331
  When I fill in "firstname" with "Anon"
@@ -336,7 +336,7 @@ SNIPPET
336
336
 
337
337
  expect(rendered_text).to eq(expected)
338
338
  end
339
-
339
+
340
340
 
341
341
  it 'should render multivalued actuals' do
342
342
  locals = { 'userid' => %w(johndoe yeti) } # Silly case
@@ -0,0 +1,39 @@
1
+ # File: eo-line_spec.rb
2
+
3
+ require_relative '../../spec_helper'
4
+
5
+ # Load the classes under test
6
+ require_relative '../../../lib/macros4cuke/templating/template-element'
7
+
8
+ module Macros4Cuke
9
+
10
+ module Templating # Open this namespace to get rid of module qualifier prefixes
11
+
12
+
13
+ describe EOLine do
14
+ subject { EOLine.new }
15
+
16
+ context 'Creation and initialization:' do
17
+ it 'should be created withoutargument' do
18
+ expect { EOLine.new }.not_to raise_error
19
+ end
20
+
21
+ end # context
22
+
23
+ context 'Provided services:' do
24
+ it 'should render a new line' do
25
+ context = double('fake_context')
26
+ locals = double('fake_locals')
27
+
28
+ expect(subject.render(context, locals)).to eq("\n")
29
+ end
30
+
31
+ end # context
32
+
33
+ end # describe
34
+
35
+ end # module
36
+
37
+ end # module
38
+
39
+ # End of file
@@ -60,7 +60,7 @@ describe Section do
60
60
  parent = Section.new('son')
61
61
  [ subject,
62
62
  Comment.new('# Simple step'),
63
- EOLine.new,
63
+ EOLine.new,
64
64
  StaticText.new('Bye '),
65
65
  Placeholder.new('firstname'),
66
66
  EOLine.new
@@ -0,0 +1,45 @@
1
+ # File: placeholder_spec.rb
2
+
3
+ require_relative '../../spec_helper'
4
+
5
+ # Load the classes under test
6
+ require_relative '../../../lib/macros4cuke/templating/template-element'
7
+
8
+ module Macros4Cuke
9
+
10
+ module Templating # Open this namespace to get rid of module qualifier prefixes
11
+
12
+
13
+ describe StaticText do
14
+ let(:sample_text) { 'Some text' }
15
+
16
+ subject { StaticText.new(sample_text) }
17
+
18
+ context 'Creation and initialization:' do
19
+ it 'should be created with a text' do
20
+ expect { StaticText.new(sample_text) }.not_to raise_error
21
+ end
22
+
23
+ it 'should know its source text' do
24
+ expect(subject.source).to eq(sample_text)
25
+ end
26
+
27
+ end # context
28
+
29
+ context 'Provided services:' do
30
+ it 'should render the source text as is' do
31
+ context = double('fake_context')
32
+ locals = double('fake_locals')
33
+
34
+ expect(subject.render(context, locals)).to eq(sample_text)
35
+ end
36
+
37
+ end # context
38
+
39
+ end # describe
40
+
41
+ end # module
42
+
43
+ end # module
44
+
45
+ # End of file
@@ -1,4 +1,4 @@
1
- # File: sample-collection.rb
1
+ # File: use-sample-collection.rb
2
2
  # Purpose: mix-in module with helper methods to build a sample
3
3
  # collection of macro-steps.
4
4
 
@@ -7,7 +7,7 @@ require_relative '../../lib/macros4cuke/macro-collection'
7
7
  module Macros4Cuke # Open this namespace to avoid module qualifier prefixes
8
8
 
9
9
  # Mix-in module.
10
- # Defines a set of methods that builds for testing purposes
10
+ # Defines a set of methods that builds for testing purposes
11
11
  # a sample collection of macro-steps.
12
12
  module UseSampleCollection
13
13
  # Phrase of first macro-step in the collection.
@@ -28,7 +28,7 @@ SNIPPET
28
28
 
29
29
  # Phrase of second macro-step in the collection.
30
30
  SamplePhrase2 = 'fill in the form with'
31
-
31
+
32
32
  # Sub-steps of the second macro-step in the collection.
33
33
  SampleSubsteps2 = begin
34
34
  snippet = <<-SNIPPET
@@ -55,17 +55,17 @@ SNIPPET
55
55
  snippet
56
56
  end
57
57
 
58
- # Helper. Stuff the macro collection with sample steps.
58
+ # Helper. Stuff the macro collection with sample steps.
59
59
  def fill_collection()
60
60
  coll = MacroCollection.instance
61
-
61
+
62
62
  coll.clear # Start from scratch: zap the existing macro-steps
63
-
63
+
64
64
  coll.add_macro(SamplePhrase1, SampleSubsteps1, true)
65
65
  coll.add_macro(SamplePhrase2, SampleSubsteps2, true)
66
66
  end
67
67
 
68
-
68
+
69
69
  # Helper. For convenience, provide a shorter name
70
70
  # for the macro-step collection.
71
71
  def macro_coll()
data/spec/spec_helper.rb CHANGED
@@ -4,15 +4,15 @@
4
4
  require 'simplecov'
5
5
 
6
6
 
7
- require 'rspec' # Use the RSpec framework
8
- require 'pp' # Use pretty-print for debugging purposes
7
+ require 'rspec' # Use the RSpec framework
8
+ require 'pp' # Use pretty-print for debugging purposes
9
9
 
10
10
  RSpec.configure do |config|
11
11
  config.expect_with :rspec do |c|
12
12
  # Disable the `should` syntax...
13
13
  c.syntax = :expect
14
14
  end
15
-
15
+
16
16
  # Display stack trace in case of failure
17
17
  config.full_backtrace = true
18
18
  end