cucumber 0.1.12 → 0.1.13

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 (101) hide show
  1. data/History.txt +38 -3
  2. data/Manifest.txt +17 -1
  3. data/README.txt +2 -39
  4. data/bin/cucumber +1 -1
  5. data/examples/calculator_ruby_features/features/addition.rb +16 -0
  6. data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +1 -1
  7. data/examples/i18n/da/features/step_definitons/kalkulator_steps.rb +1 -0
  8. data/examples/i18n/de/features/step_definitons/calculator_steps.rb +1 -0
  9. data/examples/i18n/en/features/step_definitons/calculator_steps.rb +1 -0
  10. data/examples/i18n/es/features/step_definitons/calculador_steps.rb +1 -0
  11. data/examples/i18n/et/features/step_definitions/kalkulaator_steps.rb +1 -0
  12. data/examples/i18n/fr/features/addition.feature +13 -11
  13. data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +6 -2
  14. data/examples/i18n/id/features/step_definitons/calculator_steps.rb +1 -0
  15. data/examples/i18n/it/features/step_definitons/calcolatrice_steps.rb +1 -0
  16. data/examples/i18n/ja/features/step_definitons/calculator_steps.rb +2 -0
  17. data/examples/i18n/lt/features/step_definitons/calculator_steps.rb +1 -0
  18. data/examples/i18n/no/features/step_definitons/kalkulator_steps.rb +1 -0
  19. data/examples/i18n/pt/features/step_definitions/calculadora_steps.rb +1 -0
  20. data/examples/i18n/ro/features/step_definitons/calculator_steps.rb +1 -0
  21. data/examples/i18n/se/features/step_definitons/kalkulator_steps.rb +1 -0
  22. data/examples/i18n/zh-CN/features/step_definitons/calculator_steps.rb +1 -0
  23. data/examples/selenium/features/search.feature +1 -1
  24. data/examples/selenium/features/step_definitons/stories_steps.rb +2 -3
  25. data/examples/tickets/features/lib/eatting_machine.rb +18 -0
  26. data/examples/tickets/features/lib/pantry.rb +20 -0
  27. data/examples/tickets/features/scenario_outline.feature +64 -0
  28. data/examples/tickets/features/step_definitons/scenario_outline_steps.rb +34 -0
  29. data/examples/tickets/features/step_definitons/tickets_steps.rb +4 -0
  30. data/gem_tasks/fix_cr_lf.rake +1 -1
  31. data/gem_tasks/yard.rake +8 -0
  32. data/lib/autotest/cucumber_mixin.rb +3 -3
  33. data/lib/cucumber.rb +2 -0
  34. data/lib/cucumber/broadcaster.rb +1 -1
  35. data/lib/cucumber/cli.rb +87 -42
  36. data/lib/cucumber/core_ext/exception.rb +20 -0
  37. data/lib/cucumber/core_ext/string.rb +1 -1
  38. data/lib/cucumber/executor.rb +35 -18
  39. data/lib/cucumber/formatters/ansicolor.rb +65 -74
  40. data/lib/cucumber/formatters/html_formatter.rb +33 -10
  41. data/lib/cucumber/formatters/pretty_formatter.rb +58 -16
  42. data/lib/cucumber/formatters/progress_formatter.rb +3 -0
  43. data/lib/cucumber/formatters/unicode.rb +27 -0
  44. data/lib/cucumber/languages.yml +6 -4
  45. data/lib/cucumber/platform.rb +1 -0
  46. data/lib/cucumber/rails/world.rb +6 -6
  47. data/lib/cucumber/step_mother.rb +3 -0
  48. data/lib/cucumber/tree/feature.rb +28 -2
  49. data/lib/cucumber/tree/scenario.rb +62 -1
  50. data/lib/cucumber/tree/step.rb +32 -1
  51. data/lib/cucumber/treetop_parser/feature.treetop.erb +54 -7
  52. data/lib/cucumber/treetop_parser/feature_ar.rb +377 -18
  53. data/lib/cucumber/treetop_parser/feature_cy.rb +377 -18
  54. data/lib/cucumber/treetop_parser/feature_da.rb +377 -18
  55. data/lib/cucumber/treetop_parser/feature_de.rb +377 -18
  56. data/lib/cucumber/treetop_parser/feature_en-lol.rb +377 -18
  57. data/lib/cucumber/treetop_parser/feature_en-tx.rb +377 -18
  58. data/lib/cucumber/treetop_parser/feature_en.rb +377 -18
  59. data/lib/cucumber/treetop_parser/feature_es.rb +377 -18
  60. data/lib/cucumber/treetop_parser/feature_et.rb +377 -18
  61. data/lib/cucumber/treetop_parser/feature_fr.rb +389 -30
  62. data/lib/cucumber/treetop_parser/feature_id.rb +377 -18
  63. data/lib/cucumber/treetop_parser/feature_it.rb +377 -18
  64. data/lib/cucumber/treetop_parser/feature_ja.rb +377 -18
  65. data/lib/cucumber/treetop_parser/feature_lt.rb +377 -18
  66. data/lib/cucumber/treetop_parser/feature_nl.rb +377 -18
  67. data/lib/cucumber/treetop_parser/feature_no.rb +377 -18
  68. data/lib/cucumber/treetop_parser/feature_pl.rb +377 -18
  69. data/lib/cucumber/treetop_parser/feature_pt.rb +377 -18
  70. data/lib/cucumber/treetop_parser/feature_ro.rb +377 -18
  71. data/lib/cucumber/treetop_parser/feature_ro2.rb +377 -18
  72. data/lib/cucumber/treetop_parser/feature_ru.rb +377 -18
  73. data/lib/cucumber/treetop_parser/feature_se.rb +377 -18
  74. data/lib/cucumber/treetop_parser/feature_zh-CN.rb +377 -18
  75. data/lib/cucumber/version.rb +1 -1
  76. data/lib/cucumber/world.rb +1 -0
  77. data/lib/cucumber/world/pending.rb +22 -0
  78. data/rails_generators/cucumber/templates/env.rb +1 -0
  79. data/rails_generators/feature/feature_generator.rb +22 -2
  80. data/rails_generators/feature/templates/feature.erb +15 -12
  81. data/rails_generators/feature/templates/steps.erb +16 -14
  82. data/spec/cucumber/cli_spec.rb +87 -6
  83. data/spec/cucumber/executor_spec.rb +102 -30
  84. data/spec/cucumber/formatters/ansicolor_spec.rb +10 -10
  85. data/spec/cucumber/formatters/html_formatter_spec.rb +30 -0
  86. data/spec/cucumber/formatters/pretty_formatter_spec.rb +139 -4
  87. data/spec/cucumber/formatters/progress_formatter_spec.rb +16 -0
  88. data/spec/cucumber/tree/feature_spec.rb +84 -5
  89. data/spec/cucumber/tree/row_scenario_outline_spec.rb +73 -0
  90. data/spec/cucumber/tree/row_step_outline_spec.rb +38 -0
  91. data/spec/cucumber/tree/scenario_outline_spec.rb +50 -0
  92. data/spec/cucumber/tree/step_outline_spec.rb +17 -0
  93. data/spec/cucumber/tree/step_spec.rb +9 -0
  94. data/spec/cucumber/treetop_parser/empty_scenario_outline.feature +3 -0
  95. data/spec/cucumber/treetop_parser/feature_parser_spec.rb +22 -0
  96. data/spec/cucumber/treetop_parser/invalid_scenario_outlines.feature +7 -0
  97. data/spec/cucumber/treetop_parser/scenario_outline.feature +16 -0
  98. data/spec/cucumber/world/pending_spec.rb +46 -0
  99. data/spec/spec_helper.rb +2 -1
  100. metadata +19 -4
  101. data/TODO.txt +0 -26
@@ -0,0 +1,38 @@
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
+
3
+ module Cucumber
4
+ module Tree
5
+ describe RowStepOutline do
6
+
7
+ def mock_step(stubs = {})
8
+ mock("step", {:extra_args => []}.merge(stubs))
9
+ end
10
+
11
+
12
+ it "should be a outline" do
13
+ outline_row = RowStepOutline.new(mock("scenario"), mock_step, 'outline', [], 1)
14
+
15
+ outline_row.should be_a_outline
16
+ end
17
+
18
+ it "should be a row step" do
19
+ outline_row = RowStepOutline.new(mock("scenario"), mock_step, 'outline', [], 1)
20
+
21
+ outline_row.should be_a_row
22
+ end
23
+
24
+ it "should have visible args" do
25
+ outline_row = RowStepOutline.new(mock("scenario"), mock_step, 'outline', ["tiger", "night"], 1)
26
+
27
+ outline_row.visible_args.should == ["tiger", "night"]
28
+ end
29
+
30
+ it "should have extra args" do
31
+ outline_row = RowStepOutline.new(mock("scenario"), mock_step(:extra_args => ["extra", "arrrgs"]), 'outline', [], 1)
32
+
33
+ outline_row.extra_args.should == ["extra", "arrrgs"]
34
+ end
35
+
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,50 @@
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
+
3
+ module Cucumber
4
+ module Tree
5
+ describe ScenarioOutline do
6
+
7
+ def mock_feature
8
+ mock_feature = mock("feature")
9
+ end
10
+
11
+ def mock_scenario(stubs ={})
12
+ mock("scenario", {:update_table_column_widths => nil}.merge(stubs))
13
+ end
14
+
15
+ it "should indicate its a scenario outline" do
16
+ scenario_outline = ScenarioOutline.new(mock_feature, '', 1)
17
+
18
+ scenario_outline.should be_a_outline
19
+ end
20
+
21
+ it "should create a step outline when adding new steps" do
22
+ scenario_outline = ScenarioOutline.new(mock_feature, '', 1)
23
+
24
+ StepOutline.should_receive(:new)
25
+
26
+ scenario_outline.create_step('Given', '', 2)
27
+ end
28
+
29
+ it "should visit step outlines" do
30
+ outline = ScenarioOutline.new(mock_feature, '', 1)
31
+ outline.create_step('Given', '', 1)
32
+ mock_visitor = mock('visitor')
33
+
34
+ mock_visitor.should_receive(:visit_step_outline)
35
+
36
+ outline.accept(mock_visitor)
37
+ end
38
+
39
+ it "should include indent when padding to step" do
40
+ scenario = ScenarioOutline.new(mock_feature, '', 1)
41
+ scenario.create_step('Given', 'a longish step', 1)
42
+
43
+ #Scenario Outline: ****
44
+ # Given a longish step
45
+ scenario.padding_length.should == 4 + Scenario::INDENT
46
+ end
47
+
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,17 @@
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
+
3
+ module Cucumber
4
+ module Tree
5
+ describe StepOutline do
6
+
7
+ it "should be a outline" do
8
+ step_outline = StepOutline.new(mock("scenario"), 'Given', 'outline', 1)
9
+
10
+ step_outline.should be_a_outline
11
+ end
12
+
13
+ end
14
+ end
15
+ end
16
+
17
+
@@ -43,6 +43,15 @@ module Cucumber
43
43
  end
44
44
 
45
45
  end
46
+
47
+ it "should indicate if a forced pending exception occured" do
48
+ scenario = Scenario.new(nil, '9', 1)
49
+ step = scenario.create_step('Given', '666666', 98)
50
+
51
+ step.instance_variable_set("@error", ForcedPending.new)
52
+
53
+ step.should be_forced_to_pending
54
+ end
46
55
 
47
56
  end
48
57
  end
@@ -0,0 +1,3 @@
1
+ Feature: Empty scenarios outlines should work
2
+
3
+ Scenario Outline: Implement me please
@@ -67,6 +67,13 @@ module Cucumber
67
67
  f.scenarios[2].should have(1).steps
68
68
  end
69
69
 
70
+ it "should allow empty scenario outlines" do
71
+ p = FeatureParser.new
72
+ f = p.parse_feature(File.dirname(__FILE__) + '/empty_scenario_outline.feature')
73
+
74
+ f.scenarios[0].should have(0).steps
75
+ end
76
+
70
77
  it "should allow multiple tables" do
71
78
  p = FeatureParser.new
72
79
  f = p.parse_feature(File.dirname(__FILE__) + '/multiple_tables.feature')
@@ -93,6 +100,21 @@ module Cucumber
93
100
  step = f.scenarios[0].steps[3]
94
101
  step.extra_args[0].should == "A string\n that \"indents\"\nand spans\nseveral lines\n"
95
102
  end
103
+
104
+ it "should parse scenario outlines" do
105
+ p = FeatureParser.new
106
+ f = p.parse_feature(File.dirname(__FILE__) + '/scenario_outline.feature')
107
+
108
+ f.should have(4).scenarios
109
+ end
110
+
111
+ it "should not allow a scenario outline with an example table but no steps" do
112
+ p = FeatureParser.new
113
+ lambda{
114
+ p.parse_feature(File.dirname(__FILE__) + '/invalid_scenario_outlines.feature')
115
+ }.should raise_error(Feature::SyntaxError)
116
+ end
117
+
96
118
  end
97
119
  end
98
120
  end
@@ -0,0 +1,7 @@
1
+ Feature: Invalid Scenario Outlines
2
+
3
+ Scenario Outline: I must have steps if I have a examples table
4
+ Examples:
5
+ | Name |
6
+ | Izanaki |
7
+ | Izanami |
@@ -0,0 +1,16 @@
1
+ Feature: Valid Outlines
2
+
3
+ Scenario Outline: Joe fails to login
4
+ Given I login as Joe without the '<Privilege>' privilege
5
+ When I <Request Method> /admin/<Path>
6
+ Then I should see the text "Sorry Joe, you're not allowed to see <Path>"
7
+
8
+ Examples:
9
+ | Privilege | Request Method | Path |
10
+ | user | GET | reports |
11
+ | user | GET | managers |
12
+
13
+ Scenario Outline: Look at me ma no examples!
14
+ Given I login as Joe without the '<Privilege>' privilege
15
+ When I <Request Method> /admin/<Path>
16
+ Then I should see the text "Sorry Joe, you're not allowed to see <Path>"
@@ -0,0 +1,46 @@
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
+
3
+ module Cucumber
4
+ module World
5
+ describe Pending do
6
+
7
+ before(:each) do
8
+ @world = Object.new
9
+ @world.extend(World::Pending)
10
+ end
11
+
12
+ it 'should raise a ForcedPending if no block is supplied' do
13
+ lambda {
14
+ @world.pending "TODO"
15
+ }.should raise_error(ForcedPending, /TODO/)
16
+ end
17
+
18
+ it 'should raise a ForcedPending if a supplied block fails as expected' do
19
+ lambda {
20
+ @world.pending "TODO" do
21
+ raise "oops"
22
+ end
23
+ }.should raise_error(ForcedPending, /TODO/)
24
+ end
25
+
26
+ it 'should raise a ForcedPending if a supplied block fails as expected with a mock' do
27
+ lambda {
28
+ @world.pending "TODO" do
29
+ m = mock('thing')
30
+ m.should_receive(:foo)
31
+ m.rspec_verify
32
+ end
33
+ }.should raise_error(ForcedPending, /TODO/)
34
+ end
35
+
36
+ it 'should raise a ForcedPending if a supplied block starts working' do
37
+ lambda {
38
+ @world.pending "TODO" do
39
+ # success!
40
+ end
41
+ }.should raise_error(ForcedPending, /TODO/)
42
+ end
43
+
44
+ end
45
+ end
46
+ end
@@ -2,13 +2,14 @@ require 'rubygems'
2
2
  gem 'rspec'
3
3
  require 'spec'
4
4
 
5
+ ENV['CUCUMBER_COLORS']=nil
5
6
  $KCODE='u'
6
7
  $:.unshift(File.dirname(__FILE__) + '/../lib')
7
8
  require 'cucumber'
8
9
  require 'cucumber/treetop_parser/feature_en'
9
10
  Cucumber.load_language('en')
10
11
 
11
- ::Term::ANSIColor.coloring = false
12
+ ::Term::ANSIColor.coloring = true
12
13
 
13
14
  # Open up the tree classes a little for easier inspection.
14
15
  module Cucumber
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.12
4
+ version: 0.1.13
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-12-04 00:00:00 +01:00
12
+ date: 2008-12-20 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -64,7 +64,6 @@ extra_rdoc_files:
64
64
  - License.txt
65
65
  - Manifest.txt
66
66
  - README.txt
67
- - TODO.txt
68
67
  - examples/i18n/ja/README.txt
69
68
  files:
70
69
  - History.txt
@@ -72,7 +71,6 @@ files:
72
71
  - Manifest.txt
73
72
  - README.txt
74
73
  - Rakefile
75
- - TODO.txt
76
74
  - bin/cucumber
77
75
  - config/hoe.rb
78
76
  - config/requirements.rb
@@ -175,6 +173,10 @@ files:
175
173
  - examples/test_unit/features/test_unit.feature
176
174
  - examples/tickets/Rakefile
177
175
  - examples/tickets/cucumber.yml
176
+ - examples/tickets/features/lib/eatting_machine.rb
177
+ - examples/tickets/features/lib/pantry.rb
178
+ - examples/tickets/features/scenario_outline.feature
179
+ - examples/tickets/features/step_definitons/scenario_outline_steps.rb
178
180
  - examples/tickets/features/step_definitons/tickets_steps.rb
179
181
  - examples/tickets/features/tickets.feature
180
182
  - examples/watir/Rakefile
@@ -190,6 +192,7 @@ files:
190
192
  - gem_tasks/gemspec.rake
191
193
  - gem_tasks/rspec.rake
192
194
  - gem_tasks/treetop.rake
195
+ - gem_tasks/yard.rake
193
196
  - lib/autotest/cucumber.rb
194
197
  - lib/autotest/cucumber_mixin.rb
195
198
  - lib/autotest/cucumber_rails.rb
@@ -199,6 +202,7 @@ files:
199
202
  - lib/cucumber.rb
200
203
  - lib/cucumber/broadcaster.rb
201
204
  - lib/cucumber/cli.rb
205
+ - lib/cucumber/core_ext/exception.rb
202
206
  - lib/cucumber/core_ext/proc.rb
203
207
  - lib/cucumber/core_ext/string.rb
204
208
  - lib/cucumber/executor.rb
@@ -212,6 +216,7 @@ files:
212
216
  - lib/cucumber/formatters/pretty_formatter.rb
213
217
  - lib/cucumber/formatters/profile_formatter.rb
214
218
  - lib/cucumber/formatters/progress_formatter.rb
219
+ - lib/cucumber/formatters/unicode.rb
215
220
  - lib/cucumber/languages.yml
216
221
  - lib/cucumber/model.rb
217
222
  - lib/cucumber/model/table.rb
@@ -255,6 +260,8 @@ files:
255
260
  - lib/cucumber/treetop_parser/feature_se.rb
256
261
  - lib/cucumber/treetop_parser/feature_zh-CN.rb
257
262
  - lib/cucumber/version.rb
263
+ - lib/cucumber/world.rb
264
+ - lib/cucumber/world/pending.rb
258
265
  - rails_generators/cucumber/USAGE
259
266
  - rails_generators/cucumber/cucumber_generator.rb
260
267
  - rails_generators/cucumber/templates/cucumber
@@ -293,19 +300,27 @@ files:
293
300
  - spec/cucumber/sell_cucumbers.feature
294
301
  - spec/cucumber/step_mother_spec.rb
295
302
  - spec/cucumber/tree/feature_spec.rb
303
+ - spec/cucumber/tree/row_scenario_outline_spec.rb
296
304
  - spec/cucumber/tree/row_scenario_spec.rb
305
+ - spec/cucumber/tree/row_step_outline_spec.rb
306
+ - spec/cucumber/tree/scenario_outline_spec.rb
297
307
  - spec/cucumber/tree/scenario_spec.rb
308
+ - spec/cucumber/tree/step_outline_spec.rb
298
309
  - spec/cucumber/tree/step_spec.rb
299
310
  - spec/cucumber/treetop_parser/empty_feature.feature
300
311
  - spec/cucumber/treetop_parser/empty_scenario.feature
312
+ - spec/cucumber/treetop_parser/empty_scenario_outline.feature
301
313
  - spec/cucumber/treetop_parser/feature_parser_spec.rb
302
314
  - spec/cucumber/treetop_parser/fit_scenario.feature
303
315
  - spec/cucumber/treetop_parser/given_scenario.feature
316
+ - spec/cucumber/treetop_parser/invalid_scenario_outlines.feature
304
317
  - spec/cucumber/treetop_parser/multiline_steps.feature
305
318
  - spec/cucumber/treetop_parser/multiple_tables.feature
319
+ - spec/cucumber/treetop_parser/scenario_outline.feature
306
320
  - spec/cucumber/treetop_parser/spaces.feature
307
321
  - spec/cucumber/treetop_parser/test_dos.feature
308
322
  - spec/cucumber/treetop_parser/with_comments.feature
323
+ - spec/cucumber/world/pending_spec.rb
309
324
  - spec/spec.opts
310
325
  - spec/spec_helper.rb
311
326
  has_rdoc: true
data/TODO.txt DELETED
@@ -1,26 +0,0 @@
1
- == FEATURES/PROBLEMS:
2
-
3
- * TODO: OK Refactor: Extract explicit node classes with RDoc (for better API doc)
4
- * TODO: OK Get rid of the compile method. Compile the parser in Rake.
5
- * TODO: OK Make grammar support \r\n, \r and \n (Add some fixture features for that)
6
- * TODO: OK Make grammar support indentation
7
- * TODO: OK Make grammar be totally relaxed about narrative
8
- * TODO: OK Add a yaml file for different languages
9
- * TODO: OK Custom nodes for the syntax tree
10
- * TODO: OK Actually execute the features
11
- * TODO: Make rake run specs by default
12
- * TODO: OK Make it work with pure ruby regexen
13
- * TODO: OK Make it work with string steps
14
- * TODO: bin/cucumber --require [dir|file|glob]* --language no --format [file]*
15
- * TODO: OK Pending steps shold print a block of code that can be pasted into code
16
- * TODO: cucumber --where "Some text from a step" that prints "__FILE__:__LINE__ (STEP PATTERN)"
17
- * TODO: Customisable trace output (like javascriptlint)
18
- * TODO: Experiment: Make $variables become @variables
19
- * TODO: OK GivenScenario
20
- * TODO: OK PureRuby
21
- * Make two trees include accept mixin
22
- * TODO: Call steps from steps
23
- * TODO: i18n in ruby too
24
- * TODO: Don't load any treetop files if no .feature files are found
25
- * TODO: Summary prints execution time
26
- * TODO: --nocolor option