macros4cuke 0.5.07 → 0.5.08

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 (44) hide show
  1. checksums.yaml +8 -8
  2. data/.rubocop.yml +4 -0
  3. data/CHANGELOG.md +4 -0
  4. data/README.md +1 -1
  5. data/Rakefile +0 -2
  6. data/features/support/use_macros4cuke.rb +11 -0
  7. data/lib/macros4cuke/application.rb +0 -3
  8. data/lib/macros4cuke/cli/cmd-line.rb +0 -7
  9. data/lib/macros4cuke/coll-walker-factory.rb +0 -7
  10. data/lib/macros4cuke/constants.rb +1 -1
  11. data/lib/macros4cuke/exceptions.rb +0 -3
  12. data/lib/macros4cuke/formatter/all-notifications.rb +20 -24
  13. data/lib/macros4cuke/formatter/to-gherkin.rb +0 -6
  14. data/lib/macros4cuke/formatter/to-null.rb +70 -79
  15. data/lib/macros4cuke/formatter/to-trace.rb +64 -70
  16. data/lib/macros4cuke/formatting-service.rb +0 -3
  17. data/lib/macros4cuke/macro-collection.rb +0 -3
  18. data/lib/macros4cuke/macro-step-support.rb +0 -3
  19. data/lib/macros4cuke/macro-step.rb +1 -4
  20. data/lib/macros4cuke/templating/comment.rb +37 -43
  21. data/lib/macros4cuke/templating/engine.rb +4 -14
  22. data/lib/macros4cuke/templating/eo-line.rb +10 -19
  23. data/lib/macros4cuke/templating/placeholder.rb +0 -8
  24. data/lib/macros4cuke/templating/section.rb +0 -11
  25. data/lib/macros4cuke/templating/static-text.rb +28 -33
  26. data/lib/macros4cuke/templating/unary-element.rb +0 -4
  27. data/spec/macros4cuke/application_spec.rb +0 -5
  28. data/spec/macros4cuke/cli/cmd-line_spec.rb +213 -223
  29. data/spec/macros4cuke/coll-walker-factory_spec.rb +0 -6
  30. data/spec/macros4cuke/formatter/to-gherkin_spec.rb +0 -9
  31. data/spec/macros4cuke/formatter/to-null_spec.rb +0 -6
  32. data/spec/macros4cuke/formatter/to-trace_spec.rb +0 -6
  33. data/spec/macros4cuke/formatting-service_spec.rb +0 -5
  34. data/spec/macros4cuke/macro-collection_spec.rb +1 -8
  35. data/spec/macros4cuke/macro-step-support_spec.rb +0 -9
  36. data/spec/macros4cuke/macro-step_spec.rb +0 -7
  37. data/spec/macros4cuke/templating/comment_spec.rb +0 -7
  38. data/spec/macros4cuke/templating/engine_spec.rb +0 -10
  39. data/spec/macros4cuke/templating/eo-line_spec.rb +1 -8
  40. data/spec/macros4cuke/templating/placeholder_spec.rb +0 -9
  41. data/spec/macros4cuke/templating/section_spec.rb +0 -13
  42. data/spec/macros4cuke/templating/static_text_spec.rb +0 -6
  43. data/spec/macros4cuke/use-sample-collection.rb +0 -3
  44. metadata +3 -2
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NzQxMzNkYWU3ZTRhOGQ1M2MzZWRhMGVkZGFhNTgxODI1MjE2NWY3ZA==
4
+ NDNiMDM5MjcwMjA4MzdlYmY3NTYxYzA2ZDIyMTliZDRmYzI4NzViMw==
5
5
  data.tar.gz: !binary |-
6
- NGM1ZmJjZTdiZGM0YWRiOTNjODIxZmUzMDZjODE0ODBiZWJhNjBiMA==
6
+ YzRlNTUxZWJhOGQxMWY5MjI4OWE4ZDc1YzMzODI0ODlmZjAyZjAyYg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MWViOTM2OGI3ODcwYWRlN2M0YWQ1Mzg5MmViMGIwNTEzYjI4YTdlZTk1M2Qy
10
- ZTA5MmYxZTIxYjAwMzY4OGY4OGRiYjY2MDhjMTZlODczZGJkMmZmMTA1MGQw
11
- ZDkxM2IwMmU3NzQyN2U3OWVlNGViYmJjYWM2YTgwODA1NzY5NjQ=
9
+ MTgwNzk3ZjMxYmRmODI2MGE1ZWNkZjQ1ZGE1NDVkOWUxZDc1M2E0ZTMyMmM1
10
+ MmJkODNkY2FiYjc0YTc5MDEyNDI4MzA2ZjFhMjhmZDUzOTI1NzQwM2JhMzIy
11
+ OGYyNzY1ZjFkYzVmM2YzZDJhYjAwYjM4YTA1MDlhM2I5ODM1ZWQ=
12
12
  data.tar.gz: !binary |-
13
- ZTgwM2M4OWM3MTQyMzA4ODljNTA0YzFjNjRmNWUyZDc1MzczMDI3NzA0NDA0
14
- MWVlNDQ0MTA0NWI5MzI4NzBhYzdkYWFiMjcyMmRkY2FmZTYxZmNjYjM2Nzk4
15
- ODUzZmMwOWVjYTMxZjI3OGY0NWIxNDEzZmMzZDQ5NDA5OWIxZTA=
13
+ NTA0OTU5MmZkNGVjY2I3MThkZDUxYTNkYzlhYWY0MmQ0YTE3ZmIzZTUxMzYw
14
+ NDBkOTlhMDZiMWI2YmZhNDYzNzQxMmM5MDNjMzlhMmMxYjM1ZWNlNWMyM2Jj
15
+ MjQ1NDg0MjUyNzNhNzYzZDg1MDg0NmY2YjQzYWZjMDEzOThhOWM=
data/.rubocop.yml CHANGED
@@ -4,6 +4,10 @@ AllCops:
4
4
  - 'features/**/*'
5
5
  - 'gems/**/*'
6
6
 
7
+ AbcSize:
8
+ Max: 45
9
+ Enabled: true
10
+
7
11
  # This is disabled because some demos use UTF-8
8
12
  AsciiComments:
9
13
  Enabled: false
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 0.5.08 / 2015-02-xx
2
+ * [CHANGE] Code layout reformat to please Rubocop 0.28.0 (Removal of 'Extra empty line detected at...' offenses)
3
+ * [TEST] Regression tests with Cucumber 1.3.18: all pass
4
+
1
5
  ### 0.5.06 / 2014-06-30
2
6
  * [CHANGE] Multiple minor changes to please Rubocop 0.26.1
3
7
  * [CHANGE] File `demo03.feature`: Added an example with scenario outline
data/README.md CHANGED
@@ -558,4 +558,4 @@ Macros with Cucumber is a hot topic, so it is good to know what other people say
558
558
 
559
559
  Copyright
560
560
  ---------
561
- Copyright (c) 2014, Dimitri Geshef. Macros4Cuke is released under the MIT License see [LICENSE.txt](https://github.com/famished-tiger/Macros4Cuke/blob/master/LICENSE.txt) for details.
561
+ Copyright (c) 2014-2015, Dimitri Geshef. Macros4Cuke is released under the MIT License see [LICENSE.txt](https://github.com/famished-tiger/Macros4Cuke/blob/master/LICENSE.txt) for details.
data/Rakefile CHANGED
@@ -2,12 +2,10 @@ require 'rubygems'
2
2
  require_relative './lib/macros4cuke/constants'
3
3
 
4
4
  namespace :gem do
5
-
6
5
  desc 'Push the gem to rubygems.org'
7
6
  task :push do
8
7
  system("gem push macros4cuke-#{Macros4Cuke::Version}.gem")
9
8
  end
10
-
11
9
  end # namespace
12
10
 
13
11
  # Testing-specific tasks
@@ -0,0 +1,11 @@
1
+ # File: use_macros4cuke.rb
2
+ # Purpose: Add the support for macros in a Cucumber project.
3
+ # This file is meant to be put next to the 'env.rb' file
4
+ # of your Cucumber project.
5
+
6
+
7
+ # Load modules, classes and step definitions from the macros4cuke gem
8
+ require 'macros4cuke/cucumber'
9
+
10
+
11
+ # End of file
@@ -5,7 +5,6 @@ require 'erb'
5
5
  require_relative 'cli/cmd-line'
6
6
 
7
7
  module Macros4Cuke # Module used as a namespace
8
-
9
8
  # Runner for the Macros4Cuke application.
10
9
  class Application
11
10
  attr_reader(:options)
@@ -69,9 +68,7 @@ class Application
69
68
  exit
70
69
  end
71
70
  end
72
-
73
71
  end # class
74
-
75
72
  end # module
76
73
 
77
74
  # End of file
@@ -8,11 +8,8 @@ require 'cucumber/platform'
8
8
  require_relative '../constants'
9
9
 
10
10
  module Macros4Cuke # Module used as a namespace
11
-
12
11
  # Module dedicated to the command-line interface
13
12
  module CLI
14
-
15
-
16
13
  # Manages the application command-line interface (CLI).
17
14
  # It is merely a thin wrapper around the OptionParser library.
18
15
  # Responsibilities:
@@ -70,7 +67,6 @@ EOS
70
67
  puts msg
71
68
  options[:version] = true
72
69
  end
73
-
74
70
  end
75
71
  end
76
72
 
@@ -132,11 +128,8 @@ EOS
132
128
  puts ShortHelpMsg
133
129
  exit
134
130
  end
135
-
136
131
  end # class
137
-
138
132
  end # module
139
-
140
133
  end # module
141
134
 
142
135
  # End of file
@@ -5,8 +5,6 @@ require_relative 'macro-collection'
5
5
 
6
6
 
7
7
  module Macros4Cuke # Module used as a namespace
8
-
9
-
10
8
  # A Coll(ection)WalkerFactory object is a factory that creates
11
9
  # an enumerator that itself walks in the passed macro collection object.
12
10
  # The walker performs a depth-first visit and yields visit events.
@@ -110,12 +108,7 @@ class CollWalkerFactory
110
108
 
111
109
  return [:on_section, nesting_level, current_node.name]
112
110
  end
113
-
114
-
115
-
116
-
117
111
  end # class
118
-
119
112
  end # module
120
113
 
121
114
  # End of file
@@ -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.5.07'
6
+ Version = '0.5.08'
7
7
 
8
8
  # Brief description of the gem.
9
9
  Description = 'Add your own macro-steps to Cucumber scenarios'
@@ -1,7 +1,6 @@
1
1
  # File: exceptions.rb
2
2
 
3
3
  module Macros4Cuke # Module used as a namespace
4
-
5
4
  # @abstract
6
5
  # Base class for any exception explicitly raised in the Macros4Cuke methods.
7
6
  class Macros4CukeError < StandardError
@@ -143,8 +142,6 @@ end # class
143
142
  # that it can't handle properly.
144
143
  class InternalError < Macros4CukeError
145
144
  end # class
146
-
147
-
148
145
  end # module
149
146
 
150
147
  # End of file
@@ -1,30 +1,26 @@
1
1
  # File: all_notifications.rb
2
2
 
3
3
  module Macros4Cuke # Module used as a namespace
4
-
5
- # Namespace for all formatters of MacroCollection and MacroStep objects
6
- module Formatter
7
-
8
- # The list of all formatting notifications
9
- AllNotifications = [
10
- :on_collection,
11
- :on_collection_end,
12
- :on_step,
13
- :on_step_end,
14
- :on_phrase,
15
- :on_renderer,
16
- :on_renderer_end,
17
- :on_source,
18
- :on_static_text,
19
- :on_eol,
20
- :on_comment,
21
- :on_placeholder,
22
- :on_section,
23
- :on_section_end
24
- ]
25
-
26
- end # module
27
-
4
+ # Namespace for all formatters of MacroCollection and MacroStep objects
5
+ module Formatter
6
+ # The list of all formatting notifications
7
+ AllNotifications = [
8
+ :on_collection,
9
+ :on_collection_end,
10
+ :on_step,
11
+ :on_step_end,
12
+ :on_phrase,
13
+ :on_renderer,
14
+ :on_renderer_end,
15
+ :on_source,
16
+ :on_static_text,
17
+ :on_eol,
18
+ :on_comment,
19
+ :on_placeholder,
20
+ :on_section,
21
+ :on_section_end
22
+ ]
23
+ end # module
28
24
  end # module
29
25
 
30
26
  # End of file
@@ -3,10 +3,8 @@
3
3
  require_relative '../constants'
4
4
 
5
5
  module Macros4Cuke # Module used as a namespace
6
-
7
6
  # Namespace for all formatters of MacroCollection and MacroStep objects
8
7
  module Formatter
9
-
10
8
  # A macro-step formatter that outputs to the given IO the macro-steps from a
11
9
  # macro collection into a Gherkin feature file.
12
10
  class ToGherkin
@@ -71,12 +69,8 @@ class ToGherkin
71
69
  def indentation(aLevel)
72
70
  return ' ' * (aLevel)
73
71
  end
74
-
75
-
76
72
  end # class
77
-
78
73
  end # module
79
-
80
74
  end # module
81
75
 
82
76
  # End of file
@@ -3,85 +3,76 @@
3
3
  require_relative 'all-notifications'
4
4
 
5
5
  module Macros4Cuke # Module used as a namespace
6
-
7
- # Namespace for all formatters of MacroCollection and MacroStep objects
8
- module Formatter
9
-
10
- # A macro-step formatter that doesn't produce any output.
11
- # It fully implements the expected interface of formatters but
12
- # its methods are NOOP (i.e. they do nothing).
13
- # This formatter can be useful when one wants to discard
14
- # any formatted output.
15
- class ToNull
16
-
17
- public
18
-
19
- # Tell which notifications the formatter subscribes to.
20
- def implements()
21
- return Formatter::AllNotifications
22
- end
23
-
24
- def on_collection(_, _)
25
- ; # Do nothing
26
- end
27
-
28
- def on_collection_end(_)
29
- ; # Do nothing
30
- end
31
-
32
- def on_step(_, _)
33
- ; # Do nothing
34
- end
35
-
36
- def on_step_end(_)
37
- ; # Do nothing
38
- end
39
-
40
- def on_phrase(_, _, _)
41
- ; # Do nothing
42
- end
43
-
44
- def on_renderer(_, _)
45
- ; # Do nothing
46
- end
47
-
48
- def on_renderer_end(_)
49
- ; # Do nothing
50
- end
51
-
52
- def on_source(_, _)
53
- ; # Do nothing
54
- end
55
-
56
- def on_static_text(_, _)
57
- ; # Do nothing
58
- end
59
-
60
- def on_comment(_, _)
61
- ; # Do nothing
62
- end
63
-
64
- def on_eol(_)
65
- ; # Do nothing
66
- end
67
-
68
- def on_placeholder(_, _)
69
- ; # Do nothing
70
- end
71
-
72
- def on_section(_, _)
73
- ; # Do Nothing
74
- end
75
-
76
- def on_section_end(_)
77
- ; # Do Nothing
78
- end
79
-
80
-
81
- end # class
82
-
83
- end # module
84
-
6
+ # Namespace for all formatters of MacroCollection and MacroStep objects
7
+ module Formatter
8
+ # A macro-step formatter that doesn't produce any output.
9
+ # It fully implements the expected interface of formatters but
10
+ # its methods are NOOP (i.e. they do nothing).
11
+ # This formatter can be useful when one wants to discard
12
+ # any formatted output.
13
+ class ToNull
14
+ # Tell which notifications the formatter subscribes to.
15
+ def implements()
16
+ return Formatter::AllNotifications
17
+ end
18
+
19
+ def on_collection(_, _)
20
+ ; # Do nothing
21
+ end
22
+
23
+ def on_collection_end(_)
24
+ ; # Do nothing
25
+ end
26
+
27
+ def on_step(_, _)
28
+ ; # Do nothing
29
+ end
30
+
31
+ def on_step_end(_)
32
+ ; # Do nothing
33
+ end
34
+
35
+ def on_phrase(_, _, _)
36
+ ; # Do nothing
37
+ end
38
+
39
+ def on_renderer(_, _)
40
+ ; # Do nothing
41
+ end
42
+
43
+ def on_renderer_end(_)
44
+ ; # Do nothing
45
+ end
46
+
47
+ def on_source(_, _)
48
+ ; # Do nothing
49
+ end
50
+
51
+ def on_static_text(_, _)
52
+ ; # Do nothing
53
+ end
54
+
55
+ def on_comment(_, _)
56
+ ; # Do nothing
57
+ end
58
+
59
+ def on_eol(_)
60
+ ; # Do nothing
61
+ end
62
+
63
+ def on_placeholder(_, _)
64
+ ; # Do nothing
65
+ end
66
+
67
+ def on_section(_, _)
68
+ ; # Do Nothing
69
+ end
70
+
71
+ def on_section_end(_)
72
+ ; # Do Nothing
73
+ end
74
+ end # class
75
+ end # module
85
76
  end # module
86
77
 
87
78
  # End of file
@@ -3,100 +3,94 @@
3
3
  require_relative 'all-notifications'
4
4
 
5
5
  module Macros4Cuke # Module used as a namespace
6
-
7
6
  # Namespace for all formatters of MacroCollection and MacroStep objects
8
7
  module Formatter
8
+ # A macro-step formatter that outputs in the given IO the formatting events.
9
+ # Can be useful in tracing the visit sequence inside
10
+ # a given macro-step collection.
11
+ class ToTrace
12
+ # The IO where the formatter's output will be written to.
13
+ attr_reader(:io)
9
14
 
10
- # A macro-step formatter that outputs in the given IO the formatting events.
11
- # Can be useful in tracing the visit sequence inside
12
- # a given macro-step collection.
13
- class ToTrace
14
- # The IO where the formatter's output will be written to.
15
- attr_reader(:io)
16
-
17
-
18
- def initialize(anIO)
19
- @io = anIO
20
- end
21
15
 
22
- public
16
+ def initialize(anIO)
17
+ @io = anIO
18
+ end
23
19
 
24
- # Tell which notifications the formatter subscribes to.
25
- def implements()
26
- return Formatter::AllNotifications
27
- end
20
+ public
28
21
 
29
- def on_collection(aLevel, _)
30
- trace_event(aLevel, __method__)
31
- end
22
+ # Tell which notifications the formatter subscribes to.
23
+ def implements()
24
+ return Formatter::AllNotifications
25
+ end
32
26
 
33
- def on_collection_end(aLevel)
34
- trace_event(aLevel, __method__)
35
- end
27
+ def on_collection(aLevel, _)
28
+ trace_event(aLevel, __method__)
29
+ end
36
30
 
37
- def on_step(aLevel, _)
38
- trace_event(aLevel, __method__)
39
- end
31
+ def on_collection_end(aLevel)
32
+ trace_event(aLevel, __method__)
33
+ end
40
34
 
41
- def on_step_end(aLevel)
42
- trace_event(aLevel, __method__)
43
- end
35
+ def on_step(aLevel, _)
36
+ trace_event(aLevel, __method__)
37
+ end
44
38
 
45
- def on_phrase(aLevel, _, _)
46
- trace_event(aLevel, __method__)
47
- end
39
+ def on_step_end(aLevel)
40
+ trace_event(aLevel, __method__)
41
+ end
48
42
 
49
- def on_renderer(aLevel, _)
50
- trace_event(aLevel, __method__)
51
- end
43
+ def on_phrase(aLevel, _, _)
44
+ trace_event(aLevel, __method__)
45
+ end
52
46
 
53
- def on_renderer_end(aLevel)
54
- trace_event(aLevel, __method__)
55
- end
47
+ def on_renderer(aLevel, _)
48
+ trace_event(aLevel, __method__)
49
+ end
56
50
 
57
- def on_source(aLevel, _)
58
- trace_event(aLevel, __method__)
59
- end
51
+ def on_renderer_end(aLevel)
52
+ trace_event(aLevel, __method__)
53
+ end
60
54
 
61
- def on_static_text(aLevel, _)
62
- trace_event(aLevel, __method__)
63
- end
55
+ def on_source(aLevel, _)
56
+ trace_event(aLevel, __method__)
57
+ end
64
58
 
65
- def on_comment(aLevel, _)
66
- trace_event(aLevel, __method__)
67
- end
59
+ def on_static_text(aLevel, _)
60
+ trace_event(aLevel, __method__)
61
+ end
68
62
 
69
- def on_eol(aLevel)
70
- trace_event(aLevel, __method__)
71
- end
63
+ def on_comment(aLevel, _)
64
+ trace_event(aLevel, __method__)
65
+ end
72
66
 
73
- def on_placeholder(aLevel, _)
74
- trace_event(aLevel, __method__)
75
- end
67
+ def on_eol(aLevel)
68
+ trace_event(aLevel, __method__)
69
+ end
76
70
 
77
- def on_section(aLevel, _)
78
- trace_event(aLevel, __method__)
79
- end
71
+ def on_placeholder(aLevel, _)
72
+ trace_event(aLevel, __method__)
73
+ end
80
74
 
81
- def on_section_end(aLevel)
82
- trace_event(aLevel, __method__)
83
- end
75
+ def on_section(aLevel, _)
76
+ trace_event(aLevel, __method__)
77
+ end
84
78
 
85
- private
79
+ def on_section_end(aLevel)
80
+ trace_event(aLevel, __method__)
81
+ end
86
82
 
87
- def indentation(aLevel)
88
- return ' ' * aLevel
89
- end
83
+ private
90
84
 
91
- def trace_event(aLevel, anEvent)
92
- io.puts "#{indentation(aLevel)}#{anEvent}"
93
- end
94
-
95
-
96
- end # class
85
+ def indentation(aLevel)
86
+ return ' ' * aLevel
87
+ end
97
88
 
89
+ def trace_event(aLevel, anEvent)
90
+ io.puts "#{indentation(aLevel)}#{anEvent}"
91
+ end
92
+ end # class
98
93
  end # module
99
-
100
94
  end # module
101
95
 
102
96
  # End of file