aslakhellesoy-cucumber 0.3.0 → 0.3.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. data/History.txt +18 -1
  2. data/Manifest.txt +15 -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/multiline_name.feature +27 -0
  15. data/examples/tickets/Rakefile +3 -3
  16. data/examples/tickets/features/272/hooks.feature +26 -0
  17. data/examples/tickets/features/272/hooks_steps.rb +53 -0
  18. data/features/cucumber_cli.feature +32 -2
  19. data/features/multiline_names.feature +43 -0
  20. data/features/report_called_undefined_steps.feature +1 -1
  21. data/features/usage.feature +4 -0
  22. data/lib/cucumber/ast/background.rb +3 -6
  23. data/lib/cucumber/ast/feature_element.rb +18 -9
  24. data/lib/cucumber/ast/outline_table.rb +10 -0
  25. data/lib/cucumber/ast/scenario.rb +16 -1
  26. data/lib/cucumber/ast/scenario_outline.rb +1 -1
  27. data/lib/cucumber/ast/step.rb +4 -2
  28. data/lib/cucumber/ast/step_collection.rb +9 -1
  29. data/lib/cucumber/ast/table.rb +4 -0
  30. data/lib/cucumber/formatter/console.rb +1 -1
  31. data/lib/cucumber/formatter/html.rb +1 -1
  32. data/lib/cucumber/formatter/pretty.rb +7 -8
  33. data/lib/cucumber/languages.yml +30 -0
  34. data/lib/cucumber/parser/feature.rb +196 -10
  35. data/lib/cucumber/parser/feature.tt +26 -10
  36. data/lib/cucumber/rails/world.rb +6 -0
  37. data/lib/cucumber/step_mother.rb +2 -1
  38. data/lib/cucumber/version.rb +1 -1
  39. data/lib/cucumber/world.rb +2 -2
  40. data/rails_generators/cucumber/templates/paths.rb +11 -13
  41. data/rails_generators/feature/feature_generator.rb +1 -1
  42. data/spec/cucumber/ast/feature_element_spec.rb +35 -0
  43. data/spec/cucumber/ast/table_spec.rb +6 -2
  44. data/spec/cucumber/cli/configuration_spec.rb +0 -9
  45. data/spec/cucumber/cli/main_spec.rb +55 -153
  46. data/spec/cucumber/parser/feature_parser_spec.rb +79 -0
  47. data/spec/cucumber/step_mother_spec.rb +12 -5
  48. metadata +17 -13
  49. data/spec/cucumber/formatters/profile_formatter_spec.rb +0 -198
data/History.txt CHANGED
@@ -1,4 +1,21 @@
1
- == 0.3.0 (In Git)
1
+ == 0.3.x (In Git)
2
+
3
+ With the addition of Latvian and Hungarian Cucumber now supports 32(!!) languages.
4
+
5
+ === New features
6
+ * Support multiline names for Scenarios, Scenario Outlines, Backgrounds, Examples (#231 Joseph Wilk)
7
+ * Added #headers to Cucumber::Ast::Table (Ben Mabey)
8
+ * New translation for Latvian (Vitauts Stočka)
9
+ * New translation for Hungarian (#287 Bence Golda)
10
+ * Pick up failure on after hook (#272 Aslak Hellesøy)
11
+
12
+ === Bugfixes
13
+ * Gem no longer depends on Hoe (Aslak Hellesøy)
14
+ * Span html tags appear on HTML results with 0.3.0 (#299 Aslak Hellesøy)
15
+ * Fixed incorrect colours in pretty formatter's table headers for outline tables (Aslak Hellesøy)
16
+ * Exceptions from steps called within hooks are now reraised. (#294 Ben Mabey)
17
+
18
+ == 0.3.0 2009-04-14
2
19
 
3
20
  This release has some minor changes to the APIs, but big enough that a new major release is in order.
4
21
  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,6 +169,7 @@ 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
164
175
  examples/self_test/features/step_definitions/sample_steps.rb
@@ -190,6 +201,8 @@ examples/tickets/features/246.feature
190
201
  examples/tickets/features/248.feature
191
202
  examples/tickets/features/270/back.feature
192
203
  examples/tickets/features/270/back.steps.rb
204
+ examples/tickets/features/272/hooks.feature
205
+ examples/tickets/features/272/hooks_steps.rb
193
206
  examples/tickets/features/279/py_string_indent.feature
194
207
  examples/tickets/features/279/py_string_indent.steps.rb
195
208
  examples/tickets/features/279/wrong.feature_
@@ -211,6 +224,7 @@ features/cucumber_cli.feature
211
224
  features/cucumber_cli_diff_disabled.feature
212
225
  features/cucumber_cli_outlines.feature
213
226
  features/custom_formatter.feature
227
+ features/multiline_names.feature
214
228
  features/rake_task.feature
215
229
  features/report_called_undefined_steps.feature
216
230
  features/snippet.feature
@@ -301,6 +315,7 @@ rails_generators/feature/feature_generator.rb
301
315
  rails_generators/feature/templates/feature.erb
302
316
  rails_generators/feature/templates/steps.erb
303
317
  spec/cucumber/ast/background_spec.rb
318
+ spec/cucumber/ast/feature_element_spec.rb
304
319
  spec/cucumber/ast/feature_factory.rb
305
320
  spec/cucumber/ast/feature_spec.rb
306
321
  spec/cucumber/ast/py_string_spec.rb
@@ -321,7 +336,6 @@ spec/cucumber/formatter/html/cucumber.js
321
336
  spec/cucumber/formatter/html/index.html
322
337
  spec/cucumber/formatter/html/jquery-1.3.min.js
323
338
  spec/cucumber/formatter/html/jquery.uitableedit.js
324
- spec/cucumber/formatters/profile_formatter_spec.rb
325
339
  spec/cucumber/parser/feature_parser_spec.rb
326
340
  spec/cucumber/parser/table_parser_spec.rb
327
341
  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
@@ -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|
@@ -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]
@@ -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
@@ -191,6 +191,36 @@ Feature: Cucumber command line
191
191
  When I stop procrastinating
192
192
  And there is world peace
193
193
 
194
+ Feature: multiline
195
+
196
+ Background: I'm a multiline name
197
+ which goes on and on and on for three lines
198
+ yawn
199
+ Given passing without a table
200
+
201
+ Scenario: I'm a multiline name
202
+ which goes on and on and on for three lines
203
+ yawn
204
+ Given passing without a table
205
+
206
+ Scenario Outline: I'm a multiline name
207
+ which goes on and on and on for three lines
208
+ yawn
209
+ Given <state> without a table
210
+
211
+ Examples:
212
+ | state |
213
+ | passing |
214
+
215
+ Scenario Outline: name
216
+ Given <state> without a table
217
+
218
+ Examples: I'm a multiline name
219
+ which goes on and on and on for three lines
220
+ yawn
221
+ | state |
222
+ | passing |
223
+
194
224
  Feature: Outline Sample
195
225
 
196
226
  Scenario: I have no steps
@@ -242,8 +272,8 @@ Feature: Cucumber command line
242
272
  | table |
243
273
  | example |
244
274
 
245
- 14 scenarios
246
- 12 skipped steps
275
+ 17 scenarios
276
+ 18 skipped steps
247
277
  9 undefined steps
248
278
 
249
279
  """
@@ -0,0 +1,43 @@
1
+ Feature: Multiline description names
2
+ In order to accurately document feature elements
3
+ As a cucumberist
4
+ I want to have multiline names
5
+
6
+ Scenario: multiline scenario
7
+ When I run cucumber features/multiline_name.feature --no-snippets
8
+ Then it should pass with
9
+ """
10
+ Feature: multiline
11
+
12
+ Background: I'm a multiline name # features/multiline_name.feature:3
13
+ which goes on and on and on for three lines
14
+ yawn
15
+ Given passing without a table # features/step_definitions/sample_steps.rb:12
16
+
17
+ Scenario: I'm a multiline name # features/multiline_name.feature:8
18
+ which goes on and on and on for three lines
19
+ yawn
20
+ Given passing without a table # features/step_definitions/sample_steps.rb:12
21
+
22
+ Scenario Outline: I'm a multiline name # features/multiline_name.feature:13
23
+ which goes on and on and on for three lines
24
+ yawn
25
+ Given <state> without a table # features/step_definitions/sample_steps.rb:12
26
+
27
+ Examples:
28
+ | state |
29
+ | passing |
30
+
31
+ Scenario Outline: name # features/multiline_name.feature:21
32
+ Given <state> without a table # features/step_definitions/sample_steps.rb:12
33
+
34
+ Examples: I'm a multiline name
35
+ which goes on and on and on for three lines
36
+ yawn
37
+ | state |
38
+ | passing |
39
+
40
+ 3 scenarios
41
+ 6 passed steps
42
+
43
+ """