cucumber 0.4.3 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. data/History.txt +27 -0
  2. data/VERSION.yml +3 -2
  3. data/cucumber.gemspec +11 -5
  4. data/examples/watir/features/support/screenshots.rb +1 -2
  5. data/features/call_many_steps.feature +124 -0
  6. data/features/default_snippets.feature +2 -2
  7. data/features/expand.feature +13 -2
  8. data/features/language_help.feature +1 -1
  9. data/features/report_called_undefined_steps.feature +1 -1
  10. data/features/snippet.feature +2 -2
  11. data/features/support/env.rb +3 -5
  12. data/features/tag_logic.feature +32 -0
  13. data/features/wire_protocol.feature +7 -7
  14. data/lib/cucumber.rb +6 -0
  15. data/lib/cucumber/ast/background.rb +1 -1
  16. data/lib/cucumber/ast/comment.rb +1 -1
  17. data/lib/cucumber/ast/examples.rb +1 -1
  18. data/lib/cucumber/ast/feature.rb +1 -1
  19. data/lib/cucumber/ast/feature_element.rb +2 -3
  20. data/lib/cucumber/ast/features.rb +1 -1
  21. data/lib/cucumber/ast/outline_table.rb +17 -4
  22. data/lib/cucumber/ast/py_string.rb +3 -1
  23. data/lib/cucumber/ast/scenario.rb +3 -1
  24. data/lib/cucumber/ast/scenario_outline.rb +2 -2
  25. data/lib/cucumber/ast/step.rb +1 -1
  26. data/lib/cucumber/ast/step_collection.rb +1 -1
  27. data/lib/cucumber/ast/step_invocation.rb +2 -1
  28. data/lib/cucumber/ast/table.rb +3 -3
  29. data/lib/cucumber/ast/tags.rb +18 -11
  30. data/lib/cucumber/ast/tree_walker.rb +16 -0
  31. data/lib/cucumber/cli/main.rb +3 -2
  32. data/lib/cucumber/cli/options.rb +4 -6
  33. data/lib/cucumber/cli/profile_loader.rb +4 -0
  34. data/lib/cucumber/filter.rb +2 -2
  35. data/lib/cucumber/formatter/ansicolor.rb +8 -0
  36. data/lib/cucumber/formatter/pretty.rb +3 -4
  37. data/lib/cucumber/language_support/language_methods.rb +4 -3
  38. data/lib/cucumber/languages.yml +1 -1
  39. data/lib/cucumber/parser.rb +2 -0
  40. data/lib/cucumber/parser/common.rb +170 -0
  41. data/lib/cucumber/parser/common.tt +21 -0
  42. data/lib/cucumber/parser/feature.rb +7 -291
  43. data/lib/cucumber/parser/feature.tt +7 -43
  44. data/lib/cucumber/parser/i18n.tt +2 -0
  45. data/lib/cucumber/parser/natural_language.rb +9 -0
  46. data/lib/cucumber/parser/py_string.rb +276 -0
  47. data/lib/cucumber/parser/py_string.tt +45 -0
  48. data/lib/cucumber/parser/table.rb +5 -120
  49. data/lib/cucumber/parser/table.tt +2 -13
  50. data/lib/cucumber/platform.rb +3 -2
  51. data/lib/cucumber/rails/active_record.rb +2 -21
  52. data/lib/cucumber/rails/world.rb +2 -1
  53. data/lib/cucumber/rb_support/rb_hook.rb +2 -1
  54. data/lib/cucumber/rb_support/rb_language.rb +8 -6
  55. data/lib/cucumber/rb_support/rb_step_definition.rb +4 -0
  56. data/lib/cucumber/rb_support/rb_world.rb +16 -37
  57. data/lib/cucumber/step_mother.rb +86 -2
  58. data/lib/cucumber/wire_support/wire_language.rb +2 -2
  59. data/lib/cucumber/wire_support/wire_protocol.rb +1 -1
  60. data/rails_generators/cucumber/cucumber_generator.rb +3 -1
  61. data/rails_generators/cucumber/templates/cucumber.rake +4 -2
  62. data/rails_generators/cucumber/templates/webrat_steps.rb +28 -28
  63. data/spec/cucumber/ast/background_spec.rb +2 -1
  64. data/spec/cucumber/ast/scenario_spec.rb +3 -1
  65. data/spec/cucumber/formatter/console_spec.rb +1 -1
  66. data/spec/cucumber/rb_support/rb_step_definition_spec.rb +14 -5
  67. data/spec/cucumber/step_mother_spec.rb +1 -1
  68. data/spec/cucumber/world/pending_spec.rb +1 -1
  69. metadata +8 -3
@@ -1,3 +1,27 @@
1
+ == 0.4.4 2009-11-13
2
+
3
+ What a bad day to make a release, but here goes.
4
+
5
+ === New features
6
+ * Cucumber should use ActiveSupport::Callbacks for fixtures (#516 Adam Salter)
7
+ * Make 'I' optional in all webrat steps. (Gavin Hughes)
8
+ * Make generated cucumber.rake work with a vendored gem (Alex Rothenberg)
9
+ * Native support for ANSIColor on IronRuby via the iron-term-ansicolor gem (Will Green)
10
+ * Call a bunch of steps from step definitions - also with tables or pystrings. Copy-paste friendly (Bodaniel Jeanes, Jack Chen, Aslak Hellesøy) TODO - WIKI DOCUMENTATION BEFORE RELEASE
11
+
12
+ === Bugfixes
13
+ * Pretty printer fails when expanding scenario outlines with -x when the background includes a table (#515 Mike Sassak)
14
+ * Ensure tags used with Before/After hooks always get parsed (#520 Joseph Wilk)
15
+ * Define IRONRUBY correctly on Ruby 1.9 (Joe Van Dyk)
16
+ * RbStepDefinition#invoke calls #backtrace_line on self rather than @proc (#503 Mike Sassak)
17
+ * Avoid duplicate cucumber entries in database.yml (Daniel Hofstetter)
18
+ * Added respond_to? when checking config.cache_classes for older Rails versions (Jeremy Durham)
19
+
20
+ === Changed Features
21
+ * The code for Czech has changed from cz to cs. (deepj)
22
+ * $cucumber_interrupted is now Cucumber.wants_to_quit - avoid global variable, which gives warnings. (Aslak Hellesøy)
23
+ * Examples keyword without a colon is deprecated loudly. Gherkin will not recognize it at all. (Gherkin #30 Mike Sassak)
24
+
1
25
  == 0.4.3 2009-10-28
2
26
 
3
27
  The exciting thing about this release is that the wire protocol is starting to take shape. This means you can
@@ -16,6 +40,9 @@ As usual there are several small features and bug fixes.
16
40
  * Show scenario and step summary in HTML formatter (#285 Joseph Wilk)
17
41
  * Ast::Table can now be constructed with an Array of Hash. (Aslak Hellesøy)
18
42
 
43
+ === Changed features
44
+ * The #announce method will no longer escape HTML if the html formatter is used. Escaping must be done manually. (Aslak Hellesøy)
45
+
19
46
  === Bugfixes
20
47
  * Fixed incorrect rendering of step arguments with UTF8 characters (Aslak Hellesøy)
21
48
  * "--format rerun", with a Scenario Outline, kills cucumber (#492 Aslak Hellesøy)
@@ -1,4 +1,5 @@
1
1
  ---
2
- :minor: 4
3
- :patch: 3
2
+ :patch: 4
4
3
  :major: 0
4
+ :minor: 4
5
+ :build:
@@ -1,15 +1,15 @@
1
1
  # Generated by jeweler
2
- # DO NOT EDIT THIS FILE
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{cucumber}
8
- s.version = "0.4.3"
8
+ s.version = "0.4.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Aslak Helles\303\270y"]
12
- s.date = %q{2009-10-28}
12
+ s.date = %q{2009-11-13}
13
13
  s.default_executable = %q{cucumber}
14
14
  s.description = %q{A BDD tool written in Ruby}
15
15
  s.email = %q{cukes@googlegroups.com}
@@ -319,6 +319,7 @@ Gem::Specification.new do |s|
319
319
  "features/bug_371.feature",
320
320
  "features/bug_464.feature",
321
321
  "features/bug_475.feature",
322
+ "features/call_many_steps.feature",
322
323
  "features/cucumber_cli.feature",
323
324
  "features/cucumber_cli_diff_disabled.feature",
324
325
  "features/cucumber_cli_outlines.feature",
@@ -430,10 +431,14 @@ Gem::Specification.new do |s|
430
431
  "lib/cucumber/language_support/language_methods.rb",
431
432
  "lib/cucumber/languages.yml",
432
433
  "lib/cucumber/parser.rb",
434
+ "lib/cucumber/parser/common.rb",
435
+ "lib/cucumber/parser/common.tt",
433
436
  "lib/cucumber/parser/feature.rb",
434
437
  "lib/cucumber/parser/feature.tt",
435
438
  "lib/cucumber/parser/i18n.tt",
436
439
  "lib/cucumber/parser/natural_language.rb",
440
+ "lib/cucumber/parser/py_string.rb",
441
+ "lib/cucumber/parser/py_string.tt",
437
442
  "lib/cucumber/parser/table.rb",
438
443
  "lib/cucumber/parser/table.tt",
439
444
  "lib/cucumber/parser/treetop_ext.rb",
@@ -542,7 +547,7 @@ Gem::Specification.new do |s|
542
547
 
543
548
  (::) U P G R A D I N G (::)
544
549
 
545
- Thank you for installing cucumber-0.4.3.
550
+ Thank you for installing cucumber-0.4.4.
546
551
  Please be sure to read http://wiki.github.com/aslakhellesoy/cucumber/upgrading
547
552
  for important information about this release. Happy cuking!
548
553
 
@@ -742,3 +747,4 @@ for important information about this release. Happy cuking!
742
747
  s.add_dependency(%q<spork>, ["= 0.7.3"])
743
748
  end
744
749
  end
750
+
@@ -11,8 +11,7 @@ module Screenshots
11
11
  embed("#{id}.png", "image/png")
12
12
  end
13
13
 
14
- if `which screencapture` =~ /screencapture/
15
- # OS X
14
+ if Cucumber::OS_X
16
15
  def take_screenshot(id)
17
16
  `screencapture -t png #{id}.png`
18
17
  end
@@ -0,0 +1,124 @@
1
+ Feature: http://gist.github.com/221223
2
+ In order to make it easier to extract several steps from
3
+ a feature file to a step definition I want to be able to
4
+ copy and paste.
5
+
6
+ Background:
7
+ Given a standard Cucumber project directory structure
8
+ And a file named "features/f.feature" with:
9
+ """
10
+ Feature: Test
11
+
12
+ Scenario: Multiline string
13
+ Given a multiline string:
14
+ \"\"\"
15
+ hello
16
+ world
17
+ \"\"\"
18
+
19
+ Scenario: Call a multiline string
20
+ Given I call a multiline string with MAMA
21
+
22
+ Scenario: Call a table
23
+ Given I call a table with MAMA
24
+ """
25
+ And a file named "features/step_definitions/steps.rb" with:
26
+ """
27
+ Given /^a multiline string:$/ do |s|
28
+ raise "I got multiline:\n#{s}"
29
+ end
30
+
31
+ Given /^a table:$/ do |t|
32
+ raise "I got table:\n#{t.raw.inspect}"
33
+ end
34
+
35
+ Given /^I call a multiline string with (.*)$/ do |s|
36
+ steps %Q{
37
+ Given a multiline string:
38
+ \"\"\"
39
+ hello
40
+ #{s}
41
+ \"\"\"
42
+ }
43
+ end
44
+
45
+ Given /^I call a table with (.*)$/ do |s|
46
+ steps %Q{
47
+ Given a table:
48
+ |a|b|
49
+ |c|#{s}|
50
+ }
51
+ end
52
+ """
53
+
54
+ Scenario: Multiline string
55
+ When I run cucumber features/f.feature:6
56
+ Then STDERR should be empty
57
+ And it should fail with
58
+ """
59
+ Feature: Test
60
+
61
+ Scenario: Multiline string # features/f.feature:3
62
+ Given a multiline string: # features/step_definitions/steps.rb:1
63
+ \"\"\"
64
+ hello
65
+ world
66
+ \"\"\"
67
+ I got multiline:
68
+ hello
69
+ world (RuntimeError)
70
+ ./features/step_definitions/steps.rb:2:in `/^a multiline string:$/'
71
+ features/f.feature:4:in `Given a multiline string:'
72
+
73
+ Failing Scenarios:
74
+ cucumber features/f.feature:3 # Scenario: Multiline string
75
+
76
+ 1 scenario (1 failed)
77
+ 1 step (1 failed)
78
+
79
+ """
80
+
81
+ Scenario: Call multiline string
82
+ When I run cucumber features/f.feature:10
83
+ Then STDERR should be empty
84
+ And it should fail with
85
+ """
86
+ Feature: Test
87
+
88
+ Scenario: Call a multiline string # features/f.feature:10
89
+ Given I call a multiline string with MAMA # features/step_definitions/steps.rb:9
90
+ I got multiline:
91
+ hello
92
+ MAMA (RuntimeError)
93
+ ./features/step_definitions/steps.rb:2:in `/^a multiline string:$/'
94
+ features/f.feature:11:in `Given I call a multiline string with MAMA'
95
+
96
+ Failing Scenarios:
97
+ cucumber features/f.feature:10 # Scenario: Call a multiline string
98
+
99
+ 1 scenario (1 failed)
100
+ 1 step (1 failed)
101
+
102
+ """
103
+
104
+ Scenario: Call table
105
+ When I run cucumber features/f.feature:13
106
+ Then STDERR should be empty
107
+ And it should fail with
108
+ """
109
+ Feature: Test
110
+
111
+ Scenario: Call a table # features/f.feature:13
112
+ Given I call a table with MAMA # features/step_definitions/steps.rb:19
113
+ I got table:
114
+ [["a", "b"], ["c", "MAMA"]] (RuntimeError)
115
+ ./features/step_definitions/steps.rb:6:in `/^a table:$/'
116
+ features/f.feature:14:in `Given I call a table with MAMA'
117
+
118
+ Failing Scenarios:
119
+ cucumber features/f.feature:13 # Scenario: Call a table
120
+
121
+ 1 scenario (1 failed)
122
+ 1 step (1 failed)
123
+
124
+ """
@@ -27,11 +27,11 @@ Feature: Print snippets
27
27
  You can implement step definitions for undefined steps with these snippets:
28
28
 
29
29
  Given /^Z$/ do
30
- pending
30
+ pending # express the regexp above with the code you wish you had
31
31
  end
32
32
 
33
33
  Given /^Q$/ do
34
- pending
34
+ pending # express the regexp above with the code you wish you had
35
35
  end
36
36
 
37
37
  If you want snippets in a different programming language, just make sure a file
@@ -8,6 +8,12 @@ Feature: --expand option
8
8
  And a file named "features/expand_me.feature" with:
9
9
  """
10
10
  Feature: submit guess
11
+
12
+ Background:
13
+ Given the players' names:
14
+ | maker | breaker |
15
+ | Moriarty | Holmes |
16
+
11
17
  Scenario Outline: submit guess
12
18
  Given the secret code is <code>
13
19
  When I guess <guess>
@@ -26,6 +32,11 @@ Feature: --expand option
26
32
  """
27
33
  Feature: submit guess
28
34
 
35
+ Background:
36
+ Given the players' names:
37
+ | maker | breaker |
38
+ | Moriarty | Holmes |
39
+
29
40
  Scenario Outline: submit guess
30
41
  Given the secret code is <code>
31
42
  When I guess <guess>
@@ -44,6 +55,6 @@ Feature: --expand option
44
55
  Then the mark should be bbww
45
56
 
46
57
  2 scenarios (2 undefined)
47
- 6 steps (6 undefined)
58
+ 8 steps (8 undefined)
48
59
 
49
- """
60
+ """
@@ -29,8 +29,8 @@ Feature: Language help
29
29
  | ar | Arabic | العربية |
30
30
  | bg | Bulgarian | български |
31
31
  | cat | Catalan | català |
32
+ | cs | Czech | Česky |
32
33
  | cy | Welsh | Cymraeg |
33
- | cz | Czech | Česky |
34
34
  | da | Danish | dansk |
35
35
  | de | German | Deutsch |
36
36
  | en | English | English |
@@ -26,7 +26,7 @@ Feature: Cucumber command line
26
26
  You can implement step definitions for undefined steps with these snippets:
27
27
 
28
28
  Given /^this does not exist$/ do
29
- pending
29
+ pending # express the regexp above with the code you wish you had
30
30
  end
31
31
 
32
32
 
@@ -8,7 +8,7 @@ Feature: Snippets
8
8
  Then the output should contain
9
9
  """
10
10
  Given /^a pystring$/ do |string|
11
- pending
11
+ pending # express the regexp above with the code you wish you had
12
12
  end
13
13
  """
14
14
  Scenario: Snippet for undefined step with a step table
@@ -17,6 +17,6 @@ Feature: Snippets
17
17
  """
18
18
  Given /^a table$/ do |table|
19
19
  # table is a Cucumber::Ast::Table
20
- pending
20
+ pending # express the regexp above with the code you wish you had
21
21
  end
22
22
  """
@@ -111,14 +111,12 @@ class CucumberWorld
111
111
  exec cmd
112
112
  end
113
113
  end
114
- sleep 1.0
114
+ sleep (ENV["RUN_CODE_RUN"] ? 5.0 : 1.0)
115
115
  end
116
116
 
117
117
  def terminate_background_jobs
118
- if @background_jobs
119
- @background_jobs.each do |pid|
120
- Process.kill(Signal.list['TERM'], pid)
121
- end
118
+ background_jobs.each do |pid|
119
+ Process.kill(Signal.list['TERM'], pid)
122
120
  end
123
121
  end
124
122
 
@@ -145,6 +145,38 @@ Feature: Tag logic
145
145
 
146
146
  """
147
147
 
148
+ Scenario: Before hooks ANDing with a bad hook matching nothing
149
+ Given a file named "features/support/hooks.rb" with:
150
+ """
151
+ Before('@one,@notused') do
152
+ raise 'boom'
153
+ end
154
+ """
155
+ When I run cucumber -q features/tagulicious.feature
156
+ Then it should pass with
157
+ """
158
+ Feature: Sample
159
+
160
+ @one @three
161
+ Scenario: Example
162
+ Given passing
163
+
164
+ @one
165
+ Scenario: Another Example
166
+ Given passing
167
+
168
+ @three
169
+ Scenario: Yet another Example
170
+ Given passing
171
+
172
+ @ignore
173
+ Scenario: And yet another Example
174
+
175
+ 4 scenarios (3 undefined, 1 passed)
176
+ 3 steps (3 undefined)
177
+
178
+ """
179
+
148
180
  Scenario: After hooks ORing
149
181
  Given a file named "features/support/hooks.rb" with:
150
182
  """
@@ -31,7 +31,7 @@ Feature: Wire Protocol
31
31
  And a file named "features/step_definitions/some_remote_place.wire" with:
32
32
  """
33
33
  host: localhost
34
- port: 98989
34
+ port: 54321
35
35
 
36
36
  """
37
37
 
@@ -45,7 +45,7 @@ Feature: Wire Protocol
45
45
  # be invoked for the given step name.
46
46
 
47
47
  Scenario: Dry run finds no step match
48
- Given there is a wire server running on port 98989 which understands the following protocol:
48
+ Given there is a wire server running on port 54321 which understands the following protocol:
49
49
  | request | response |
50
50
  | ["step_matches",{"name_to_match":"we're all wired"}] | ["step_matches",[]] |
51
51
  When I run cucumber --dry-run -f progress features
@@ -65,7 +65,7 @@ Feature: Wire Protocol
65
65
  # The step match also contains any argument values as parsed out by the wire end's own regular
66
66
  # expression or other argument matching process.
67
67
  Scenario: Dry run finds a step match
68
- Given there is a wire server running on port 98989 which understands the following protocol:
68
+ Given there is a wire server running on port 54321 which understands the following protocol:
69
69
  | request | response |
70
70
  | ["step_matches",{"name_to_match":"we're all wired"}] | ["step_matches",[{"id":"1", "args":[]}]] |
71
71
  When I run cucumber --dry-run -f progress features
@@ -90,7 +90,7 @@ Feature: Wire Protocol
90
90
  # The wire end will reply with either a step_failed or a success message.
91
91
 
92
92
  Scenario: Invoke a step definition which passes
93
- Given there is a wire server running on port 98989 which understands the following protocol:
93
+ Given there is a wire server running on port 54321 which understands the following protocol:
94
94
  | request | response |
95
95
  | ["step_matches",{"name_to_match":"we're all wired"}] | ["step_matches",[{"id":"1", "args":[]}]] |
96
96
  | ["begin_scenario",null] | ["success",null] |
@@ -110,7 +110,7 @@ Feature: Wire Protocol
110
110
  # will then be passed by Cucumber to the formatters for display to the user.
111
111
  #
112
112
  Scenario: Invoke a step definition which fails
113
- Given there is a wire server running on port 98989 which understands the following protocol:
113
+ Given there is a wire server running on port 54321 which understands the following protocol:
114
114
  | request | response |
115
115
  | ["step_matches",{"name_to_match":"we're all wired"}] | ["step_matches",[{"id":"1", "args":[]}]] |
116
116
  | ["begin_scenario",null] | ["success",null] |
@@ -148,7 +148,7 @@ Feature: Wire Protocol
148
148
  # * pos : the position within the step name that the argument was matched (used for formatter highlighting)
149
149
  #
150
150
  Scenario: Invoke a step definition which takes arguments (and passes)
151
- Given there is a wire server running on port 98989 which understands the following protocol:
151
+ Given there is a wire server running on port 54321 which understands the following protocol:
152
152
  | request | response |
153
153
  | ["step_matches",{"name_to_match":"we're all wired"}] | ["step_matches",[{"id":"1", "args":[{"val":"wired", "pos":10}]}]] |
154
154
  | ["begin_scenario",null] | ["success",null] |
@@ -167,7 +167,7 @@ Feature: Wire Protocol
167
167
 
168
168
 
169
169
  Scenario: Unexpected response
170
- Given there is a wire server running on port 98989 which understands the following protocol:
170
+ Given there is a wire server running on port 54321 which understands the following protocol:
171
171
  | request | response |
172
172
  | ["begin_scenario",null] | ["yikes"] |
173
173
  When I run cucumber -f progress features
@@ -7,3 +7,9 @@ require 'cucumber/parser'
7
7
  require 'cucumber/step_mother'
8
8
  require 'cucumber/cli/main'
9
9
  require 'cucumber/broadcaster'
10
+
11
+ module Cucumber
12
+ class << self
13
+ attr_accessor :wants_to_quit
14
+ end
15
+ end