cucumber 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. data/History.txt +81 -0
  2. data/Manifest.txt +30 -9
  3. data/README.txt +1 -2
  4. data/bin/cucumber +1 -1
  5. data/examples/calculator/README.txt +5 -0
  6. data/examples/calculator/Rakefile +1 -2
  7. data/examples/calculator/features/addition.feature +1 -0
  8. data/examples/chinese_simplified_calculator/Rakefile +6 -0
  9. data/examples/chinese_simplified_calculator/features/addition.feature +17 -0
  10. data/examples/chinese_simplified_calculator/features/steps/calculator_steps.rb +24 -0
  11. data/examples/chinese_simplified_calculator/lib/calculator.rb +10 -0
  12. data/examples/java/features/steps/hello_steps.rb +1 -1
  13. data/examples/swedish_calculator/Rakefile +5 -0
  14. data/examples/swedish_calculator/features/steps/kalkulator_steps.rb +22 -0
  15. data/examples/swedish_calculator/features/summering.feature +17 -0
  16. data/examples/swedish_calculator/lib/kalkulator.rb +11 -0
  17. data/examples/tickets/Rakefile +8 -1
  18. data/examples/tickets/cucumber.yml +2 -0
  19. data/examples/tickets/features/steps/tickets_steps.rb +15 -0
  20. data/examples/tickets/features/tickets.feature +12 -1
  21. data/gem_tasks/treetop.rake +35 -23
  22. data/lib/cucumber.rb +1 -0
  23. data/lib/cucumber/cli.rb +19 -5
  24. data/lib/cucumber/core_ext/proc.rb +8 -5
  25. data/lib/cucumber/executor.rb +7 -1
  26. data/lib/cucumber/formatters.rb +1 -1
  27. data/lib/cucumber/formatters/html_formatter.rb +6 -3
  28. data/lib/cucumber/formatters/pretty_formatter.rb +29 -7
  29. data/lib/cucumber/formatters/profile_formatter.rb +92 -0
  30. data/lib/cucumber/languages.yml +39 -12
  31. data/lib/cucumber/model.rb +1 -0
  32. data/lib/cucumber/model/table.rb +28 -0
  33. data/lib/cucumber/rails/world.rb +1 -3
  34. data/lib/cucumber/rake/task.rb +1 -1
  35. data/lib/cucumber/tree/feature.rb +8 -2
  36. data/lib/cucumber/tree/scenario.rb +23 -6
  37. data/lib/cucumber/tree/step.rb +5 -4
  38. data/lib/cucumber/treetop_parser/feature.treetop.erb +54 -12
  39. data/lib/cucumber/treetop_parser/feature_da.rb +415 -74
  40. data/lib/cucumber/treetop_parser/feature_de.rb +415 -74
  41. data/lib/cucumber/treetop_parser/feature_en.rb +415 -74
  42. data/lib/cucumber/treetop_parser/feature_es.rb +415 -74
  43. data/lib/cucumber/treetop_parser/feature_et.rb +415 -74
  44. data/lib/cucumber/treetop_parser/feature_fr.rb +415 -74
  45. data/lib/cucumber/treetop_parser/feature_nl.rb +1593 -0
  46. data/lib/cucumber/treetop_parser/feature_no.rb +415 -74
  47. data/lib/cucumber/treetop_parser/feature_pt.rb +415 -74
  48. data/lib/cucumber/treetop_parser/feature_ru.rb +415 -74
  49. data/lib/cucumber/treetop_parser/feature_se.rb +419 -78
  50. data/lib/cucumber/treetop_parser/feature_zh-CN.rb +1593 -0
  51. data/lib/cucumber/version.rb +1 -1
  52. data/{generators → rails_generators}/cucumber/cucumber_generator.rb +0 -0
  53. data/{generators → rails_generators}/cucumber/templates/common_webrat.rb +1 -10
  54. data/{generators → rails_generators}/cucumber/templates/cucumber +0 -0
  55. data/{generators → rails_generators}/cucumber/templates/cucumber.rake +0 -0
  56. data/{generators → rails_generators}/cucumber/templates/env.rb +0 -0
  57. data/{generators → rails_generators}/feature/feature_generator.rb +0 -0
  58. data/{generators → rails_generators}/feature/templates/feature.erb +1 -0
  59. data/{generators → rails_generators}/feature/templates/steps.erb +0 -0
  60. data/spec/cucumber/cli_spec.rb +11 -3
  61. data/spec/cucumber/core_ext/proc_spec.rb +6 -0
  62. data/spec/cucumber/formatters/html_formatter_spec.rb +16 -1
  63. data/spec/cucumber/formatters/pretty_formatter_spec.rb +54 -25
  64. data/spec/cucumber/formatters/profile_formatter_spec.rb +193 -0
  65. data/spec/cucumber/model/table_spec.rb +20 -0
  66. data/spec/cucumber/rails/stubs/mini_rails.rb +17 -0
  67. data/spec/cucumber/rails/stubs/test_help.rb +1 -0
  68. data/spec/cucumber/rails/world_spec.rb +11 -0
  69. data/spec/cucumber/tree/feature_spec.rb +12 -0
  70. data/spec/cucumber/tree/scenario_spec.rb +22 -0
  71. data/spec/cucumber/tree/step_spec.rb +12 -2
  72. data/spec/cucumber/treetop_parser/empty_scenario.feature +1 -1
  73. data/spec/cucumber/treetop_parser/feature_parser_spec.rb +18 -0
  74. data/spec/cucumber/treetop_parser/fit_scenario.feature +1 -0
  75. data/spec/cucumber/treetop_parser/multiline_steps.feature +13 -0
  76. data/spec/cucumber/treetop_parser/multiple_tables.feature +2 -0
  77. data/spec/cucumber/treetop_parser/test_dos.feature +1 -0
  78. data/spec/cucumber/treetop_parser/with_comments.feature +6 -2
  79. metadata +34 -12
  80. data/examples/calculator/cucumber.yml +0 -1
@@ -0,0 +1,17 @@
1
+ # Define some stubs to fake Rails...
2
+ module ActiveRecord
3
+ class Base
4
+ end
5
+ end
6
+
7
+ module ActionController
8
+ class Base
9
+ end
10
+ class IntegrationTest
11
+ def self.use_transactional_fixtures=(x)
12
+ end
13
+ end
14
+ end
15
+
16
+ module Dispatcher
17
+ end
@@ -0,0 +1 @@
1
+ # This file is loaded by rails/world.rb
@@ -0,0 +1,11 @@
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
+ $:.unshift(File.dirname(__FILE__) + '/stubs')
3
+
4
+ describe "Rails world" do
5
+
6
+ it "should run without Test::Unit.run defined" do
7
+ require "mini_rails"
8
+ require "cucumber/rails/world"
9
+ end
10
+
11
+ end
@@ -0,0 +1,12 @@
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
+
3
+ module Cucumber
4
+ module Tree
5
+ describe Feature do
6
+ it "should have padding_length 2 when alone" do
7
+ feature = Feature.new('header')
8
+ feature.padding_length.should == 2
9
+ end
10
+ end
11
+ end
12
+ end
@@ -10,6 +10,28 @@ module Cucumber
10
10
  scenario_2.create_step(step_a)
11
11
  scenario_2.steps.should == [step_1, step_2, step_a]
12
12
  end
13
+
14
+ it "should have padding_length 2 when alone" do
15
+ scenario = Scenario.new(nil, 'test', 1)
16
+ scenario.padding_length.should == 2
17
+ end
18
+
19
+ it "should include indent when padding to step" do
20
+ scenario = Scenario.new(nil, '', 1)
21
+ scenario.create_step('Given', 'a long step', 1)
22
+
23
+ #Scenario: ***********
24
+ # Given a long step
25
+ scenario.padding_length.should == 9 + 2 #Allow for indent
26
+ end
27
+
28
+ it "should ignore step padding if scenario is longer than all steps" do
29
+ scenario = Scenario.new(nil, 'Very long scenario and then some', 1)
30
+ scenario.create_step('Given', 'test', 1)
31
+
32
+ scenario.padding_length.should == 2
33
+ end
34
+
13
35
  end
14
36
  end
15
37
  end
@@ -4,17 +4,27 @@ module Cucumber
4
4
  module Tree
5
5
  describe Step do
6
6
  it "should have padding_length 2 when alone" do
7
- scenario = Scenario.new(nil, nil)
7
+ scenario = Scenario.new(nil, nil, 1)
8
8
  step = scenario.create_step('Given', '666666', 98)
9
9
  step.padding_length.should == 2
10
10
  end
11
11
 
12
12
  it "should have padding_length 5 when 3 shorter" do
13
- scenario = Scenario.new(nil, nil)
13
+ scenario = Scenario.new(nil, nil, 1)
14
14
  long = scenario.create_step('Given', '999999999', 80)
15
15
  step = scenario.create_step('Given', '666666', 98)
16
16
  step.padding_length.should == 5
17
17
  end
18
+
19
+ it "should remove indent from padding_length if padding to scenario" do
20
+ scenario = Scenario.new(nil, '9', 1)
21
+ step = scenario.create_step('Given', '9', 80)
22
+
23
+ #Scenario: 9 #
24
+ # Given 9****
25
+ step.padding_length.should == 4
26
+ end
27
+
18
28
  end
19
29
  end
20
30
  end
@@ -1,4 +1,4 @@
1
- Feature: Empty Scenarios should work
1
+ Feature: Empty scenarios should work
2
2
 
3
3
  Scenario: Complete scenario
4
4
  Given a valid API key
@@ -47,6 +47,18 @@ module Cucumber
47
47
  f.scenarios[0].should have(2).steps
48
48
  end
49
49
 
50
+ it "should skip comments in feature header" do
51
+ p = FeatureParser.new
52
+ f = p.parse_feature(File.dirname(__FILE__) + '/with_comments.feature')
53
+ f.header.should == "Some header"
54
+ end
55
+
56
+ it "should skip comments in scenario header" do
57
+ p = FeatureParser.new
58
+ f = p.parse_feature(File.dirname(__FILE__) + '/with_comments.feature')
59
+ f.scenarios[0].name.should == "Some scenario"
60
+ end
61
+
50
62
  it "should allow empty scenarios" do
51
63
  p = FeatureParser.new
52
64
  f = p.parse_feature(File.dirname(__FILE__) + '/empty_scenario.feature')
@@ -73,6 +85,12 @@ module Cucumber
73
85
  f = p.parse_feature(File.dirname(__FILE__) + '/test_dos.feature')
74
86
  f.should have(5).scenarios
75
87
  end
88
+
89
+ it "should parse multiline steps" do
90
+ p = FeatureParser.new
91
+ f = p.parse_feature(File.dirname(__FILE__) + '/multiline_steps.feature')
92
+ f.should have(1).scenarios
93
+ end
76
94
  end
77
95
  end
78
96
  end
@@ -3,5 +3,6 @@ Some title
3
3
  Scenario: second
4
4
  Given 'bind me please'
5
5
 
6
+ More Examples:
6
7
  |c|
7
8
  |I can have spaces|
@@ -0,0 +1,13 @@
1
+ Feature: Multiline steps should work
2
+
3
+ Scenario: Reading a table
4
+ Given the following table
5
+ | where | why |
6
+ | Oslo | born |
7
+ | London| working |
8
+ Then I should be working in London
9
+ And I should be born in Oslo
10
+ And I should be able to expect
11
+ "A string
12
+ that spans
13
+ several lines"
@@ -10,6 +10,7 @@ Feature: Addition
10
10
  Then the result should be 120 on the screen
11
11
  And the result class should be Fixnum
12
12
 
13
+ More Examples:
13
14
  | input_1 | input_2 | button | output | class |
14
15
  | 20 | 30 | add | 50 | Fixnum |
15
16
  | 2 | 5 | add | 7 | Fixnum |
@@ -23,5 +24,6 @@ Feature: Addition
23
24
  Then the result should be 50 on the screen
24
25
  And the result class should be Fixnum
25
26
 
27
+ More Examples:
26
28
  | input_1 | input_2 | input_3 | button | output | class |
27
29
  | 1 | 2 | 3 | add | 6 | Fixnum |
@@ -8,6 +8,7 @@ Feature: Search
8
8
  When the string is reversed
9
9
  Then the string should be "cba"
10
10
 
11
+ More Examples:
11
12
  |input |output|
12
13
  |a |a |
13
14
  |ab |ba |
@@ -1,6 +1,10 @@
1
- Some title
1
+ # Header title
2
+ # Two lines
3
+ Some header
2
4
 
3
- Scenario: hello
5
+ # Scenario header
6
+ # on two lines
7
+ Scenario: Some scenario
4
8
  Given one
5
9
  # When two
6
10
  Then three
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
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: 2008-10-05 00:00:00 +02:00
12
+ date: 2008-10-18 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -60,7 +60,7 @@ dependencies:
60
60
  requirements:
61
61
  - - ">="
62
62
  - !ruby/object:Gem::Version
63
- version: 1.7.0
63
+ version: 1.8.0
64
64
  version:
65
65
  description: Executable Feature scenarios
66
66
  email:
@@ -75,6 +75,7 @@ extra_rdoc_files:
75
75
  - Manifest.txt
76
76
  - README.txt
77
77
  - TODO.txt
78
+ - examples/calculator/README.txt
78
79
  files:
79
80
  - History.txt
80
81
  - License.txt
@@ -86,8 +87,8 @@ files:
86
87
  - config/hoe.rb
87
88
  - config/requirements.rb
88
89
  - cucumber.yml
90
+ - examples/calculator/README.txt
89
91
  - examples/calculator/Rakefile
90
- - examples/calculator/cucumber.yml
91
92
  - examples/calculator/features/addition.feature
92
93
  - examples/calculator/features/division.feature
93
94
  - examples/calculator/features/steps/calculator_steps.rb
@@ -98,6 +99,10 @@ files:
98
99
  - examples/calculatrice_francaise_avec_soit_scenario/Rakefile
99
100
  - examples/calculatrice_francaise_avec_soit_scenario/features/addition.feature
100
101
  - examples/calculatrice_francaise_avec_soit_scenario/features/calculatrice_steps.rb
102
+ - examples/chinese_simplified_calculator/Rakefile
103
+ - examples/chinese_simplified_calculator/features/addition.feature
104
+ - examples/chinese_simplified_calculator/features/steps/calculator_steps.rb
105
+ - examples/chinese_simplified_calculator/lib/calculator.rb
101
106
  - examples/cs/README.textile
102
107
  - examples/cs/Rakefile
103
108
  - examples/cs/features/hello.feature
@@ -135,7 +140,12 @@ files:
135
140
  - examples/spanish_calculator/features/adicion.feature
136
141
  - examples/spanish_calculator/features/steps/calculador_steps.rb
137
142
  - examples/spanish_calculator/lib/Calculador.rb
143
+ - examples/swedish_calculator/Rakefile
144
+ - examples/swedish_calculator/features/steps/kalkulator_steps.rb
145
+ - examples/swedish_calculator/features/summering.feature
146
+ - examples/swedish_calculator/lib/kalkulator.rb
138
147
  - examples/tickets/Rakefile
148
+ - examples/tickets/cucumber.yml
139
149
  - examples/tickets/features/steps/tickets_steps.rb
140
150
  - examples/tickets/features/tickets.feature
141
151
  - examples/watir/Rakefile
@@ -151,14 +161,6 @@ files:
151
161
  - gem_tasks/gemspec.rake
152
162
  - gem_tasks/rspec.rake
153
163
  - gem_tasks/treetop.rake
154
- - generators/cucumber/cucumber_generator.rb
155
- - generators/cucumber/templates/common_webrat.rb
156
- - generators/cucumber/templates/cucumber
157
- - generators/cucumber/templates/cucumber.rake
158
- - generators/cucumber/templates/env.rb
159
- - generators/feature/feature_generator.rb
160
- - generators/feature/templates/feature.erb
161
- - generators/feature/templates/steps.erb
162
164
  - lib/cucumber.rb
163
165
  - lib/cucumber/cli.rb
164
166
  - lib/cucumber/core_ext/proc.rb
@@ -171,8 +173,11 @@ files:
171
173
  - lib/cucumber/formatters/html_formatter.rb
172
174
  - lib/cucumber/formatters/jquery.js
173
175
  - lib/cucumber/formatters/pretty_formatter.rb
176
+ - lib/cucumber/formatters/profile_formatter.rb
174
177
  - lib/cucumber/formatters/progress_formatter.rb
175
178
  - lib/cucumber/languages.yml
179
+ - lib/cucumber/model.rb
180
+ - lib/cucumber/model/table.rb
176
181
  - lib/cucumber/rails/rspec.rb
177
182
  - lib/cucumber/rails/world.rb
178
183
  - lib/cucumber/rake/task.rb
@@ -193,12 +198,22 @@ files:
193
198
  - lib/cucumber/treetop_parser/feature_es.rb
194
199
  - lib/cucumber/treetop_parser/feature_et.rb
195
200
  - lib/cucumber/treetop_parser/feature_fr.rb
201
+ - lib/cucumber/treetop_parser/feature_nl.rb
196
202
  - lib/cucumber/treetop_parser/feature_no.rb
197
203
  - lib/cucumber/treetop_parser/feature_parser.rb
198
204
  - lib/cucumber/treetop_parser/feature_pt.rb
199
205
  - lib/cucumber/treetop_parser/feature_ru.rb
200
206
  - lib/cucumber/treetop_parser/feature_se.rb
207
+ - lib/cucumber/treetop_parser/feature_zh-CN.rb
201
208
  - lib/cucumber/version.rb
209
+ - rails_generators/cucumber/cucumber_generator.rb
210
+ - rails_generators/cucumber/templates/common_webrat.rb
211
+ - rails_generators/cucumber/templates/cucumber
212
+ - rails_generators/cucumber/templates/cucumber.rake
213
+ - rails_generators/cucumber/templates/env.rb
214
+ - rails_generators/feature/feature_generator.rb
215
+ - rails_generators/feature/templates/feature.erb
216
+ - rails_generators/feature/templates/steps.erb
202
217
  - script/console
203
218
  - script/console.cmd
204
219
  - script/destroy
@@ -216,9 +231,15 @@ files:
216
231
  - spec/cucumber/formatters/features.html
217
232
  - spec/cucumber/formatters/html_formatter_spec.rb
218
233
  - spec/cucumber/formatters/pretty_formatter_spec.rb
234
+ - spec/cucumber/formatters/profile_formatter_spec.rb
219
235
  - spec/cucumber/formatters/progress_formatter_spec.rb
236
+ - spec/cucumber/model/table_spec.rb
237
+ - spec/cucumber/rails/stubs/mini_rails.rb
238
+ - spec/cucumber/rails/stubs/test_help.rb
239
+ - spec/cucumber/rails/world_spec.rb
220
240
  - spec/cucumber/sell_cucumbers.feature
221
241
  - spec/cucumber/step_mother_spec.rb
242
+ - spec/cucumber/tree/feature_spec.rb
222
243
  - spec/cucumber/tree/scenario_spec.rb
223
244
  - spec/cucumber/tree/step_spec.rb
224
245
  - spec/cucumber/treetop_parser/empty_feature.feature
@@ -226,6 +247,7 @@ files:
226
247
  - spec/cucumber/treetop_parser/feature_parser_spec.rb
227
248
  - spec/cucumber/treetop_parser/fit_scenario.feature
228
249
  - spec/cucumber/treetop_parser/given_scenario.feature
250
+ - spec/cucumber/treetop_parser/multiline_steps.feature
229
251
  - spec/cucumber/treetop_parser/multiple_tables.feature
230
252
  - spec/cucumber/treetop_parser/spaces.feature
231
253
  - spec/cucumber/treetop_parser/test_dos.feature
@@ -1 +0,0 @@
1
- default: --format pretty features