aslakhellesoy-cucumber 0.1.99.19 → 0.1.99.20

Sign up to get free protection for your applications and to get access to all the features.
@@ -76,6 +76,7 @@ pure Ruby users have been enjoying for a while.
76
76
  ** Full jar and simple jar
77
77
 
78
78
  == Bugfixes
79
+ * Depend on polyglot version (0.2.4) to avoid masking require errors. (Aslak Hellesøy).
79
80
  * -n option does not suppress the line info for a Scenario Outline (#175 Aslak Hellesøy)
80
81
  * Errors with rspec-rails matchers in cucumber 0.1.99 (#173 David Chelimsky)
81
82
  * Can't use an empty string as a table value in a scenario outline (#172 Aslak Hellesøy)
@@ -113,7 +113,6 @@ examples/jbehave/src/main/java/cukes/jbehave/examples/trader/model/Stock.java
113
113
  examples/jbehave/src/main/java/cukes/jbehave/examples/trader/model/Trader.java
114
114
  examples/jbehave/src/main/java/cukes/jbehave/examples/trader/persistence/TraderPersister.java
115
115
  examples/jbehave/src/main/java/cukes/jbehave/examples/trader/scenarios/TraderSteps.java
116
- examples/jbehave/target/maven-archiver/pom.properties
117
116
  examples/selenium/Rakefile
118
117
  examples/selenium/features/search.feature
119
118
  examples/selenium/features/step_definitons/stories_steps.rb
@@ -190,6 +189,7 @@ lib/cucumber/ast/py_string.rb
190
189
  lib/cucumber/ast/scenario.rb
191
190
  lib/cucumber/ast/scenario_outline.rb
192
191
  lib/cucumber/ast/step.rb
192
+ lib/cucumber/ast/steps.rb
193
193
  lib/cucumber/ast/table.rb
194
194
  lib/cucumber/ast/tags.rb
195
195
  lib/cucumber/ast/visitor.rb
@@ -204,6 +204,9 @@ lib/cucumber/core_ext/string.rb
204
204
  lib/cucumber/formatter.rb
205
205
  lib/cucumber/formatter/ansicolor.rb
206
206
  lib/cucumber/formatter/console.rb
207
+ lib/cucumber/formatter/cucumber.css
208
+ lib/cucumber/formatter/cucumber.sass
209
+ lib/cucumber/formatter/html.rb
207
210
  lib/cucumber/formatter/pretty.rb
208
211
  lib/cucumber/formatter/profile.rb
209
212
  lib/cucumber/formatter/progress.rb
@@ -58,7 +58,12 @@ $hoe = Hoe.new(GEM_NAME, VERS) do |p|
58
58
  # == Optional
59
59
  p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
60
60
  #p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
61
- p.extra_deps = [ ['term-ansicolor', '>= 1.0.3'], ['treetop', '>= 1.2.4'], ['diff-lcs', '>= 1.1.2'] ]
61
+ p.extra_deps = [
62
+ ['term-ansicolor', '>= 1.0.3'],
63
+ ['treetop', '>= 1.2.4'],
64
+ ['polyglot', '>= 0.2.4'], # Remove this when Treetop no longer loads polyglot by default.
65
+ ['diff-lcs', '>= 1.1.2']
66
+ ]
62
67
 
63
68
  #p.spec_extras = {} # A hash of extra values to set in the gemspec.
64
69
 
@@ -0,0 +1,25 @@
1
+ module Tag
2
+ # Custom formatter that reports occurrences of each tag
3
+ class Count < Cucumber::Ast::Visitor
4
+ def initialize(step_mother, io, options)
5
+ super(step_mother)
6
+ @io = io
7
+ @counts = Hash.new{|h,k| h[k] = 0}
8
+ end
9
+
10
+ def visit_features(features)
11
+ super
12
+ print_summary
13
+ end
14
+
15
+ def visit_tag_name(tag_name)
16
+ @counts[tag_name] += 1
17
+ end
18
+
19
+ def print_summary
20
+ matrix = @counts.to_a.sort{|paira, pairb| paira[0] <=> pairb[0]}.transpose
21
+ table = Cucumber::Ast::Table.new(matrix)
22
+ Cucumber::Formatter::Pretty.new(@step_mother, @io, {}).visit_multiline_arg(table, :tag)
23
+ end
24
+ end
25
+ end
@@ -1,4 +1,4 @@
1
- Matt's example with a comment before a step
1
+ Feature: Matt's example with a comment before a step
2
2
 
3
3
  Scenario: Upload an image for an artist and create a concert in the process
4
4
  Given I am logged in to my account
@@ -0,0 +1,11 @@
1
+ Feature: Custom Formatter
2
+
3
+ Scenario: count tags
4
+ When I run cucumber --format Tag::Count features
5
+ Then it should fail with
6
+ """
7
+ | four | one | three | two |
8
+ | 1 | 1 | 2 | 1 |
9
+
10
+ """
11
+
@@ -5,6 +5,7 @@ require 'cucumber/ast/feature'
5
5
  require 'cucumber/ast/scenario'
6
6
  require 'cucumber/ast/scenario_outline'
7
7
  require 'cucumber/ast/background'
8
+ require 'cucumber/ast/steps'
8
9
  require 'cucumber/ast/step'
9
10
  require 'cucumber/ast/table'
10
11
  require 'cucumber/ast/py_string'
@@ -7,7 +7,7 @@ module Cucumber
7
7
 
8
8
  def accept(visitor)
9
9
  visitor.visit_examples_name(@keyword, @name)
10
- @outline_table.accept(visitor, nil)
10
+ visitor.visit_outline_table(@outline_table)
11
11
  end
12
12
 
13
13
  def each_example_row(&proc)
@@ -2,11 +2,12 @@ module Cucumber
2
2
  module Ast
3
3
  class Scenario
4
4
  attr_writer :feature, :background
5
-
5
+
6
6
  def initialize(comment, tags, line, keyword, name, steps)
7
7
  @comment, @tags, @line, @keyword, @name = comment, tags, line, keyword, name
8
8
  steps.each {|step| step.scenario = self}
9
9
  @steps = steps
10
+ @steps_helper = Steps.new(self)
10
11
  end
11
12
 
12
13
  def status
@@ -26,10 +27,15 @@ module Cucumber
26
27
  visitor.visit_comment(@comment)
27
28
  visitor.visit_tags(@tags)
28
29
  visitor.visit_scenario_name(@keyword, @name, file_line(@line), source_indent(text_length))
30
+ visitor.visit_steps(@steps_helper)
31
+
32
+ @feature.scenario_executed(self) if @feature && !@executed
33
+ @executed = true
34
+ end
29
35
 
36
+ def accept_steps(visitor)
30
37
  prior_world = @background ? @background.world : nil
31
38
  visitor.world(self, prior_world) do |world|
32
-
33
39
  previous = @background ? @background.status : :passed
34
40
  @steps.each do |step|
35
41
  step.previous = previous
@@ -38,8 +44,6 @@ module Cucumber
38
44
  previous = step.status
39
45
  end
40
46
  end
41
- @feature.scenario_executed(self) if @feature && !@executed
42
- @executed = true
43
47
  end
44
48
 
45
49
  def source_indent(text_length)
@@ -31,9 +31,8 @@ module Cucumber
31
31
  visitor.visit_comment(@comment)
32
32
  visitor.visit_tags(@tags)
33
33
  visitor.visit_scenario_name(@keyword, @name, file_line(@line), source_indent(text_length))
34
- @steps.each do |step|
35
- visitor.visit_step(step)
36
- end
34
+ visitor.visit_steps(@steps_helper)
35
+
37
36
  @examples_array.each do |examples|
38
37
  visitor.visit_examples(examples)
39
38
  end
@@ -0,0 +1,13 @@
1
+ module Cucumber
2
+ module Ast
3
+ class Steps
4
+ def initialize(scenario)
5
+ @scenario = scenario
6
+ end
7
+
8
+ def accept(visitor)
9
+ @scenario.accept_steps(visitor)
10
+ end
11
+ end
12
+ end
13
+ end
@@ -11,7 +11,7 @@ module Cucumber
11
11
  def world(scenario, world = nil, &proc)
12
12
  @step_mother.world(scenario, world, &proc)
13
13
  end
14
-
14
+
15
15
  def new_world
16
16
  @step_mother.new_world
17
17
  end
@@ -57,7 +57,7 @@ module Cucumber
57
57
  def visit_feature_element(feature_element)
58
58
  feature_element.accept(self)
59
59
  end
60
-
60
+
61
61
  def visit_background(background)
62
62
  background.accept(self)
63
63
  end
@@ -69,9 +69,17 @@ module Cucumber
69
69
  def visit_examples_name(keyword, name)
70
70
  end
71
71
 
72
+ def visit_outline_table(outline_table)
73
+ outline_table.accept(self, nil)
74
+ end
75
+
72
76
  def visit_scenario_name(keyword, name, file_line, source_indent)
73
77
  end
74
78
 
79
+ def visit_steps(steps)
80
+ steps.accept(self)
81
+ end
82
+
75
83
  def visit_step(step)
76
84
  step.accept(self)
77
85
  end
@@ -201,10 +201,11 @@ module Cucumber
201
201
 
202
202
  def formatter_class(format)
203
203
  case format
204
- when 'pretty' then Formatter::Pretty
205
- when 'progress' then Formatter::Progress
206
- when 'profile' then Formatter::Profile
207
- when 'rerun' then Formatter::Rerun
204
+ when 'pretty' then Formatter::Pretty
205
+ when 'progress' then Formatter::Progress
206
+ when 'profile' then Formatter::Profile
207
+ when 'rerun' then Formatter::Rerun
208
+ when 'html' then Formatter::Html
208
209
  else
209
210
  constantize(format)
210
211
  end
@@ -1 +1 @@
1
- %w{pretty progress profile rerun}.each{|n| require "cucumber/formatter/#{n}"}
1
+ %w{pretty progress profile rerun html}.each{|n| require "cucumber/formatter/#{n}"}
@@ -0,0 +1,55 @@
1
+
2
+
3
+
4
+
5
+
6
+ .cucumber {
7
+ background: black;
8
+ color: white;
9
+ padding: 1em;
10
+ }
11
+ .cucumber .passed {
12
+ color: green;
13
+ }
14
+ .cucumber .undefined {
15
+ color: yellow;
16
+ }
17
+ .cucumber .pending {
18
+ color: yellow;
19
+ }
20
+ .cucumber .failed {
21
+ color: red;
22
+ }
23
+ .cucumber .skipped {
24
+ color: cyan;
25
+ }
26
+ .cucumber .outline {
27
+ color: cyan;
28
+ }
29
+ .cucumber .param {
30
+ font-weight: bold;
31
+ }
32
+ .cucumber a {
33
+ text-decoration: none;
34
+ color: inherit;
35
+ }
36
+ .cucumber a:hover {
37
+ text-decoration: underline;
38
+ }
39
+ .cucumber a:visited {
40
+ font-weight: normal;
41
+ }
42
+ .cucumber ol {
43
+ list-style: none;
44
+ }
45
+ .cucumber .stats {
46
+ margin: 2em;
47
+ }
48
+ .cucumber .summary ul.features li {
49
+ display: inline;
50
+ }
51
+ .cucumber .backtrace {
52
+ margin-top: 0;
53
+ margin-bottom: 0;
54
+ margin-left: 1em;
55
+ }
@@ -0,0 +1,49 @@
1
+ # cucumber.css is generated from cucumber.sass
2
+ # Regenerate with the following command:
3
+ #
4
+ # sass -t expanded lib/cucumber/formatter/cucumber.sass > lib/cucumber/formatter/cucumber.css
5
+ #
6
+ .cucumber
7
+ :background black
8
+ :color white
9
+ :padding 1em
10
+
11
+ .passed
12
+ :color green
13
+ .undefined
14
+ :color yellow
15
+ .pending
16
+ :color yellow
17
+ .failed
18
+ :color red
19
+ .skipped
20
+ :color cyan
21
+ .outline
22
+ :color cyan
23
+ .param
24
+ :font-weight bold
25
+
26
+ a
27
+ :text-decoration none
28
+ :color inherit
29
+
30
+ &:hover
31
+ :text-decoration underline
32
+ &:visited
33
+ :font-weight normal
34
+
35
+ ol
36
+ :list-style none
37
+
38
+ .stats
39
+ :margin 2em
40
+
41
+ .summary
42
+ ul.features
43
+ li
44
+ :display inline
45
+
46
+ .backtrace
47
+ :margin-top 0
48
+ :margin-bottom 0
49
+ :margin-left 1em
@@ -0,0 +1,121 @@
1
+ require 'builder'
2
+
3
+ module Cucumber
4
+ module Formatter
5
+ class Html < Ast::Visitor
6
+ def initialize(step_mother, io, options)
7
+ super(step_mother)
8
+ @builder = Builder::XmlMarkup.new(:target => io, :indent => 2)
9
+ end
10
+
11
+ def visit_features(features)
12
+ # <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
13
+ @builder.declare!(
14
+ :DOCTYPE,
15
+ :html,
16
+ :PUBLIC,
17
+ '-//W3C//DTD XHTML 1.0 Strict//EN',
18
+ 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'
19
+ )
20
+ @builder.html(:xmlns => 'http://www.w3.org/1999/xhtml') do
21
+ @builder.head do
22
+ @builder.title 'Cucumber'
23
+ inline_css
24
+ end
25
+ @builder.body do
26
+ @builder.div(:class => 'cucumber') do
27
+ super
28
+ end
29
+ end
30
+ end
31
+ end
32
+
33
+ def visit_feature(feature)
34
+ @builder.div(:class => 'feature') do
35
+ super
36
+ end
37
+ end
38
+
39
+ def visit_feature_name(name)
40
+ lines = name.split(/\r?\n/)
41
+ @builder.h2(lines[0])
42
+ @builder.p do
43
+ lines[1..-1].each do |line|
44
+ @builder.text!(line.strip)
45
+ @builder.br
46
+ end
47
+ end
48
+ end
49
+
50
+ def visit_background(background)
51
+ @builder.div(:class => 'background') do
52
+ @builder.ol do
53
+ super
54
+ end
55
+ end
56
+ end
57
+
58
+ def visit_feature_element(feature_element)
59
+ @builder.div(:class => 'scenario') do
60
+ super
61
+ end
62
+ @open_step_list = true
63
+ end
64
+
65
+ def visit_scenario_name(keyword, name, file_line, source_indent)
66
+ @builder.h3("#{keyword} #{name}")
67
+ end
68
+
69
+ def visit_outline_table(outline_table)
70
+ @builder.table do
71
+ super(outline_table)
72
+ end
73
+ end
74
+
75
+ def visit_examples_name(keyword, name)
76
+ @builder.h4("#{keyword} #{name}")
77
+ end
78
+
79
+ def visit_steps(scenarios)
80
+ @builder.ol do
81
+ super
82
+ end
83
+ end
84
+
85
+ def visit_step_name(keyword, step_name, status, step_definition, source_indent)
86
+ @builder.li("#{keyword} #{step_name}", :class => status)
87
+ end
88
+
89
+ def visit_multiline_arg(multiline_arg, status)
90
+ if Ast::Table === multiline_arg
91
+ @builder.table do
92
+ super(multiline_arg, status)
93
+ end
94
+ else
95
+ @builder.p do
96
+ super(multiline_arg, status)
97
+ end
98
+ end
99
+ end
100
+
101
+ def visit_table_row(table_row, status)
102
+ @builder.tr do
103
+ super(table_row, status)
104
+ end
105
+ end
106
+
107
+ def visit_table_cell_value(value, width, status)
108
+ @builder.td(value, :class => status)
109
+ end
110
+
111
+ private
112
+
113
+ def inline_css
114
+ @builder.style(:type => 'text/css') do
115
+ @builder.text!(File.read(File.dirname(__FILE__) + '/cucumber.css'))
116
+ end
117
+ end
118
+
119
+ end
120
+ end
121
+ end
@@ -258,8 +258,11 @@
258
258
  name: Portuguese
259
259
  native: português
260
260
  encoding: UTF-8
261
+ background: Contexto
261
262
  feature: Característica
262
263
  scenario: Cenário
264
+ scenario_outline: Esquema do Cenário
265
+ examples: Exemplos
263
266
  given: Dado
264
267
  when: Quando
265
268
  then: Então
@@ -670,27 +670,13 @@ module Cucumber
670
670
  s0 << r7
671
671
  if r7
672
672
  i8 = index
673
- s9, i9 = [], index
674
- loop do
675
- r10 = _nt_eol
676
- if r10
677
- s9 << r10
678
- else
679
- break
680
- end
681
- end
682
- if s9.empty?
683
- self.index = i9
684
- r9 = nil
685
- else
686
- r9 = SyntaxNode.new(input, i9...index, s9)
687
- end
673
+ r9 = _nt_white
688
674
  if r9
689
675
  r8 = r9
690
676
  else
691
- r11 = _nt_eof
692
- if r11
693
- r8 = r11
677
+ r10 = _nt_eof
678
+ if r10
679
+ r8 = r10
694
680
  else
695
681
  self.index = i8
696
682
  r8 = nil
@@ -698,11 +684,11 @@ module Cucumber
698
684
  end
699
685
  s0 << r8
700
686
  if r8
701
- r12 = _nt_steps
702
- s0 << r12
703
- if r12
704
- r13 = _nt_white
705
- s0 << r13
687
+ r11 = _nt_steps
688
+ s0 << r11
689
+ if r11
690
+ r12 = _nt_white
691
+ s0 << r12
706
692
  end
707
693
  end
708
694
  end
@@ -77,7 +77,7 @@ module Cucumber
77
77
  end
78
78
 
79
79
  rule scenario
80
- comment tags white scenario_keyword space* name:line_to_eol (eol+ / eof) steps white {
80
+ comment tags white scenario_keyword space* name:line_to_eol (white / eof) steps white {
81
81
  def build
82
82
  Ast::Scenario.new(
83
83
  comment.build,
@@ -3,7 +3,7 @@ module Cucumber #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
5
  TINY = 99
6
- PATCH = 19 # Set to nil for official release
6
+ PATCH = 20 # Set to nil for official release
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PATCH].compact.join('.')
9
9
  end
@@ -1,5 +1,5 @@
1
1
  # Sets up the Rails environment for Cucumber
2
- ENV["RAILS_ENV"] = "test"
2
+ ENV["RAILS_ENV"] ||= "test"
3
3
  require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
4
4
  require 'cucumber/rails/world'
5
5
  require 'cucumber/formatters/unicode' # Comment out this line if you don't want Cucumber Unicode support
@@ -123,6 +123,14 @@ Feature: hi
123
123
  [:scenario, 3, "Scenario:", "Hello"]]
124
124
  end
125
125
 
126
+ it "should allow whitespace lines after the Scenario line" do
127
+ parse(%{Feature: Foo
128
+
129
+ Scenario: bar
130
+
131
+ Given baz})
132
+ end
133
+
126
134
  it "should have steps" do
127
135
  parse("Feature: Hi\nScenario: Hello\nGiven I am a step\n").to_sexp.should ==
128
136
  [:feature, "Feature: Hi",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aslakhellesoy-cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.99.19
4
+ version: 0.1.99.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Aslak Helles\xC3\xB8y"
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-02-02 00:00:00 -08:00
12
+ date: 2009-02-04 00:00:00 -08:00
13
13
  default_executable: cucumber
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -30,6 +30,15 @@ dependencies:
30
30
  - !ruby/object:Gem::Version
31
31
  version: 1.2.4
32
32
  version:
33
+ - !ruby/object:Gem::Dependency
34
+ name: polyglot
35
+ version_requirement:
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 0.2.4
41
+ version:
33
42
  - !ruby/object:Gem::Dependency
34
43
  name: diff-lcs
35
44
  version_requirement:
@@ -177,7 +186,6 @@ files:
177
186
  - examples/jbehave/src/main/java/cukes/jbehave/examples/trader/model/Trader.java
178
187
  - examples/jbehave/src/main/java/cukes/jbehave/examples/trader/persistence/TraderPersister.java
179
188
  - examples/jbehave/src/main/java/cukes/jbehave/examples/trader/scenarios/TraderSteps.java
180
- - examples/jbehave/target/maven-archiver/pom.properties
181
189
  - examples/selenium/Rakefile
182
190
  - examples/selenium/features/search.feature
183
191
  - examples/selenium/features/step_definitons/stories_steps.rb
@@ -196,6 +204,7 @@ files:
196
204
  - examples/self_test/features/sample.feature
197
205
  - examples/self_test/features/step_definitions/sample_steps.rb
198
206
  - examples/self_test/features/support/env.rb
207
+ - examples/self_test/features/support/tag_count_formatter.rb
199
208
  - examples/test_unit/Rakefile
200
209
  - examples/test_unit/features/step_definitions/test_unit_steps.rb
201
210
  - examples/test_unit/features/test_unit.feature
@@ -220,6 +229,7 @@ files:
220
229
  - features/background.feature
221
230
  - features/cucumber_cli.feature
222
231
  - features/cucumber_cli_outlines.feature
232
+ - features/custom_formatter.feature
223
233
  - features/report_called_undefined_steps.feature
224
234
  - features/step_definitions/cucumber_steps.rb
225
235
  - features/step_definitions/extra_steps.rb
@@ -252,6 +262,7 @@ files:
252
262
  - lib/cucumber/ast/scenario.rb
253
263
  - lib/cucumber/ast/scenario_outline.rb
254
264
  - lib/cucumber/ast/step.rb
265
+ - lib/cucumber/ast/steps.rb
255
266
  - lib/cucumber/ast/table.rb
256
267
  - lib/cucumber/ast/tags.rb
257
268
  - lib/cucumber/ast/visitor.rb
@@ -266,6 +277,9 @@ files:
266
277
  - lib/cucumber/formatter.rb
267
278
  - lib/cucumber/formatter/ansicolor.rb
268
279
  - lib/cucumber/formatter/console.rb
280
+ - lib/cucumber/formatter/cucumber.css
281
+ - lib/cucumber/formatter/cucumber.sass
282
+ - lib/cucumber/formatter/html.rb
269
283
  - lib/cucumber/formatter/pretty.rb
270
284
  - lib/cucumber/formatter/profile.rb
271
285
  - lib/cucumber/formatter/progress.rb