cucumber 0.10.0 → 0.10.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 (52) hide show
  1. data/.gitignore +1 -0
  2. data/Gemfile +1 -1
  3. data/History.txt +20 -0
  4. data/README.rdoc +1 -1
  5. data/bin/cucumber +1 -1
  6. data/cucumber.gemspec +19 -12
  7. data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +1 -1
  8. data/examples/i18n/he/features/step_definitons/calculator_steps.rb +1 -1
  9. data/examples/i18n/ro/features/adunare.feature +12 -0
  10. data/examples/i18n/ro/features/step_definitons/calculator_steps.rb +4 -7
  11. data/examples/i18n/tr/features/step_definitons/hesap_makinesi_adimlari.rb +3 -3
  12. data/features/background.feature +10 -10
  13. data/features/bootstrap.feature +13 -0
  14. data/features/execute_with_tag_filter.feature +2 -2
  15. data/features/hooks.feature +2 -2
  16. data/features/iso-8859-1.feature +6 -0
  17. data/features/stats_formatters.feature +2 -2
  18. data/features/step_definitions/cucumber_steps.rb +8 -2
  19. data/features/step_definitions/iso-8859-1_steps.rb +24 -0
  20. data/features/support/env.rb +2 -2
  21. data/features/tagged_hooks.feature +5 -5
  22. data/features/transforms.feature +63 -0
  23. data/gem_tasks/examples.rake +1 -1
  24. data/legacy_features/diffing.feature +1 -1
  25. data/legacy_features/html_formatter.feature +1 -1
  26. data/legacy_features/html_formatter/a.html +68 -116
  27. data/legacy_features/language_help.feature +44 -45
  28. data/legacy_features/wire_protocol.feature +2 -2
  29. data/legacy_features/wire_protocol_erb.feature +57 -0
  30. data/lib/cucumber/ast/table.rb +2 -2
  31. data/lib/cucumber/ast/tree_walker.rb +2 -2
  32. data/lib/cucumber/cli/configuration.rb +1 -1
  33. data/lib/cucumber/cli/options.rb +4 -0
  34. data/lib/cucumber/feature_file.rb +45 -6
  35. data/lib/cucumber/formatter/console.rb +1 -1
  36. data/lib/cucumber/formatter/cucumber.css +21 -17
  37. data/lib/cucumber/formatter/cucumber.sass +170 -194
  38. data/lib/cucumber/formatter/gherkin_formatter_adapter.rb +2 -2
  39. data/lib/cucumber/formatter/html.rb +8 -5
  40. data/lib/cucumber/platform.rb +3 -3
  41. data/lib/cucumber/rake/task.rb +22 -15
  42. data/lib/cucumber/rb_support/rb_transform.rb +17 -0
  43. data/lib/cucumber/rb_support/rb_world.rb +2 -2
  44. data/lib/cucumber/runtime/for_programming_languages.rb +3 -1
  45. data/lib/cucumber/runtime/user_interface.rb +2 -2
  46. data/lib/cucumber/wire_support/configuration.rb +2 -1
  47. data/spec/cucumber/ast/table_spec.rb +10 -0
  48. data/spec/cucumber/cli/options_spec.rb +7 -0
  49. data/spec/cucumber/formatter/html_spec.rb +1 -3
  50. data/spec/cucumber/rb_support/rb_transform_spec.rb +21 -0
  51. metadata +104 -98
  52. data/examples/i18n/ro/features/suma.feature +0 -11
data/.gitignore CHANGED
@@ -22,3 +22,4 @@ target
22
22
  rerun.txt
23
23
  ._*
24
24
  .rvmrc
25
+ .sass-cache
data/Gemfile CHANGED
@@ -1,7 +1,7 @@
1
1
  source "http://rubygems.org"
2
2
 
3
3
  group :development do
4
- gem 'bundler', '~> 1.0.7'
4
+ # gem 'gherkin', :path => '../gherkin'
5
5
  end
6
6
 
7
7
  gemspec
@@ -1,3 +1,23 @@
1
+ == 0.10.1 (2011-03-20)
2
+
3
+ === New Features
4
+ * The #embed method can take a 3rd optional label argument. In the HTML report that's used for the link title. (Pat Leamon)
5
+ * Render .wire files through ERB (Kevin Olbrich)
6
+ * Happy coexistence with Rake 0.9 (Cezary Baginski)
7
+ * Add -l, --lines option just like rspec's (Gabriel Horner)
8
+ * Support for named transforms. See features/transforms.feature (Matt Wynne)
9
+ * Experimental support for non-UTF-8 encoding in feature files. A "# encoding=iso-8859-1" header (or any other encoding)
10
+ in the file will read the file in with that encoding and convert it to UTF-8 before it's parsed with gherkin.
11
+ Step definition arguments will be passed in UTF-8 encoded strings regardless of the encoding in the feature file.
12
+ * Better error message if there is no features directory (David Lindes)
13
+ * Include scenario file reference in html formatter output (Brandon Faloona)
14
+ * Relax gem dependencies to use >= instead of ~> (Rob Slifka, Aslak Hellesøy)
15
+
16
+ === Bugfixes
17
+ * Missing methods in Runtime::ForProgrammingLanguages - make v8 example run again (Chris Mytton)
18
+ * Features files are sorted before they are executed, giving consistent results accross different OSes (Guewen Baconnier)
19
+ * Remove duplicate lines in backtraces in the HTML report (Jari Bakken)
20
+
1
21
  == 0.10.0 (2010-12-07)
2
22
 
3
23
  We're bumping the minor number in this release because there are some incompatible changes in the JSON support.
@@ -11,7 +11,7 @@ The documentation is at http://wiki.github.com/aslakhellesoy/cucumber/
11
11
  future version unintentionally.
12
12
  * Commit, do not mess with Rakefile, version, or history.
13
13
  (if you want to have your own version, that is fine but
14
- bump version in a commit by itself I can ignore when I pull)
14
+ bump version in a commit by itself I can ignore when I pull)
15
15
  * Send me a pull request. Bonus points for topic branches.
16
16
 
17
17
  == Running tests
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  $:.unshift(File.dirname(__FILE__) + '/../lib') unless $:.include?(File.dirname(__FILE__) + '/../lib')
3
3
 
4
- if(ENV['SIMPLECOV'])
4
+ if(ENV['SIMPLECOV'] && RUBY_VERSION =~ /1\.9/)
5
5
  require 'simplecov'
6
6
  SimpleCov.root(File.expand_path(File.dirname(__FILE__) + '/..'))
7
7
  SimpleCov.start
@@ -24,23 +24,30 @@ for important information about this release. Happy cuking!
24
24
 
25
25
  }
26
26
 
27
- s.add_dependency 'gherkin', '~> 2.3.2'
28
- s.add_dependency 'term-ansicolor', '~> 1.0.5'
27
+ s.add_dependency 'gherkin', '>= 2.3.5'
28
+ s.add_dependency 'term-ansicolor', '>= 1.0.5'
29
29
  s.add_dependency 'builder', '>= 2.1.2'
30
- s.add_dependency 'diff-lcs', '~> 1.1.2'
31
- s.add_dependency 'json', '~> 1.4.6'
30
+ s.add_dependency 'diff-lcs', '>= 1.1.2'
31
+ s.add_dependency 'json', '>= 1.4.6'
32
32
 
33
- s.add_development_dependency 'rake', '~> 0.8.7'
34
- s.add_development_dependency 'rspec', '~> 2.2.0'
35
- s.add_development_dependency 'nokogiri', '~> 1.4.3'
33
+ s.add_development_dependency 'aruba', '>= 0.3.4'
34
+ s.add_development_dependency 'rake', '>= 0.8.7'
35
+ s.add_development_dependency 'rspec', '>= 2.5.0'
36
+ s.add_development_dependency 'nokogiri', '>= 1.4.4'
36
37
  s.add_development_dependency 'prawn', '= 0.8.4'
37
38
  s.add_development_dependency 'prawn-layout', '= 0.8.4'
38
- s.add_development_dependency 'syntax', '~> 1.0.0'
39
- s.add_development_dependency 'spork', '~> 0.8.4'
40
- s.add_development_dependency 'aruba', '~> 0.2.7'
41
- s.add_development_dependency 'simplecov', '~> 0.3.7'
39
+ s.add_development_dependency 'syntax', '>= 1.0.0'
40
+ s.add_development_dependency 'spork', '>= 0.8.4'
41
+ s.add_development_dependency 'simplecov', '>= 0.4.1'
42
+
43
+ # Needed for examples (rake examples)
44
+ s.add_development_dependency 'ramaze'
45
+ s.add_development_dependency 'rack-test', '>= 0.5.7'
46
+ s.add_development_dependency 'webrat', '>= 0.7.3'
47
+ s.add_development_dependency 'sinatra', '>= 1.2.0'
48
+ s.add_development_dependency 'capybara', '>= 0.4.1'
42
49
 
43
- s.rubygems_version = "1.3.7"
50
+ s.rubygems_version = ">= 1.6.1"
44
51
  s.files = `git ls-files`.split("\n")
45
52
  s.test_files = `git ls-files -- {spec,features}/*`.split("\n")
46
53
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
@@ -15,7 +15,7 @@ Given "كتابة $n في الآلة الحاسبة" do |n|
15
15
  @calc.push n.to_i
16
16
  end
17
17
 
18
- When /يتم الضغط على (\w+)/ do |op|
18
+ When /يتم الضغط على (.+)/ do |op|
19
19
  @result = @calc.send op
20
20
  end
21
21
 
@@ -15,7 +15,7 @@ Given /שהזנתי (\d+) למחשבון/ do |n|
15
15
  @calc.push n.to_i
16
16
  end
17
17
 
18
- When /אני לוחץ על (\w+)/ do |op|
18
+ When /אני לוחץ על (.+)/ do |op|
19
19
  @result = @calc.send op
20
20
  end
21
21
 
@@ -0,0 +1,12 @@
1
+ # language: ro
2
+ Funcţionalitate: Adunare
3
+ Pentru a evita erorile stupide
4
+ Ca persoană fără talent la aritmetică
5
+ Vreau să pot face adunări exacte
6
+
7
+ Scenariu: Suma a două numere
8
+ Dat fiind un calculator
9
+ Când introduc 5
10
+ Şi introduc 7
11
+ Şi apăs tasta Egal
12
+ Atunci ecranul trebuie să afişeze 12
@@ -4,21 +4,18 @@ require 'cucumber/formatter/unicode'
4
4
  $:.unshift(File.dirname(__FILE__) + '/../../lib')
5
5
  require 'calculator'
6
6
 
7
- Before do
7
+ Datfiind /un calculator/ do
8
8
  @calc = Calculator.new
9
9
  end
10
10
 
11
- After do
12
- end
13
-
14
- Given /introduc (\d+)/ do |n|
11
+ Cand /introduc (\d+)/ do |n|
15
12
  @calc.push n.to_i
16
13
  end
17
14
 
18
- When 'apas suma' do
15
+ Cand 'apăs tasta Egal' do
19
16
  @result = @calc.add
20
17
  end
21
18
 
22
- Then /rezultatul trebuie sa fie (\d*)/ do |result|
19
+ Atunci /ecranul trebuie afişeze (\d*)/ do |result|
23
20
  @result.should == result.to_i
24
21
  end
@@ -11,14 +11,14 @@ end
11
11
  After do
12
12
  end
13
13
 
14
- Given /hesap makinesine (\d+) girdim/ do |n|
14
+ Diyelimki /hesap makinesine (\d+) girdim/ do |n|
15
15
  @calc.push n.to_i
16
16
  end
17
17
 
18
- When /(\w+) tuşuna basarsam/ do |op|
18
+ Eğerki /(.*) tuşuna basarsam/ do |op|
19
19
  @result = @calc.send op
20
20
  end
21
21
 
22
- Then /ekrandaki sonuç (.*) olmalı/ do |result|
22
+ Ozaman /ekrandaki sonuç (.*) olmalı/ do |result|
23
23
  @result.should == result.to_f
24
24
  end
@@ -188,7 +188,7 @@ Feature: Background
188
188
  """
189
189
 
190
190
  Scenario: run a specific scenario with a background
191
- When I run "cucumber -q features/passing_background.feature:9"
191
+ When I run `cucumber -q features/passing_background.feature:9`
192
192
  Then it should pass with exactly:
193
193
  """
194
194
  Feature: Passing background sample
@@ -206,7 +206,7 @@ Feature: Background
206
206
  """
207
207
 
208
208
  Scenario: run a feature with a background that passes
209
- When I run "cucumber -q features/passing_background.feature"
209
+ When I run `cucumber -q features/passing_background.feature`
210
210
  Then it should pass with exactly:
211
211
  """
212
212
  Feature: Passing background sample
@@ -227,7 +227,7 @@ Feature: Background
227
227
  """
228
228
 
229
229
  Scenario: run a feature with scenario outlines that has a background that passes
230
- When I run "cucumber -q features/scenario_outline_passing_background.feature"
230
+ When I run `cucumber -q features/scenario_outline_passing_background.feature`
231
231
  Then it should pass with exactly:
232
232
  """
233
233
  Feature: Passing background with scenario outlines sample
@@ -256,7 +256,7 @@ Feature: Background
256
256
  """
257
257
 
258
258
  Scenario: run a feature with scenario outlines that has a background that passes
259
- When I run "cucumber -q features/background_tagged_before_on_outline.feature"
259
+ When I run `cucumber -q features/background_tagged_before_on_outline.feature`
260
260
  Then it should pass with exactly:
261
261
  """
262
262
  @background_tagged_before_on_outline
@@ -279,7 +279,7 @@ Feature: Background
279
279
  """
280
280
 
281
281
  Scenario: run a feature with a background that fails
282
- When I run "cucumber -q features/failing_background.feature"
282
+ When I run `cucumber -q features/failing_background.feature`
283
283
  Then it should fail with exactly:
284
284
  """
285
285
  Feature: Failing background sample
@@ -308,7 +308,7 @@ Feature: Background
308
308
  """
309
309
 
310
310
  Scenario: run a feature with scenario outlines that has a background that fails
311
- When I run "cucumber -q features/scenario_outline_failing_background.feature"
311
+ When I run `cucumber -q features/scenario_outline_failing_background.feature`
312
312
  Then it should fail with exactly:
313
313
  """
314
314
  Feature: Failing background with scenario outlines sample
@@ -344,7 +344,7 @@ Feature: Background
344
344
  """
345
345
 
346
346
  Scenario: run a feature with a background that is pending
347
- When I run "cucumber -q features/pending_background.feature"
347
+ When I run `cucumber -q features/pending_background.feature`
348
348
  Then it should pass with exactly:
349
349
  """
350
350
  Feature: Pending background sample
@@ -365,7 +365,7 @@ Feature: Background
365
365
  """
366
366
 
367
367
  Scenario: background passes with first scenario but fails with second
368
- When I run "cucumber -q features/failing_background_after_success.feature"
368
+ When I run `cucumber -q features/failing_background_after_success.feature`
369
369
  Then it should fail with exactly:
370
370
  """
371
371
  Feature: Failing background after previously successful background sample
@@ -413,7 +413,7 @@ Feature: Background
413
413
  @multiline.should == string
414
414
  end
415
415
  """
416
- When I run "cucumber -q features/multiline_args_background.feature"
416
+ When I run `cucumber -q features/multiline_args_background.feature`
417
417
  Then it should pass with exactly:
418
418
  """
419
419
  Feature: Passing background with multiline args
@@ -483,7 +483,7 @@ Feature: Background
483
483
  $after.should == true
484
484
  end
485
485
  """
486
- When I run "cucumber features/only_background_and_hooks.feature"
486
+ When I run `cucumber features/only_background_and_hooks.feature`
487
487
  Then it should pass with exactly:
488
488
  """
489
489
  Feature: woo yeah
@@ -0,0 +1,13 @@
1
+ Feature: Bootstrapping a new project
2
+ In order to have the best chances of getting up and running with cucumber
3
+ As a new cucumber user
4
+ I want cucumber to give helpful error messages in basic situations
5
+
6
+ Scenario: running cucumber against a non-existing feature file
7
+ Given a directory without standard Cucumber project directory structure
8
+ When I run `cucumber`
9
+ Then it should fail with:
10
+ """
11
+ You don't have a 'features' directory. Please create one to get started.
12
+ See http://cukes.info/ for more information.
13
+ """
@@ -25,7 +25,7 @@ Feature: Tag logic
25
25
  """
26
26
 
27
27
  Scenario: ANDing tags
28
- When I run "cucumber -q -t @one -t @three features/tagulicious.feature"
28
+ When I run `cucumber -q -t @one -t @three features/tagulicious.feature`
29
29
  Then it should pass with:
30
30
  """
31
31
  Feature: Sample
@@ -40,7 +40,7 @@ Feature: Tag logic
40
40
  """
41
41
 
42
42
  Scenario: ORing tags
43
- When I run "cucumber -q -t @one,@three features/tagulicious.feature"
43
+ When I run `cucumber -q -t @one,@three features/tagulicious.feature`
44
44
  Then it should pass with:
45
45
  """
46
46
  Feature: Sample
@@ -23,7 +23,7 @@ Feature: Tagged hooks
23
23
  """
24
24
 
25
25
  Scenario: omit tagged hook
26
- When I run "cucumber features/f.feature:2"
26
+ When I run `cucumber features/f.feature:2`
27
27
  Then it should fail with:
28
28
  """
29
29
  Feature: With and without hooks
@@ -42,7 +42,7 @@ Feature: Tagged hooks
42
42
  """
43
43
 
44
44
  Scenario: omit tagged hook
45
- When I run "cucumber features/f.feature:6"
45
+ When I run `cucumber features/f.feature:6`
46
46
  Then it should pass with:
47
47
  """
48
48
  Feature: With and without hooks
@@ -0,0 +1,6 @@
1
+ # language: no
2
+ # encoding: iso-8859-1
3
+ Egenskap: Alle bruker ikke UTF-8
4
+ Scenario: Dette b�r g� bra
5
+ N�r jeg drikker en "�l"
6
+ S� skal de andre si "sk�l"
@@ -28,7 +28,7 @@ Feature: Usage formatter
28
28
  """
29
29
 
30
30
  Scenario: Run with --format usage
31
- When I run "cucumber -f usage --dry-run"
31
+ When I run `cucumber -f usage --dry-run`
32
32
  Then it should pass with exactly:
33
33
  """
34
34
  --------
@@ -52,7 +52,7 @@ Feature: Usage formatter
52
52
  """
53
53
 
54
54
  Scenario: Run with --format stepdefs
55
- When I run "cucumber -f stepdefs --dry-run"
55
+ When I run `cucumber -f stepdefs --dry-run`
56
56
  Then it should pass with exactly:
57
57
  """
58
58
  --------
@@ -1,8 +1,14 @@
1
- When /^I run cucumber "([^"]*)"$/ do |cmd|
1
+ When /^I run cucumber "(.+)"$/ do |cmd|
2
2
  run_simple(unescape("cucumber #{cmd}"), false)
3
3
  end
4
4
 
5
5
  Then /^it should (pass|fail) with JSON:$/ do |pass_fail, json|
6
- JSON.pretty_generate(JSON.parse(all_stdout)).should == JSON.pretty_generate(JSON.parse(json))
6
+ JSON.parse(all_stdout).should == JSON.parse(json)
7
7
  assert_exiting_with(pass_fail == 'pass')
8
8
  end
9
+
10
+ Given /^a directory without standard Cucumber project directory structure$/ do
11
+ in_current_dir do
12
+ FileUtils.rm_rf 'features' if File.directory?('features')
13
+ end
14
+ end
@@ -0,0 +1,24 @@
1
+ # encoding: iso-8859-1
2
+ # Ideally we would use Norwegian keywords here, but that won't work unless this file is UTF-8 encoded.
3
+ # Alternatively it would be possible to use Norwegian keywords and encode the file as UTF-8.
4
+ #
5
+ # In both cases, stepdef arguments will be sent in as UTF-8, regardless of what encoding is used.
6
+ Given /^jeg drikker en "([^"]*)"$/ do |drink|
7
+ drink.should == utf8('�l', 'iso-8859-1')
8
+ end
9
+
10
+ When /^skal de andre si "([^"]*)"$/ do |greeting|
11
+ greeting.should == utf8('sk�l', 'iso-8859-1')
12
+ end
13
+
14
+ module EncodingHelper
15
+ def utf8(string, encoding)
16
+ if string.respond_to?(:encode) # Ruby 1.9
17
+ string.encode('UTF-8')
18
+ else # Ruby 1.8
19
+ require 'iconv'
20
+ Iconv.new('UTF-8', encoding).iconv(string)
21
+ end
22
+ end
23
+ end
24
+ World(EncodingHelper)
@@ -12,7 +12,7 @@ module Aruba::Api
12
12
  # Make duration predictable
13
13
  out.gsub!(/^\d+m\d+\.\d+s$/, '0m0.012s')
14
14
  # Remove SimpleCov message
15
- out.gsub!(/Coverage report generated for Cucumber Features to #{Dir.pwd}\/coverage\n$/, '')
15
+ out.gsub!(/Coverage report generated for Cucumber Features to #{Dir.pwd}\/coverage.*\n$/, '')
16
16
 
17
17
  out
18
18
  end
@@ -24,7 +24,7 @@ Before do |scenario|
24
24
  @scenario = scenario
25
25
 
26
26
  # Make sure bin/cucumber runs with SimpleCov enabled
27
- set_env('SIMPLECOV', 'true')
27
+ # set_env('SIMPLECOV', 'true')
28
28
 
29
29
  # Set a longer timeout for aruba
30
30
  @aruba_timeout_seconds = 5
@@ -31,7 +31,7 @@ Feature: Tag logic
31
31
  raise 'boom'
32
32
  end
33
33
  """
34
- When I run "cucumber -q features/tagulicious.feature"
34
+ When I run `cucumber -q features/tagulicious.feature`
35
35
  Then it should fail with:
36
36
  """
37
37
  Feature: Sample
@@ -74,7 +74,7 @@ Feature: Tag logic
74
74
  raise 'boom'
75
75
  end
76
76
  """
77
- When I run "cucumber -q features/tagulicious.feature"
77
+ When I run `cucumber -q features/tagulicious.feature`
78
78
  Then it should fail with:
79
79
  """
80
80
  Feature: Sample
@@ -111,7 +111,7 @@ Feature: Tag logic
111
111
  raise 'boom'
112
112
  end
113
113
  """
114
- When I run "cucumber -q features/tagulicious.feature"
114
+ When I run `cucumber -q features/tagulicious.feature`
115
115
  Then it should pass with:
116
116
  """
117
117
  Feature: Sample
@@ -143,7 +143,7 @@ Feature: Tag logic
143
143
  raise 'boom'
144
144
  end
145
145
  """
146
- When I run "cucumber -q features/tagulicious.feature"
146
+ When I run `cucumber -q features/tagulicious.feature`
147
147
  Then it should fail with:
148
148
  """
149
149
  Feature: Sample
@@ -186,7 +186,7 @@ Feature: Tag logic
186
186
  raise 'boom'
187
187
  end
188
188
  """
189
- When I run "cucumber -q features/tagulicious.feature"
189
+ When I run `cucumber -q features/tagulicious.feature`
190
190
  Then it should fail with:
191
191
  """
192
192
  Feature: Sample