macros4cuke 0.4.00 → 0.4.01

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OGE0ZDcxMWQxOTgxYTljYThhY2ViYzg5NzIxN2E1OTNlMDU2OTk1ZQ==
4
+ YTY0YmViNGQ1MmU5NWI5NDMxZjNiMTExNmEwYzEwMjI2YWIyMzQ3NA==
5
5
  data.tar.gz: !binary |-
6
- ZjhmNjQ0NWVlMzVkMWU0N2Y0ZDE2Y2Y1YmNiYWFiMDk1NTdlYjU0Nw==
6
+ OTc0YjU2NzNkZTY2ODc5OWM0YjEwMzkxYTU3NTcyMGRhYzcwMjdhNA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- M2MwYjllOWYxY2QxZDBlYTc0OWJkOGE4ZGQ3N2IwYjJhOGU0MzViMDc2ZWMx
10
- ZGQ4N2FhYTU3ZWNjYmJkMjY5NzRiZmFjN2NmYjVjZmQxMDI0NDM2NDkzZjli
11
- MWQ2MDlmYzljOWM2NmQzMGRmMDVkYjAwOTYxZDdmY2Q5YjBlNTY=
9
+ YzM4NThiNjZmM2I1YzM1NDk0MzQ5ZDRhMDE2NzQ0YWY4MmJmMGNiY2U3M2I1
10
+ MWQ3YjZlNTA4OGM1Zjg1NGMxODFhZDE0OWUxNDljYzFjNDRhOWFkYjQyNDg2
11
+ Y2VjOGQ3MzczOWVmMTA2NTg0NGUwZjc4Yzg5OTQ3YjU0NDA1NjE=
12
12
  data.tar.gz: !binary |-
13
- ZjcyOWZlZWI0ZjU0Yzk4MjJkNGYwODAwMTU3YjE5YTc0N2VlZGZjNzRkZDQ0
14
- YjVmYTNmNzhkMWY4ZDNiZmJlNWFiMzQ0NTQ5ZGE5NmM0MmU1MWM3ZTM4Yzhj
15
- NDMzMzBlMDllNzg1NGNiN2Y1NzU2NWRkMzMzY2I0Zjk5Yjg5MDM=
13
+ MTQyYzAwM2U2MGEzZTRmNGQzNDgyOGIxZDI4M2Q1ZTQzM2E0YTRmZGQ4Y2E1
14
+ MWVkYzI4ODgyYzlmYTI0YjMzZDA2ZjlmZDI5ZTA0ZDc5ZDBiOWQyNzA3NDQ2
15
+ MTA0MDEwNzNlM2Y3ODdiY2ZhNDgzZDFmM2QxZjg0YzE2OGJhN2M=
data/.rubocop.yml CHANGED
@@ -2,6 +2,7 @@ AllCops:
2
2
  Excludes:
3
3
  - '*/examples/**'
4
4
  - '*/features/**'
5
+ - '*/gems/**'
5
6
 
6
7
 
7
8
  AccessControl:
@@ -21,6 +22,9 @@ ClassLength:
21
22
  ConstantName:
22
23
  Enabled: false
23
24
 
25
+ CyclomaticComplexity:
26
+ Enabled: false
27
+
24
28
  DefWithParentheses:
25
29
  Enabled: false
26
30
 
@@ -29,6 +33,9 @@ Documentation:
29
33
 
30
34
  EmptyLines:
31
35
  Enabled: false
36
+
37
+ EmptyLinesAroundBody:
38
+ Enabled: false
32
39
 
33
40
  Encoding:
34
41
  Enabled: false
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
+ ### 0.4.01 / 2013-11_17
2
+ * [CHANGE] File `.rubocop.yml`: Disabled a few new 0.15.0 cops
3
+ * [CHANGE] Files from `lib` and `spec` dirs updated for Rubocop 0.15.0
4
+
1
5
  ### 0.4.00 / 2013-11-17
2
6
  #### Version number bumped. New feature: to list all encountered macro definitions into a single feature file.
3
- * [NEW] Sample `demo07.feature` file illustrates the new step that will list all macro definitions.
7
+ * [FEATURE] Sample `demo07.feature` file illustrates the new step that will list all macro definitions.
4
8
  * [NEW] Class CollWalkerFactory. Creates specialized Enumerators that walk over the macro collection.
5
9
  * [NEW] Module Formatter. Purpose: Grouping of all classes that render macro definitions
6
10
  * [NEW] File `all-notifications.rb` List of macro collection visit events.
@@ -72,7 +72,8 @@ class CollWalkerFactory
72
72
  return visitor
73
73
  end
74
74
 
75
- private
75
+ private
76
+
76
77
  # Add children elements to the visit backlog
77
78
  def add_children(anEnumerable, theBacklog)
78
79
  anEnumerable.reverse.each do |elem|
@@ -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.4.00'
6
+ Version = '0.4.01'
7
7
 
8
8
  # Brief description of the gem.
9
9
  Description = 'Macro-steps for Cucumber'
@@ -12,7 +12,7 @@ module Formatter
12
12
  class ToGherkin
13
13
  # The IO where the formatter's output will be written to.
14
14
  attr_reader(:io)
15
-
15
+
16
16
  # The number of macro-step encountered by the formatter.
17
17
  attr_reader(:step_count)
18
18
 
@@ -22,6 +22,7 @@ class ToGherkin
22
22
  end
23
23
 
24
24
  public
25
+
25
26
  # Tell which notifications this formatter subscribes to.
26
27
  def implements()
27
28
  return [:on_collection, :on_step, :on_step_end, :on_phrase, :on_source]
@@ -39,7 +40,7 @@ class ToGherkin
39
40
 
40
41
  def on_step(aLevel, aMacroStep)
41
42
  @step_count += 1
42
- io.puts "#{indentation(aLevel)}Scenario: Macro #{step_count}"
43
+ io.puts "#{indentation(aLevel)}Scenario: Macro #{step_count}"
43
44
  end
44
45
 
45
46
  def on_step_end(aLevel)
@@ -57,19 +58,20 @@ class ToGherkin
57
58
  ljust = indentation(aLevel)
58
59
  triple_quotes = %Q|#{ljust}"""|
59
60
  io.puts triple_quotes
60
-
61
+
61
62
  # Indent source text
62
63
  indented_text = aSourceText.gsub(/^/m, "#{ljust}")
63
-
64
+
64
65
  io.puts indented_text
65
66
  io.puts triple_quotes
66
67
  end
67
-
68
- private
68
+
69
+ private
70
+
69
71
  def indentation(aLevel)
70
72
  return ' ' * (aLevel)
71
73
  end
72
-
74
+
73
75
 
74
76
  end # class
75
77
 
@@ -15,6 +15,7 @@ module Formatter
15
15
  class ToNull
16
16
 
17
17
  public
18
+
18
19
  # Tell which notifications the formatter subscribes to.
19
20
  def implements()
20
21
  return Formatter::AllNotifications
@@ -13,13 +13,14 @@ module Formatter
13
13
  class ToTrace
14
14
  # The IO where the formatter's output will be written to.
15
15
  attr_reader(:io)
16
-
16
+
17
17
 
18
18
  def initialize(anIO)
19
19
  @io = anIO
20
20
  end
21
21
 
22
22
  public
23
+
23
24
  # Tell which notifications the formatter subscribes to.
24
25
  def implements()
25
26
  return Formatter::AllNotifications
@@ -60,7 +61,7 @@ class ToTrace
60
61
  def on_static_text(aLevel, aStaticText)
61
62
  trace_event(aLevel, __method__)
62
63
  end
63
-
64
+
64
65
  def on_comment(aLevel, aComment)
65
66
  trace_event(aLevel, __method__)
66
67
  end
@@ -82,10 +83,11 @@ class ToTrace
82
83
  end
83
84
 
84
85
  private
86
+
85
87
  def indentation(aLevel)
86
88
  return ' ' * aLevel
87
89
  end
88
-
90
+
89
91
  def trace_event(aLevel, anEvent)
90
92
  io.puts "#{indentation(aLevel)}#{anEvent}"
91
93
  end
@@ -17,7 +17,7 @@ class MacroCollection
17
17
  # A Hash with pairs of the form: macro key => MacroStep object
18
18
 
19
19
 
20
- public
20
+ public
21
21
 
22
22
  # Add a new macro.
23
23
  # Pre-condition: there is no existing macro with the same key.
@@ -35,7 +35,6 @@ public
35
35
  fail(DuplicateMacroError, aPhrase) if find_macro(aPhrase, useTable)
36
36
 
37
37
  macro_steps[new_macro.key] = new_macro
38
-
39
38
  end
40
39
 
41
40
  # Render the steps associated to the macro with given phrase
@@ -70,7 +69,7 @@ public
70
69
  return @macro_steps
71
70
  end
72
71
 
73
- private
72
+ private
74
73
 
75
74
  # Retrieve the macro, given a phrase.
76
75
  def find_macro(aMacroPhrase, useTable)
@@ -14,7 +14,8 @@ module Macros4Cuke # Module used as a namespace
14
14
  # World(Macros4Cuke::MacroStepSupport)
15
15
  #
16
16
  module MacroStepSupport
17
- public
17
+
18
+ public
18
19
 
19
20
  # Add a new macro.
20
21
  # Pre-condition: there is no existing macro with the same key.
@@ -125,7 +125,8 @@ class MacroStep
125
125
  return renderer.render(nil, params)
126
126
  end
127
127
 
128
- private
128
+ private
129
+
129
130
  # Build a Hash from the given raw data.
130
131
  # @param aPhrase [String] an instance of the macro phrase.
131
132
  # @param rawData [Array or nil] An Array with coupples of the form:
@@ -69,7 +69,9 @@ end # class
69
69
  # Class used internally by the template engine.
70
70
  # Represents an end of line that must be rendered as such.
71
71
  class EOLine
72
+
72
73
  public
74
+
73
75
  # Render an end of line.
74
76
  # This method has the same signature as the {Engine#render} method.
75
77
  # @return [String] An end of line marker. Its exact value is OS-dependent.
@@ -117,6 +119,7 @@ end # class
117
119
  class Placeholder < UnaryElement
118
120
 
119
121
  public
122
+
120
123
  # Render the placeholder given the passed arguments.
121
124
  # This method has the same signature as the {Engine#render} method.
122
125
  # @return [String] The text value assigned to the placeholder.
@@ -159,6 +162,7 @@ class Section < UnaryElement
159
162
  end
160
163
 
161
164
  public
165
+
162
166
  # Add a child element as member of the section
163
167
  def add_child(aChild)
164
168
  children << aChild
@@ -210,7 +214,8 @@ class ConditionalSection < Section
210
214
  @existence = renderWhenExisting
211
215
  end
212
216
 
213
- public
217
+ public
218
+
214
219
  # Render the placeholder given the passed arguments.
215
220
  # This method has the same signature as the {Engine#render} method.
216
221
  # @return [String] The text value assigned to the placeholder.
@@ -279,7 +284,8 @@ class Engine
279
284
  @representation = compile(aSourceTemplate)
280
285
  end
281
286
 
282
- public
287
+ public
288
+
283
289
  # Render the template within the given scope object and
284
290
  # with the locals specified.
285
291
  # The method mimicks the signature of the Tilt::Template#render method.
@@ -359,7 +365,7 @@ public
359
365
  return result
360
366
  end
361
367
 
362
- private
368
+ private
363
369
 
364
370
  # Called when the given text line could not be parsed.
365
371
  # Raises an exception with the syntax issue identified.
@@ -89,7 +89,9 @@ describe FormattingService do
89
89
  :on_step,
90
90
  :on_step_end
91
91
  ]
92
- formatter1.should_receive(:implements).at_least(69).times.and_return(supported_notifications)
92
+ formatter1.should_receive(:implements)
93
+ .at_least(69).times
94
+ .and_return(supported_notifications)
93
95
  subject.register(formatter1)
94
96
 
95
97
  # Test the notifications send to the formatter
@@ -118,7 +120,9 @@ describe FormattingService do
118
120
  it 'should support multiple formatters' do
119
121
  formatter1 = double('formatter')
120
122
  supported_notifications = [:on_collection]
121
- formatter1.should_receive(:implements).at_least(69 * 3).times.and_return(supported_notifications)
123
+ formatter1.should_receive(:implements)
124
+ .at_least(69 * 3).times
125
+ .and_return(supported_notifications)
122
126
 
123
127
  # Cheating: registering three times the same formatter...
124
128
  3.times { subject.register(formatter1) }
@@ -287,7 +287,7 @@ SNIPPET
287
287
  # Place actual value in context object
288
288
  Context = Struct.new(:userid, :password)
289
289
  context = Context.new('sherlock', 'holmes')
290
- rendered_text = subject.render(context, { 'userid' => 'susan' })
290
+ rendered_text = subject.render(context, 'userid' => 'susan')
291
291
  expected = <<-SNIPPET
292
292
  Given I landed in the homepage
293
293
  And I fill in "Username" with "susan"
@@ -33,7 +33,7 @@ describe Placeholder do
33
33
  expect(rendered_text).to be_empty
34
34
 
35
35
  # Case: locals Hash has a nil value associated to 'foobar'
36
- rendered_text = subject.render(Object.new, { 'foobar' => nil })
36
+ rendered_text = subject.render(Object.new, 'foobar' => nil)
37
37
  expect(rendered_text).to be_empty
38
38
 
39
39
  # Case: context object has a nil value associated to 'foobar'
@@ -47,7 +47,7 @@ describe Placeholder do
47
47
 
48
48
  it 'should render the actual value bound to the placeholder' do
49
49
  # Case: locals Hash has a value associated to 'foobar'
50
- rendered_text = subject.render(Object.new, { 'foobar' => 'hello' })
50
+ rendered_text = subject.render(Object.new, 'foobar' => 'hello')
51
51
  expect(rendered_text).to eq('hello')
52
52
 
53
53
  # Case: context object has a value associated to 'foobar'
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.4.00
4
+ version: 0.4.01
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dimitri Geshef