cucumber 0.3.0 → 0.3.1

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 (66) hide show
  1. data/History.txt +26 -1
  2. data/Manifest.txt +20 -1
  3. data/config/hoe.rb +5 -4
  4. data/examples/i18n/hu/Rakefile +6 -0
  5. data/examples/i18n/hu/features/addition.feature +16 -0
  6. data/examples/i18n/hu/features/division.feature +9 -0
  7. data/examples/i18n/hu/features/step_definitons/calculator_steps.rb +25 -0
  8. data/examples/i18n/hu/lib/calculator.rb +14 -0
  9. data/examples/i18n/lv/Rakefile +6 -0
  10. data/examples/i18n/lv/features/addition.feature +16 -0
  11. data/examples/i18n/lv/features/division.feature +9 -0
  12. data/examples/i18n/lv/features/step_definitons/calculator_steps.rb +24 -0
  13. data/examples/i18n/lv/lib/calculator.rb +14 -0
  14. data/examples/self_test/features/background/failing_background.feature +1 -0
  15. data/examples/self_test/features/multiline_name.feature +27 -0
  16. data/examples/self_test/features/search_sample.feature +22 -0
  17. data/examples/self_test/features/step_definitions/sample_steps.rb +3 -2
  18. data/examples/tickets/Rakefile +3 -3
  19. data/examples/tickets/features/236.feature +9 -9
  20. data/examples/tickets/features/272/hooks.feature +26 -0
  21. data/examples/tickets/features/272/hooks_steps.rb +53 -0
  22. data/examples/tickets/features/301/filter_background_tagged_hooks.feature +6 -0
  23. data/examples/tickets/features/301/filter_background_tagged_hooks_steps.rb +12 -0
  24. data/examples/tickets/features/306/only_background.feature +4 -0
  25. data/features/background.feature +2 -1
  26. data/features/cucumber_cli.feature +88 -12
  27. data/features/cucumber_cli_outlines.feature +32 -0
  28. data/features/custom_formatter.feature +2 -2
  29. data/features/multiline_names.feature +43 -0
  30. data/features/report_called_undefined_steps.feature +1 -1
  31. data/features/usage.feature +13 -4
  32. data/lib/cucumber/ast/background.rb +10 -13
  33. data/lib/cucumber/ast/feature.rb +5 -0
  34. data/lib/cucumber/ast/feature_element.rb +23 -12
  35. data/lib/cucumber/ast/outline_table.rb +10 -0
  36. data/lib/cucumber/ast/py_string.rb +5 -1
  37. data/lib/cucumber/ast/scenario.rb +17 -6
  38. data/lib/cucumber/ast/scenario_outline.rb +1 -6
  39. data/lib/cucumber/ast/step.rb +6 -3
  40. data/lib/cucumber/ast/step_collection.rb +9 -1
  41. data/lib/cucumber/ast/table.rb +8 -0
  42. data/lib/cucumber/ast/visitor.rb +2 -2
  43. data/lib/cucumber/cli/configuration.rb +15 -14
  44. data/lib/cucumber/formatter/console.rb +1 -1
  45. data/lib/cucumber/formatter/html.rb +1 -1
  46. data/lib/cucumber/formatter/pretty.rb +7 -8
  47. data/lib/cucumber/languages.yml +30 -0
  48. data/lib/cucumber/parser/feature.rb +214 -14
  49. data/lib/cucumber/parser/feature.tt +44 -14
  50. data/lib/cucumber/parser/treetop_ext.rb +3 -3
  51. data/lib/cucumber/rails/world.rb +6 -0
  52. data/lib/cucumber/step_mother.rb +2 -1
  53. data/lib/cucumber/version.rb +1 -1
  54. data/lib/cucumber/world.rb +2 -2
  55. data/rails_generators/cucumber/templates/paths.rb +11 -13
  56. data/rails_generators/feature/feature_generator.rb +1 -1
  57. data/spec/cucumber/ast/feature_element_spec.rb +40 -0
  58. data/spec/cucumber/ast/py_string_spec.rb +4 -0
  59. data/spec/cucumber/ast/table_spec.rb +20 -4
  60. data/spec/cucumber/ast/visitor_spec.rb +27 -0
  61. data/spec/cucumber/cli/configuration_spec.rb +4 -13
  62. data/spec/cucumber/cli/main_spec.rb +55 -153
  63. data/spec/cucumber/parser/feature_parser_spec.rb +79 -0
  64. data/spec/cucumber/step_mother_spec.rb +12 -5
  65. metadata +22 -13
  66. data/spec/cucumber/formatters/profile_formatter_spec.rb +0 -198
data/History.txt CHANGED
@@ -1,4 +1,29 @@
1
- == 0.3.0 (In Git)
1
+ == 0.3.1 2009-04-26
2
+
3
+ This release has several minor bug fixes and new features. With the addition of Latvian and Hungarian Cucumber
4
+ now supports 32(!!) languages.
5
+
6
+ === New features
7
+ * Support multiline names for Scenarios, Scenario Outlines, Backgrounds, Examples (#231 Joseph Wilk)
8
+ * Added #headers to Cucumber::Ast::Table (Ben Mabey)
9
+ * New translation for Latvian (Vitauts Stočka)
10
+ * New translation for Hungarian (#287 Bence Golda)
11
+ * Pick up failure on after hook (#272 Aslak Hellesøy)
12
+
13
+ === Bugfixes
14
+ * Pretty formatter not colouring Examples tables correctly (#304 Aslak Hellesøy)
15
+ * Problem using --scenario and Scenario Outline (#298 Aslak Hellesøy)
16
+ * Tag Hook gets executed always there is a background (#301 Aslak Hellesøy)
17
+ * Feature which only has a Background with steps causes an exception (#306 Aslak Hellesøy)
18
+ * Gem no longer depends on Hoe (Aslak Hellesøy)
19
+ * Span html tags appear on HTML results with 0.3.0 (#299 Aslak Hellesøy)
20
+ * Fixed incorrect colours in pretty formatter's table headers for outline tables (Aslak Hellesøy)
21
+ * Exceptions from steps called within hooks are now reraised. (#294 Ben Mabey)
22
+
23
+ === Removed/changed features
24
+ * --scenario handle has been removed and replaced with --name which supports partial matches, regexp special characters, running named backgrounds (#295 Joseph Wilk)
25
+
26
+ == 0.3.0 2009-04-14
2
27
 
3
28
  This release has some minor changes to the APIs, but big enough that a new major release is in order.
4
29
  The biggest change is the new semantics of the #World method. Previously you would call this method
data/Manifest.txt CHANGED
@@ -67,6 +67,11 @@ examples/i18n/fr/Rakefile
67
67
  examples/i18n/fr/features/addition.feature
68
68
  examples/i18n/fr/features/step_definitions/calculatrice_steps.rb
69
69
  examples/i18n/fr/lib/calculatrice.rb
70
+ examples/i18n/hu/Rakefile
71
+ examples/i18n/hu/features/addition.feature
72
+ examples/i18n/hu/features/division.feature
73
+ examples/i18n/hu/features/step_definitons/calculator_steps.rb
74
+ examples/i18n/hu/lib/calculator.rb
70
75
  examples/i18n/id/Rakefile
71
76
  examples/i18n/id/features/addition.feature
72
77
  examples/i18n/id/features/division.feature
@@ -91,6 +96,11 @@ examples/i18n/lt/features/addition.feature
91
96
  examples/i18n/lt/features/division.feature
92
97
  examples/i18n/lt/features/step_definitons/calculator_steps.rb
93
98
  examples/i18n/lt/lib/calculator.rb
99
+ examples/i18n/lv/Rakefile
100
+ examples/i18n/lv/features/addition.feature
101
+ examples/i18n/lv/features/division.feature
102
+ examples/i18n/lv/features/step_definitons/calculator_steps.rb
103
+ examples/i18n/lv/lib/calculator.rb
94
104
  examples/i18n/no/Rakefile
95
105
  examples/i18n/no/features/step_definitons/kalkulator_steps.rb
96
106
  examples/i18n/no/features/summering.feature
@@ -159,8 +169,10 @@ examples/self_test/features/background/scenario_outline_passing_background.featu
159
169
  examples/self_test/features/call_undefined_step_from_step_def.feature
160
170
  examples/self_test/features/failing_expectation.feature
161
171
  examples/self_test/features/lots_of_undefined.feature
172
+ examples/self_test/features/multiline_name.feature
162
173
  examples/self_test/features/outline_sample.feature
163
174
  examples/self_test/features/sample.feature
175
+ examples/self_test/features/search_sample.feature
164
176
  examples/self_test/features/step_definitions/sample_steps.rb
165
177
  examples/self_test/features/support/env.rb
166
178
  examples/self_test/features/support/tag_count_formatter.rb
@@ -190,9 +202,14 @@ examples/tickets/features/246.feature
190
202
  examples/tickets/features/248.feature
191
203
  examples/tickets/features/270/back.feature
192
204
  examples/tickets/features/270/back.steps.rb
205
+ examples/tickets/features/272/hooks.feature
206
+ examples/tickets/features/272/hooks_steps.rb
193
207
  examples/tickets/features/279/py_string_indent.feature
194
208
  examples/tickets/features/279/py_string_indent.steps.rb
195
209
  examples/tickets/features/279/wrong.feature_
210
+ examples/tickets/features/301/filter_background_tagged_hooks.feature
211
+ examples/tickets/features/301/filter_background_tagged_hooks_steps.rb
212
+ examples/tickets/features/306/only_background.feature
196
213
  examples/tickets/features/lib/eatting_machine.rb
197
214
  examples/tickets/features/lib/pantry.rb
198
215
  examples/tickets/features/scenario_outline.feature
@@ -211,6 +228,7 @@ features/cucumber_cli.feature
211
228
  features/cucumber_cli_diff_disabled.feature
212
229
  features/cucumber_cli_outlines.feature
213
230
  features/custom_formatter.feature
231
+ features/multiline_names.feature
214
232
  features/rake_task.feature
215
233
  features/report_called_undefined_steps.feature
216
234
  features/snippet.feature
@@ -301,6 +319,7 @@ rails_generators/feature/feature_generator.rb
301
319
  rails_generators/feature/templates/feature.erb
302
320
  rails_generators/feature/templates/steps.erb
303
321
  spec/cucumber/ast/background_spec.rb
322
+ spec/cucumber/ast/feature_element_spec.rb
304
323
  spec/cucumber/ast/feature_factory.rb
305
324
  spec/cucumber/ast/feature_spec.rb
306
325
  spec/cucumber/ast/py_string_spec.rb
@@ -309,6 +328,7 @@ spec/cucumber/ast/scenario_spec.rb
309
328
  spec/cucumber/ast/step_collection_spec.rb
310
329
  spec/cucumber/ast/step_spec.rb
311
330
  spec/cucumber/ast/table_spec.rb
331
+ spec/cucumber/ast/visitor_spec.rb
312
332
  spec/cucumber/broadcaster_spec.rb
313
333
  spec/cucumber/cli/configuration_spec.rb
314
334
  spec/cucumber/cli/main_spec.rb
@@ -321,7 +341,6 @@ spec/cucumber/formatter/html/cucumber.js
321
341
  spec/cucumber/formatter/html/index.html
322
342
  spec/cucumber/formatter/html/jquery-1.3.min.js
323
343
  spec/cucumber/formatter/html/jquery.uitableedit.js
324
- spec/cucumber/formatters/profile_formatter_spec.rb
325
344
  spec/cucumber/parser/feature_parser_spec.rb
326
345
  spec/cucumber/parser/table_parser_spec.rb
327
346
  spec/cucumber/rails/stubs/mini_rails.rb
data/config/hoe.rb CHANGED
@@ -38,11 +38,12 @@ RDOC_OPTS = ['--quiet', '--title', 'Cucumber documentation',
38
38
  "--main", "README.textile",
39
39
  "--inline-source"]
40
40
 
41
+ # Remove Hoe dependency
41
42
  class Hoe
42
- def extra_deps
43
- @extra_deps.reject! { |x| Array(x).first == 'hoe' }
44
- @extra_deps
45
- end
43
+ def extra_dev_deps
44
+ @extra_dev_deps.reject! { |dep| dep[0] == "hoe" }
45
+ @extra_dev_deps
46
+ end
46
47
  end
47
48
 
48
49
  # Generate all the Rake tasks
@@ -0,0 +1,6 @@
1
+ $:.unshift(File.dirname(__FILE__) + '/../../../lib')
2
+ require 'cucumber/rake/task'
3
+
4
+ Cucumber::Rake::Task.new do |t|
5
+ t.cucumber_opts = "--language hu"
6
+ end
@@ -0,0 +1,16 @@
1
+ Jellemző: Összeadás
2
+ Azért, hogy elkerüljem a buta hibákat
3
+ amit diszkalkúliásként elkövethetek,
4
+ két szám összegét szeretném kiszámoltatni.
5
+
6
+ Forgatókönyv vázlat: Két szám összeadása
7
+ Ha beütök a számológépbe egy <be_1>-est
8
+ És beütök a számológépbe egy <be_2>-est
9
+ Majd megnyomom az <gomb> gombot
10
+ Akkor eredményül <ki>-t kell kapnom
11
+
12
+ Példák:
13
+ | be_1 | be_2 | gomb | ki |
14
+ | 20 | 30 | add | 50 |
15
+ | 2 | 5 | add | 7 |
16
+ | 0 | 40 | add | 40 |
@@ -0,0 +1,9 @@
1
+ Jellemző: Osztás
2
+ Azért, hogy elkerüljem a buta hibákat
3
+ a számológépeknek tudniuk kell osztani.
4
+
5
+ Forgatókönyv: Egyszerű számok
6
+ Ha beütök a számológépbe egy 3-ast
7
+ És beütök a számológépbe egy 2-est
8
+ Majd megnyomom a divide gombot
9
+ Akkor eredményül 1.5-öt kell kapnom
@@ -0,0 +1,25 @@
1
+ # encoding: utf-8
2
+ require 'spec/expectations'
3
+ $:.unshift(File.dirname(__FILE__) + '/../../lib') # This line is not needed in your own project
4
+ require 'cucumber/formatter/unicode'
5
+ require 'calculator'
6
+
7
+ Before do
8
+ @calc = Calculator.new
9
+ end
10
+
11
+ After do
12
+ end
13
+
14
+ Ha /^beütök a számológépbe egy (\d+)\-(?:es|as|ös|ás)t$/ do |n|
15
+ @calc.push n.to_i
16
+ end
17
+
18
+ Majd /^megnyomom az? (\w+) gombot$/ do |op|
19
+ @result = @calc.send op
20
+ end
21
+
22
+ Akkor /^eredményül (.*)\-(?:e|a|ö|á|)t kell kapnom$/ do |result|
23
+ @result.should == result.to_f
24
+ end
25
+
@@ -0,0 +1,14 @@
1
+ class Calculator
2
+ def push(n)
3
+ @args ||= []
4
+ @args << n
5
+ end
6
+
7
+ def add
8
+ @args.inject(0){|n,sum| sum+=n}
9
+ end
10
+
11
+ def divide
12
+ @args[0].to_f / @args[1].to_f
13
+ end
14
+ end
@@ -0,0 +1,6 @@
1
+ $:.unshift(File.dirname(__FILE__) + '/../../../lib')
2
+ require 'cucumber/rake/task'
3
+
4
+ Cucumber::Rake::Task.new do |t|
5
+ t.cucumber_opts = "--language lv"
6
+ end
@@ -0,0 +1,16 @@
1
+ Funkcionalitāte: Saskaitīšana
2
+ Lai izvairītos no muļķīgām kļūdām
3
+ Kā matemātikas idiots
4
+ Es vēlos uzzināt divu skaitļu summu
5
+
6
+ Scenārijs pēc parauga: Saskaitīt divus skaitļus
7
+ Kad esmu ievadījis kalkulatorā <skaitlis_1>
8
+ Un esmu ievadījis kalkulatorā <skaitlis_2>
9
+ Ja nospiežu pogu <poga>
10
+ Tad rezultātam uz ekrāna ir jābūt <rezultāts>
11
+
12
+ Paraugs:
13
+ | skaitlis_1 | skaitlis_2 | poga | rezultāts |
14
+ | 20 | 30 | add | 50 |
15
+ | 2 | 5 | add | 7 |
16
+ | 0 | 40 | add | 40 |
@@ -0,0 +1,9 @@
1
+ Funkcionalitāte: Dalīšana
2
+ Lai izvairītos no muļķīgām kļūdām
3
+ Kasieriem ir jāprot aprēķināt daļas
4
+
5
+ Scenārijs: Veseli skaitļi
6
+ Kad esmu ievadījis kalkulatorā 3
7
+ Un esmu ievadījis kalkulatorā 2
8
+ Ja nospiežu pogu divide
9
+ Tad rezultātam uz ekrāna ir jābūt 1.5
@@ -0,0 +1,24 @@
1
+ # encoding: utf-8
2
+ require 'spec/expectations'
3
+ $:.unshift(File.dirname(__FILE__) + '/../../lib') # This line is not needed in your own project
4
+ require 'cucumber/formatter/unicode'
5
+ require 'calculator'
6
+
7
+ Before do
8
+ @calc = Calculator.new
9
+ end
10
+
11
+ After do
12
+ end
13
+
14
+ Given /esmu ievadījis kalkulatorā (\d+)/ do |n|
15
+ @calc.push n.to_i
16
+ end
17
+
18
+ When /nospiežu pogu (\w+)/ do |op|
19
+ @result = @calc.send op
20
+ end
21
+
22
+ Then /rezultātam uz ekrāna ir jābūt (.*)/ do |result|
23
+ @result.should == result.to_f
24
+ end
@@ -0,0 +1,14 @@
1
+ class Calculator
2
+ def push(n)
3
+ @args ||= []
4
+ @args << n
5
+ end
6
+
7
+ def add
8
+ @args.inject(0){|n,sum| sum+=n}
9
+ end
10
+
11
+ def divide
12
+ @args[0].to_f / @args[1].to_f
13
+ end
14
+ end
@@ -1,3 +1,4 @@
1
+ @after_file
1
2
  Feature: Failing background sample
2
3
 
3
4
  Background:
@@ -0,0 +1,27 @@
1
+ Feature: multiline
2
+
3
+ Background: I'm a multiline name
4
+ which goes on and on and on for three lines
5
+ yawn
6
+ Given passing without a table
7
+
8
+ Scenario: I'm a multiline name
9
+ which goes on and on and on for three lines
10
+ yawn
11
+ Given passing without a table
12
+
13
+ Scenario Outline: I'm a multiline name
14
+ which goes on and on and on for three lines
15
+ yawn
16
+ Given <state> without a table
17
+ Examples:
18
+ | state |
19
+ |passing|
20
+
21
+ Scenario Outline: name
22
+ Given <state> without a table
23
+ Examples: I'm a multiline name
24
+ which goes on and on and on for three lines
25
+ yawn
26
+ | state |
27
+ |passing|
@@ -0,0 +1,22 @@
1
+ Feature: search examples
2
+
3
+ Background: Hantu Pisang background match
4
+ Given passing without a table
5
+
6
+ Scenario: should match Hantu Pisang
7
+ Given passing without a table
8
+
9
+ Scenario: Ignore me
10
+ Given failing without a table
11
+
12
+ Scenario Outline: Ignore me
13
+ Given <state> without a table
14
+ Examples:
15
+ |state|
16
+ |failing|
17
+
18
+ Scenario Outline: Hantu Pisang match
19
+ Given <state> without a table
20
+ Examples:
21
+ |state|
22
+ |passing|
@@ -69,12 +69,13 @@ end
69
69
  Given /^another unused$/ do
70
70
  end
71
71
 
72
- after_file = File.dirname(__FILE__) + '/../../tmp/after.txt'
72
+ after_file = File.expand_path(File.dirname(__FILE__) + '/../../tmp/after.txt')
73
73
 
74
- Before('@after_file') do
74
+ Before do
75
75
  FileUtils.rm(after_file) if File.exist?(after_file)
76
76
  end
77
77
 
78
78
  After('@after_file') do
79
+ FileUtils.mkdir_p(File.dirname(after_file))
79
80
  FileUtils.touch(after_file)
80
81
  end
@@ -2,15 +2,15 @@ $:.unshift(File.dirname(__FILE__) + '/../../lib')
2
2
  require 'cucumber/rake/task'
3
3
 
4
4
  Cucumber::Rake::Task.new(:pretty) do |t|
5
- t.cucumber_opts = "--format pretty -q"
5
+ t.cucumber_opts = "--tags ~@intentional_failure --format pretty -q"
6
6
  end
7
7
 
8
8
  Cucumber::Rake::Task.new(:html) do |t|
9
- t.cucumber_opts = "--format html --out features.html"
9
+ t.cucumber_opts = "--tags ~@intentional_failure --format html --out features.html"
10
10
  end
11
11
 
12
12
  Cucumber::Rake::Task.new(:progress) do |t|
13
- t.cucumber_opts = "--format progress -i -n"
13
+ t.cucumber_opts = "--tags ~@intentional_failure --format progress -i -n"
14
14
  end
15
15
 
16
16
  task :default => [:pretty, :html, :progress]
@@ -1,13 +1,13 @@
1
1
  Feature: Unsubstituted argument placeholder
2
2
 
3
3
  Scenario Outline: See Annual Leave Details (as Management & Human Resource)
4
- Given the following users exist in the system
5
- | name | email | role_assignments | group_memberships |
6
- | Jane | jane@fmail.com | <role> | Sales (manager) |
7
- | Max | max@fmail.com | | Sales (member) |
8
- | Carol | carol@fmail.com | | Sales (member) |
9
- | Cat | cat@fmail.com | | |
4
+ Given the following users exist in the system
5
+ | name | email | role_assignments | group_memberships |
6
+ | Jane | jane@fmail.com | <role> | Sales (manager) |
7
+ | Max | max@fmail.com | | Sales (member) |
8
+ | Carol | carol@fmail.com | | Sales (member) |
9
+ | Cat | cat@fmail.com | | |
10
10
 
11
- Examples:
12
- | role |
13
- | HUMAN RESOURCE |
11
+ Examples:
12
+ | role |
13
+ | HUMAN RESOURCE |
@@ -0,0 +1,26 @@
1
+ @intentional_failure
2
+ Feature: Hooks
3
+ In order to integrate with my complex environment
4
+ I need to check scenario status in an After block
5
+
6
+ @272_failed
7
+ Scenario: Failed
8
+ Given I fail
9
+
10
+ @272_undefined
11
+ Scenario: Undefined
12
+ Given I am undefined
13
+
14
+ @272_passed
15
+ Scenario: Passed
16
+ Given I pass
17
+
18
+ @272_outline
19
+ Scenario Outline: Should work too
20
+ Given <something>
21
+
22
+ Examples:
23
+ | something |
24
+ | I fail |
25
+ | I am undefined |
26
+ | I pass |
@@ -0,0 +1,53 @@
1
+ require 'spec/expectations'
2
+
3
+ Given /^I fail$/ do
4
+ raise "BOOM (this is expected)"
5
+ end
6
+
7
+ Given /^I pass$/ do
8
+ end
9
+
10
+ module HookChecks
11
+ def check_failed(scenario)
12
+ scenario.should be_failed
13
+ scenario.should_not be_passed
14
+ scenario.exception.message.should == "BOOM (this is expected)"
15
+ end
16
+
17
+ def check_undefined(scenario)
18
+ scenario.should_not be_failed
19
+ scenario.should_not be_passed
20
+ end
21
+
22
+ def check_passed(scenario)
23
+ scenario.should_not be_failed
24
+ scenario.should be_passed
25
+ end
26
+ end
27
+
28
+ World(HookChecks)
29
+
30
+ After('@272_failed') do |scenario|
31
+ check_failed(scenario)
32
+ end
33
+
34
+ After('@272_undefined') do |scenario|
35
+ check_undefined(scenario)
36
+ end
37
+
38
+ After('@272_passed') do |scenario|
39
+ check_passed(scenario)
40
+ end
41
+
42
+ counter = 0
43
+ After('@272_outline') do |scenario|
44
+ case(counter)
45
+ when 0
46
+ check_failed(scenario)
47
+ when 1
48
+ check_undefined(scenario)
49
+ when 2
50
+ check_passed(scenario)
51
+ end
52
+ counter +=1
53
+ end