cucumber 0.3.99 → 0.3.100

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,15 @@
1
+ == 0.3.100 2009-09-09
2
+
3
+ The JavaZone release!
4
+
5
+ === New Features
6
+ * Added support for Uzbek (msarvar)
7
+ * The file argument on the cucumber command line will replace contents of file on cli if file is prefixed with @ (Tero Tilus)
8
+
9
+ === Bugfixes
10
+ * Backtraces on JRuby are handled in a cleaner way when the exception comes from Java (NativeException). (Aslak Hellesøy)
11
+ * When exceptions occur in a Before block the rest of the scenario is now skipped (#331 Matt Wynne)
12
+
1
13
  == 0.3.99 2009-09-03
2
14
 
3
15
  === New Features
@@ -63,7 +75,7 @@ data in your HTML with a Cucumber table using Cucumber::Ast::Table#diff!
63
75
  This release also fixes several bugs related to --drb (Spork) and profiles (cucumber.yml)
64
76
 
65
77
  === Bug Fixes
66
- * --guess will always prefer the longest regexp with no groups if they exist.
78
+ * --guess will always prefer the longest regexp with no groups if they exist.
67
79
  * Prevent delays if a NoMethodError is raise in a step definition. Define a light #inspect in World. (#374 Aslak Hellesøy)
68
80
  * Restore 'features' as the default feature running path. (#412 Ben Mabey)
69
81
  * --drb degrades gracefully when no drb server is running and no formatter is provided. (#410 Ben Mabey)
@@ -71,7 +83,7 @@ This release also fixes several bugs related to --drb (Spork) and profiles (cucu
71
83
  * Resolved infinite loop problem when --drb was defined in a profile. (#408 Ben Mabey)
72
84
 
73
85
  === New Features
74
- * Cucumber::World#table has been overloaded to work with 2D Array in addition to a table String to be parsed.
86
+ * Cucumber::World#table has been overloaded to work with 2D Array in addition to a table String to be parsed.
75
87
  * New When /^I fill in the following:$/ step definition for Webrat. Useful for filling out a form with a Table. (Aslak Hellesøy)
76
88
  * The object returned by element_at (Webrat::Element) has a #to_table that works for table, dl, ol and ul. (Aslak Hellesøy)
77
89
  * An explanation of why failures are ok is printed when --wip is used. (Aslak Hellesøy)
@@ -99,7 +111,7 @@ So upgrade today and get into the habit of tagging new features with @wip (or in
99
111
  You'll achieve better flow this way.
100
112
 
101
113
  === New features
102
- * Support limiting the number of feature elements with certain tags (#353 Joseph Wilk)
114
+ * Support limiting the number of feature elements with certain tags (#353 Joseph Wilk)
103
115
  * script/generate cucumber sets up 'cucumber:ok' and 'cucumber:wip' tasks and deprecates 'features'. More Kanban love. (#344 Aslak Hellesøy)
104
116
  * Better JUnit formatter: feature->testsuite, scenario->testcase. Better timing and support for background and scenario outline. (Mads Buus Westmark)
105
117
  * Added examples/python that uses rubypython. (Aslak Hellesøy)
@@ -122,8 +134,8 @@ Highlights in this release: Improved profile handling (cucumber.yml) and a fix f
122
134
  * click_link_within(parent, link) webrat step (Joakim Kolsjö)
123
135
 
124
136
  === Bugfixes
125
- * script/cucumber correctly loads the gem's binary if the plugin isn't installed.
126
- * Cucumber hangs waiting for Ctrl+C if an Error is raised. (#374 Aslak Hellesøy)
137
+ * script/cucumber correctly loads the gem's binary if the plugin isn't installed.
138
+ * Cucumber hangs waiting for Ctrl+C if an Error is raised. (#374 Aslak Hellesøy)
127
139
 
128
140
  == 0.3.92 2009-07-29
129
141
 
@@ -197,7 +209,7 @@ or simply another Ast::Table object. Here is a simple example:
197
209
  expected_cukes_table.diff!(actual_table)
198
210
  end
199
211
 
200
- As an extra bonus we provide Webrat users with a new #table_at(selector) method that you can use to transform
212
+ As an extra bonus we provide Webrat users with a new #table_at(selector) method that you can use to transform
201
213
  an HTML table into an Array of Array, so that you can easily compare the contents of your HTML table to
202
214
  expected data passed to a step. Here is an example:
203
215
 
@@ -206,7 +218,7 @@ expected data passed to a step. Here is an example:
206
218
  end
207
219
 
208
220
  You can do the same trick to compare data from a Rails ActiveRecord table (although this is not a
209
- recommended practice - your Then steps should compare against what users *see*, not what's in the
221
+ recommended practice - your Then steps should compare against what users *see*, not what's in the
210
222
  database):
211
223
 
212
224
  # This requires that you use the column names in the header of the plain text expected table
@@ -243,7 +255,7 @@ This release also has several bugfixes related to --format and Before/After hook
243
255
  === New Features
244
256
  * I should see should support regexes (#382 John Ferlito)
245
257
  * Access to scenario outline name from After hook scenario parameter (#342 Aslak Hellesøy)
246
- * Allow multiple --tags switches to be passed
258
+ * Allow multiple --tags switches to be passed
247
259
  * Load step definitions from vendored gems and plugins (#388 Mike Burns)
248
260
  * New --format steps formatter. Variant of the usage formatter that lists available step definitions (Demetrius Nunes)
249
261
  * Possibility to specify scenario language as part of the .feature file (#345 Aslak Hellesøy)
@@ -907,7 +919,7 @@ spaces removed too.
907
919
  == 0.1.8 2008-10-18
908
920
 
909
921
  This release extends the support for tables. PLEASE NOTE THAT TABLES ARE STILL EXPERIMENTAL.
910
- In previous releases it has been possible to use tables to define "more examples" of a scenario in
922
+ In previous releases it has been possible to use tables to define "more examples" of a scenario in
911
923
  a FIT-style column fixture kind of way. Now you can also use tables as arguments to steps.
912
924
 
913
925
  Tables used to define more examples after a scenario must now be prefixed. In English it looks like this:
@@ -147,6 +147,14 @@ examples/i18n/sk/features/addition.feature
147
147
  examples/i18n/sk/features/division.feature
148
148
  examples/i18n/sk/features/step_definitons/calculator_steps.rb
149
149
  examples/i18n/sk/lib/calculator.rb
150
+ examples/i18n/uz/Rakefile
151
+ examples/i18n/uz/features/addition.feature
152
+ examples/i18n/uz/features/consecutive_calculations.feature
153
+ examples/i18n/uz/features/division.feature
154
+ examples/i18n/uz/features/step_definitons/calculator_steps.rb
155
+ examples/i18n/uz/features/support/env.rb
156
+ examples/i18n/uz/features/support/world.rb
157
+ examples/i18n/uz/lib/calculator.rb
150
158
  examples/i18n/zh-CN/Rakefile
151
159
  examples/i18n/zh-CN/features/addition.feature
152
160
  examples/i18n/zh-CN/features/step_definitons/calculator_steps.rb
@@ -204,6 +212,7 @@ examples/self_test/features/support/env.rb
204
212
  examples/self_test/features/tags_sample.feature
205
213
  examples/self_test/features/tons_of_cukes.feature
206
214
  examples/self_test/features/undefined_multiline_args.feature
215
+ examples/self_test/list-of-features.txt
207
216
  examples/sinatra/README.textile
208
217
  examples/sinatra/Rakefile
209
218
  examples/sinatra/app.rb
@@ -253,8 +262,6 @@ examples/watir/Rakefile
253
262
  examples/watir/features/search.feature
254
263
  examples/watir/features/step_definitons/search_steps.rb
255
264
  examples/watir/features/support/env.rb
256
- features/after_block_exceptions.feature
257
- features/after_step_block_exceptions.feature
258
265
  features/background.feature
259
266
  features/bug_371.feature
260
267
  features/cucumber_cli.feature
@@ -262,6 +269,9 @@ features/cucumber_cli_diff_disabled.feature
262
269
  features/cucumber_cli_outlines.feature
263
270
  features/custom_formatter.feature
264
271
  features/drb_server_integration.feature
272
+ features/exception_in_after_block.feature
273
+ features/exception_in_after_step_block.feature
274
+ features/exception_in_before_block.feature
265
275
  features/exclude_files.feature
266
276
  features/expand.feature
267
277
  features/html_formatter.feature
@@ -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 = %w{--format pretty}
6
+ end
@@ -0,0 +1,10 @@
1
+ # language: uz
2
+ Функционал: Сонларни кушиш
3
+ Хаелда кушмаслик учун
4
+ Купчилик сонларни атомат равищда кушишни истайди
5
+
6
+ Сценарий: Икки бутун сонни кушиш
7
+ Агар 50 сонини киритсам
8
+ Ва ундан сунг 70 сонини киритсам
9
+ Агар "+" боссам
10
+ Унда жавоб 120 сони булиши керак
@@ -0,0 +1,17 @@
1
+ # language: uz
2
+ Функционал: Кетма кет хисобот
3
+ Мураккаб амалларни хисоблаш учун
4
+ Ишлатувчилар олдинги жавоблар устидан амаллар бажармокчилардыдущей операций
5
+
6
+ Тарих:
7
+ Агар 3 ва 5 сонини кушсам
8
+
9
+ Сценарий: охирги жавоб билан кушиш амали
10
+ Агар 4 сонини киритсам
11
+ Ва "+"ни боссам
12
+ Унда жавоб 12 сони булиши керак
13
+
14
+ Сценарий: охирги жавобни булиш
15
+ Агар 2 сонини киритсам
16
+ Ва "/"ни боссам
17
+ Унда жавоб 4 сони булиши керак
@@ -0,0 +1,17 @@
1
+ # language: uz
2
+ Функционал: Сонларни булиш
3
+ Булиш кийин амал булганлиги сабабли
4
+ Одамларга бу амални калькуляторда килишни имконини бериш керак
5
+
6
+ Сценарий структураси: Бутун сонли булиш
7
+ Агар ман <булинувчи> сонини киритсам
8
+ Ва унда сунг <булувчи> сонини киритсам
9
+ Агар "/"ни боссам
10
+ Унда жавоб <булинма> сони булиши керак
11
+
12
+ Мисоллар:
13
+ | булинувчи | булувчи | булинма |
14
+ | 100 | 2 | 50 |
15
+ | 28 | 7 | 4 |
16
+ | 0 | 5 | 0 |
17
+
@@ -0,0 +1,19 @@
1
+ # encoding: utf-8
2
+
3
+ Агар /(\d+) сонини киритсам/ do |сон|
4
+ calc.push сон.to_i
5
+ end
6
+
7
+ Ва /"(.*)"(.*) боссам/ do |операция, _|
8
+ calc.send операция
9
+ end
10
+
11
+ Унда /жавоб (\d+) сони булиши керак/ do |жавоб|
12
+ calc.result.should == жавоб.to_f
13
+ end
14
+
15
+ Агар /(\d+) ва (\d+) сонини кушсам/ do |кушилувчи1, кушилувчи2|
16
+ Агар %{#{кушилувчи1} сонини киритсам}
17
+ Агар %{ундан сунг #{кушилувчи2} сонини киритсам}
18
+ Агар %{"+"ни боссам}
19
+ end
@@ -0,0 +1,6 @@
1
+ # encoding: utf-8
2
+ require 'spec/expectations'
3
+ $:.unshift(File.dirname(__FILE__) + '/../../lib')
4
+ require 'cucumber/formatter/unicode'
5
+ require 'calculator'
6
+ $KCODE='u' unless Cucumber::RUBY_1_9
@@ -0,0 +1,8 @@
1
+ # encoding: utf-8
2
+ module LazyCalc
3
+ def calc
4
+ @calc ||= Calculator.new
5
+ end
6
+ end
7
+
8
+ World(LazyCalc)
@@ -0,0 +1,24 @@
1
+ # encoding: utf-8
2
+
3
+ class Calculator
4
+ def initialize
5
+ @stack = []
6
+ end
7
+
8
+ def push(arg)
9
+ @stack.push arg
10
+ end
11
+
12
+ def result
13
+ @stack.last
14
+ end
15
+
16
+ def +
17
+ @stack.push @stack.pop + @stack.pop
18
+ end
19
+
20
+ def /
21
+ divisor, dividend = [@stack.pop, @stack.pop] # Hm, @stack.pop(2) doesn't work
22
+ @stack.push dividend / divisor
23
+ end
24
+ end
@@ -0,0 +1 @@
1
+ features/sample.feature:12
@@ -127,6 +127,26 @@ Feature: Cucumber command line
127
127
 
128
128
  """
129
129
 
130
+ Scenario: Use @-notation to specify a file containing feature file list
131
+ When I run cucumber -q @list-of-features.txt
132
+ Then it should pass with
133
+ """
134
+ # Feature comment
135
+ @one
136
+ Feature: Sample
137
+
138
+ # Scenario comment
139
+ @three
140
+ Scenario: Passing
141
+ Given passing
142
+ | a | b |
143
+ | c | d |
144
+
145
+ 1 scenario (1 passed)
146
+ 1 step (1 passed)
147
+
148
+ """
149
+
130
150
  @mri186
131
151
  Scenario: Run all with progress formatter
132
152
  When I run cucumber -q --format progress features/sample.feature
@@ -1,8 +1,8 @@
1
- Feature: After Block Exceptions
1
+ Feature: Exception in After Block
2
2
  In order to use custom assertions at the end of each scenario
3
3
  As a developer
4
4
  I want exceptions raised in After blocks to be handled gracefully and reported by the formatters
5
-
5
+
6
6
  Background:
7
7
  Given a standard Cucumber project directory structure
8
8
  And a file named "features/step_definitions/steps.rb" with:
@@ -11,7 +11,7 @@ Feature: After Block Exceptions
11
11
  @naughty = true
12
12
  end
13
13
 
14
- Given /^this step works$/ do
14
+ Given /^this step works$/ do
15
15
  end
16
16
  """
17
17
  And a file named "features/support/env.rb" with:
@@ -37,10 +37,10 @@ Feature: After Block Exceptions
37
37
  Given this step works
38
38
  """
39
39
  When I run cucumber features
40
- Then it should fail with
40
+ Then it should fail with
41
41
  """
42
42
  Feature: Sample
43
-
43
+
44
44
  Scenario: Naughty Step # features/naughty_step_in_scenario.feature:3
45
45
  Given this step does something naughty # features/step_definitions/steps.rb:1
46
46
  This scenario has been very very naughty (NaughtyScenarioException)
@@ -48,13 +48,13 @@ Feature: After Block Exceptions
48
48
 
49
49
  Scenario: Success # features/naughty_step_in_scenario.feature:6
50
50
  Given this step works # features/step_definitions/steps.rb:5
51
-
51
+
52
52
  Failing Scenarios:
53
53
  cucumber features/naughty_step_in_scenario.feature:3 # Scenario: Naughty Step
54
-
54
+
55
55
  2 scenarios (1 failed, 1 passed)
56
56
  2 steps (2 passed)
57
-
57
+
58
58
  """
59
59
 
60
60
  @mri186
@@ -65,7 +65,7 @@ Feature: After Block Exceptions
65
65
 
66
66
  Scenario Outline: Naughty Step
67
67
  Given this step <Might Work>
68
-
68
+
69
69
  Examples:
70
70
  | Might Work |
71
71
  | works |
@@ -74,16 +74,16 @@ Feature: After Block Exceptions
74
74
 
75
75
  Scenario: Success
76
76
  Given this step works
77
-
77
+
78
78
  """
79
79
  When I run cucumber features
80
- Then it should fail with
80
+ Then it should fail with
81
81
  """
82
82
  Feature: Sample
83
-
83
+
84
84
  Scenario Outline: Naughty Step # features/naughty_step_in_scenario_outline.feature:3
85
85
  Given this step <Might Work> # features/step_definitions/steps.rb:5
86
-
86
+
87
87
  Examples:
88
88
  | Might Work |
89
89
  | works |
@@ -91,12 +91,12 @@ Feature: After Block Exceptions
91
91
  This scenario has been very very naughty (NaughtyScenarioException)
92
92
  ./features/support/env.rb:4:in `After'
93
93
  | works |
94
-
94
+
95
95
  Scenario: Success # features/naughty_step_in_scenario_outline.feature:12
96
96
  Given this step works # features/step_definitions/steps.rb:5
97
-
97
+
98
98
  4 scenarios (1 failed, 3 passed)
99
99
  4 steps (4 passed)
100
-
100
+
101
101
  """
102
-
102
+
@@ -1,8 +1,8 @@
1
- Feature: AfterStep Block Exceptions
1
+ Feature: Exception in AfterStep Block
2
2
  In order to use custom assertions at the end of each step
3
3
  As a developer
4
4
  I want exceptions raised in AfterStep blocks to be handled gracefully and reported by the formatters
5
-
5
+
6
6
  Background:
7
7
  Given a standard Cucumber project directory structure
8
8
  And a file named "features/step_definitions/steps.rb" with:
@@ -11,7 +11,7 @@ Feature: AfterStep Block Exceptions
11
11
  @naughty = true
12
12
  end
13
13
 
14
- Given /^this step works$/ do
14
+ Given /^this step works$/ do
15
15
  end
16
16
  """
17
17
  And a file named "features/support/env.rb" with:
@@ -37,10 +37,10 @@ Feature: AfterStep Block Exceptions
37
37
  Given this step works
38
38
  """
39
39
  When I run cucumber features
40
- Then it should fail with
40
+ Then it should fail with
41
41
  """
42
42
  Feature: Sample
43
-
43
+
44
44
  Scenario: Naughty Step # features/naughty_step_in_scenario.feature:3
45
45
  Given this step does something naughty # features/step_definitions/steps.rb:1
46
46
  This step has been very very naughty (NaughtyStepException)
@@ -49,13 +49,13 @@ Feature: AfterStep Block Exceptions
49
49
 
50
50
  Scenario: Success # features/naughty_step_in_scenario.feature:6
51
51
  Given this step works # features/step_definitions/steps.rb:5
52
-
52
+
53
53
  Failing Scenarios:
54
54
  cucumber features/naughty_step_in_scenario.feature:3 # Scenario: Naughty Step
55
-
55
+
56
56
  2 scenarios (1 failed, 1 passed)
57
57
  2 steps (1 failed, 1 passed)
58
-
58
+
59
59
  """
60
60
 
61
61
  @mri186
@@ -78,7 +78,7 @@ Feature: AfterStep Block Exceptions
78
78
 
79
79
  """
80
80
  When I run cucumber features
81
- Then it should fail with
81
+ Then it should fail with
82
82
  """
83
83
  Feature: Sample
84
84
 
@@ -0,0 +1,47 @@
1
+ Feature: Exception in Before Block
2
+ In order to know with confidence that my before blocks have run OK
3
+ As a developer
4
+ I want exceptions raised in Before blocks to be handled gracefully and reported by the formatters
5
+
6
+ Background:
7
+ Given a standard Cucumber project directory structure
8
+ And a file named "features/step_definitions/steps.rb" with:
9
+ """
10
+ Given /^this step works$/ do
11
+ end
12
+ """
13
+ And a file named "features/support/env.rb" with:
14
+ """
15
+ class SomeSetupException < Exception; end
16
+ class BadStepException < Exception; end
17
+ Before do
18
+ raise SomeSetupException.new("I cannot even start this scenario")
19
+ end
20
+ """
21
+
22
+ @mri186
23
+ Scenario: Handle Exception in standard scenario step and carry on
24
+ Given a file named "features/naughty_step_in_scenario.feature" with:
25
+ """
26
+ Feature: Sample
27
+
28
+ Scenario: Run a good step
29
+ Given this step works
30
+ """
31
+ When I run cucumber features
32
+ Then it should fail with
33
+ """
34
+ Feature: Sample
35
+
36
+ Scenario: Run a good step # features/naughty_step_in_scenario.feature:3
37
+ I cannot even start this scenario (SomeSetupException)
38
+ ./features/support/env.rb:4:in `Before'
39
+ Given this step works # features/step_definitions/steps.rb:1
40
+
41
+ Failing Scenarios:
42
+ cucumber features/naughty_step_in_scenario.feature:3 # Scenario: Run a good step
43
+
44
+ 1 scenario (1 failed)
45
+ 1 step (1 skipped)
46
+
47
+ """
@@ -7,33 +7,45 @@ module Cucumber
7
7
 
8
8
  attr_reader :name, :line
9
9
 
10
+ class EmptyBackground
11
+ def failed?
12
+ false
13
+ end
14
+
15
+ def feature_elements
16
+ []
17
+ end
18
+
19
+ def step_collection(step_invocations)
20
+ StepCollection.new(step_invocations)
21
+ end
22
+ end
23
+
10
24
  def initialize(background, comment, tags, line, keyword, name, steps)
11
- @background, @comment, @tags, @line, @keyword, @name = background, comment, tags, line, keyword, name
25
+ @background = background || EmptyBackground.new
26
+ @comment, @tags, @line, @keyword, @name = comment, tags, line, keyword, name
12
27
  attach_steps(steps)
13
28
 
14
29
  step_invocations = steps.map{|step| step.step_invocation}
15
- if @background
16
- @steps = @background.step_collection(step_invocations)
17
- @background.feature_elements << self
18
- else
19
- @steps = StepCollection.new(step_invocations)
20
- end
30
+ @steps = @background.step_collection(step_invocations)
31
+ @background.feature_elements << self
21
32
  end
22
33
 
23
34
  def accept(visitor)
24
35
  return if $cucumber_interrupted
25
- visitor.visit_comment(@comment) unless @comment.empty?
26
- visitor.visit_tags(@tags)
27
- visitor.visit_scenario_name(@keyword, @name, file_colon_line(@line), source_indent(first_line_length))
36
+
37
+ with_visitor(visitor) do
38
+ visitor.visit_comment(@comment) unless @comment.empty?
39
+ visitor.visit_tags(@tags)
40
+ visitor.visit_scenario_name(@keyword, @name, file_colon_line(@line), source_indent(first_line_length))
28
41
 
29
- background_failed = @background && @background.failed?
30
- skip_invoke! if background_failed
31
- skip_hooks = background_failed || @executed
32
- visitor.step_mother.before_and_after(self, skip_hooks) do
33
- visitor.visit_steps(@steps)
42
+ skip_invoke! if @background.failed?
43
+ visitor.step_mother.before_and_after(self, skip_hooks?) do
44
+ skip_invoke! if failed?
45
+ visitor.visit_steps(@steps)
46
+ end
47
+ @executed = true
34
48
  end
35
- visitor.visit_exception(@exception, :failed) if @exception
36
- @executed = true
37
49
  end
38
50
 
39
51
  # Returns true if one or more steps failed
@@ -43,6 +55,7 @@ module Cucumber
43
55
 
44
56
  def fail!(exception)
45
57
  @exception = exception
58
+ @current_visitor.visit_exception(@exception, :failed)
46
59
  end
47
60
 
48
61
  # Returns true if all steps passed
@@ -78,7 +91,18 @@ module Cucumber
78
91
  sexp += steps if steps.any?
79
92
  sexp
80
93
  end
81
-
94
+
95
+ private
96
+
97
+ def with_visitor(visitor)
98
+ @current_visitor = visitor
99
+ yield
100
+ @current_visitor = nil
101
+ end
102
+
103
+ def skip_hooks?
104
+ @background.failed? || @executed
105
+ end
82
106
  end
83
107
  end
84
108
  end
@@ -89,12 +89,18 @@ module Cucumber
89
89
  BACKTRACE_FILTER_PATTERNS.detect { |p| line =~ p }
90
90
  end
91
91
 
92
- if Cucumber::JRUBY
93
- # In order to filter backtraces properly on JRuby, we need to
94
- # create a new Exception - otherwise the backtrace is *not*
95
- # filtered. The rescue is for org.jruby.NativeException, which
96
- # cannot be new'ed.
97
- e = e.class.new(e.message) rescue Exception.new(e.message)
92
+ if Cucumber::JRUBY && e.class.name == 'NativeException'
93
+ # JRuby's NativeException ignores #set_backtrace.
94
+ # We're fixing it.
95
+ e.instance_eval do
96
+ def set_backtrace(backtrace)
97
+ @backtrace = backtrace
98
+ end
99
+
100
+ def backtrace
101
+ @backtrace
102
+ end
103
+ end
98
104
  end
99
105
  e.set_backtrace(filtered)
100
106
  e
@@ -1,3 +1,4 @@
1
+ require 'logger'
1
2
  require 'cucumber/cli/options'
2
3
  require 'cucumber/constantize'
3
4
 
@@ -123,7 +124,14 @@ module Cucumber
123
124
  potential_feature_files = paths.map do |path|
124
125
  path = path.gsub(/\\/, '/') # In case we're on windows. Globs don't work with backslashes.
125
126
  path = path.chomp('/')
126
- File.directory?(path) ? Dir["#{path}/**/*.feature"] : path
127
+ if File.directory?(path)
128
+ Dir["#{path}/**/*.feature"]
129
+ elsif path[0..0] == '@' and # @listfile.txt
130
+ File.file?(path[1..-1]) # listfile.txt is a file
131
+ IO.read(path[1..-1]).split
132
+ else
133
+ path
134
+ end
127
135
  end.flatten.uniq
128
136
  remove_excluded_files_from(potential_feature_files)
129
137
  potential_feature_files
@@ -133,8 +141,22 @@ module Cucumber
133
141
  paths.map { |f| File.directory?(f) ? f : File.dirname(f) }.uniq
134
142
  end
135
143
 
144
+ def log
145
+ logger = Logger.new(@out_stream)
146
+ logger.formatter = LogFormatter.new
147
+ logger.level = Logger::INFO
148
+ logger.level = Logger::DEBUG if self.verbose?
149
+ logger
150
+ end
151
+
136
152
  private
137
153
 
154
+ class LogFormatter < ::Logger::Formatter
155
+ def call(severity, time, progname, msg)
156
+ msg
157
+ end
158
+ end
159
+
138
160
  def paths
139
161
  @options[:paths].empty? ? ['features'] : @options[:paths]
140
162
  end
@@ -14,12 +14,6 @@ module Cucumber
14
14
  class Main
15
15
  FAILURE = 1
16
16
 
17
- class LogFormatter < ::Logger::Formatter
18
- def call(severity, time, progname, msg)
19
- msg
20
- end
21
- end
22
-
23
17
  class << self
24
18
  def step_mother
25
19
  @step_mother ||= StepMother.new
@@ -46,12 +40,7 @@ module Cucumber
46
40
  end
47
41
  end
48
42
  step_mother.options = configuration.options
49
-
50
- logger = Logger.new(@out_stream)
51
- logger.formatter = LogFormatter.new
52
- logger.level = Logger::INFO
53
- logger.level = Logger::DEBUG if configuration.verbose?
54
- step_mother.log = logger
43
+ step_mother.log = configuration.log
55
44
 
56
45
  step_mother.load_code_files(configuration.support_to_load)
57
46
  step_mother.after_configuration(configuration)
@@ -97,10 +86,6 @@ module Cucumber
97
86
  @configuration
98
87
  end
99
88
 
100
- def verbose_log(string)
101
- @out_stream.puts(string) if configuration.verbose?
102
- end
103
-
104
89
  private
105
90
 
106
91
  def enable_diffing
@@ -17,7 +17,9 @@ module Cucumber
17
17
  max = BUILTIN_FORMATS.keys.map{|s| s.length}.max
18
18
  FORMAT_HELP = (BUILTIN_FORMATS.keys.sort.map do |key|
19
19
  " #{key}#{' ' * (max - key.length)} : #{BUILTIN_FORMATS[key][1]}"
20
- end) + ["FORMAT can also be the fully qualified class name of",
20
+ end) + ["Use --format rerun --out features.txt to rerun failing",
21
+ "failing features in a new run with cucumber @features.txt.",
22
+ "FORMAT can also be the fully qualified class name of",
21
23
  "your own custom formatter. If the class isn't loaded,",
22
24
  "Cucumber will attempt to require a file with a relative",
23
25
  "file name that is the underscore name of the class name.",
@@ -87,6 +89,7 @@ module Cucumber
87
89
  opts.banner = ["Usage: cucumber [options] [ [FILE|DIR|URL][:LINE[:LINE]*] ]+", "",
88
90
  "Examples:",
89
91
  "cucumber examples/i18n/en/features",
92
+ "cucumber @features.txt (See --format rerun)",
90
93
  "cucumber --language it examples/i18n/it/features/somma.feature:6:98:113",
91
94
  "cucumber -s -i http://rubyurl.com/eeCl", "", "",
92
95
  ].join("\n")
@@ -500,6 +500,20 @@
500
500
  and: A
501
501
  but: Ale
502
502
  space_after_keyword: true
503
+ "uz":
504
+ name: Uzbek
505
+ native: Узбекча
506
+ encoding: UTF-8
507
+ feature: Функционал
508
+ background: Тарих
509
+ scenario: Сценарий
510
+ scenario_outline: Сценарий структураси
511
+ examples: Мисоллар
512
+ given: Агар
513
+ when: Агар
514
+ then: Унда
515
+ and: Ва
516
+ but: Лекин|Бирок|Аммо
503
517
  "vi":
504
518
  name: Vietnamese
505
519
  native: Tiếng Việt
@@ -1,4 +1,3 @@
1
- require 'logger'
2
1
  require 'cucumber/constantize'
3
2
  require 'cucumber/core_ext/instance_exec'
4
3
  require 'cucumber/parser/natural_language'
@@ -2,7 +2,7 @@ module Cucumber #:nodoc:
2
2
  class VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 3
5
- TINY = 99
5
+ TINY = 100
6
6
  PATCH = nil # Set to nil for official release
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PATCH].compact.join('.')
@@ -109,6 +109,15 @@ module Cucumber
109
109
  end
110
110
  })
111
111
  end
112
+
113
+ it "should be helpful with tables" do
114
+ @rb.snippet_text('Given', 'A "first" arg', Cucumber::Ast::Table).should == unindented(%{
115
+ Given /^A "([^\\"]*)" arg$/ do |arg1, table|
116
+ # table is a Cucumber::Ast::Table
117
+ pending
118
+ end
119
+ })
120
+ end
112
121
  end
113
122
  end
114
123
  end
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.3.99
4
+ version: 0.3.100
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: 2009-09-03 00:00:00 +02:00
12
+ date: 2009-09-09 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -74,6 +74,7 @@ extra_rdoc_files:
74
74
  - License.txt
75
75
  - Manifest.txt
76
76
  - README.txt
77
+ - examples/self_test/list-of-features.txt
77
78
  files:
78
79
  - History.txt
79
80
  - License.txt
@@ -224,6 +225,14 @@ files:
224
225
  - examples/i18n/sk/features/division.feature
225
226
  - examples/i18n/sk/features/step_definitons/calculator_steps.rb
226
227
  - examples/i18n/sk/lib/calculator.rb
228
+ - examples/i18n/uz/Rakefile
229
+ - examples/i18n/uz/features/addition.feature
230
+ - examples/i18n/uz/features/consecutive_calculations.feature
231
+ - examples/i18n/uz/features/division.feature
232
+ - examples/i18n/uz/features/step_definitons/calculator_steps.rb
233
+ - examples/i18n/uz/features/support/env.rb
234
+ - examples/i18n/uz/features/support/world.rb
235
+ - examples/i18n/uz/lib/calculator.rb
227
236
  - examples/i18n/zh-CN/Rakefile
228
237
  - examples/i18n/zh-CN/features/addition.feature
229
238
  - examples/i18n/zh-CN/features/step_definitons/calculator_steps.rb
@@ -281,6 +290,7 @@ files:
281
290
  - examples/self_test/features/tags_sample.feature
282
291
  - examples/self_test/features/tons_of_cukes.feature
283
292
  - examples/self_test/features/undefined_multiline_args.feature
293
+ - examples/self_test/list-of-features.txt
284
294
  - examples/sinatra/README.textile
285
295
  - examples/sinatra/Rakefile
286
296
  - examples/sinatra/app.rb
@@ -330,8 +340,6 @@ files:
330
340
  - examples/watir/features/search.feature
331
341
  - examples/watir/features/step_definitons/search_steps.rb
332
342
  - examples/watir/features/support/env.rb
333
- - features/after_block_exceptions.feature
334
- - features/after_step_block_exceptions.feature
335
343
  - features/background.feature
336
344
  - features/bug_371.feature
337
345
  - features/cucumber_cli.feature
@@ -339,6 +347,9 @@ files:
339
347
  - features/cucumber_cli_outlines.feature
340
348
  - features/custom_formatter.feature
341
349
  - features/drb_server_integration.feature
350
+ - features/exception_in_after_block.feature
351
+ - features/exception_in_after_step_block.feature
352
+ - features/exception_in_before_block.feature
342
353
  - features/exclude_files.feature
343
354
  - features/expand.feature
344
355
  - features/html_formatter.feature