aslakhellesoy-cucumber 0.3.0.1 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +10 -2
- data/Manifest.txt +5 -0
- data/examples/self_test/features/background/failing_background.feature +1 -0
- data/examples/self_test/features/step_definitions/sample_steps.rb +3 -2
- data/examples/tickets/features/236.feature +9 -9
- data/examples/tickets/features/301/filter_background_tagged_hooks.feature +6 -0
- data/examples/tickets/features/301/filter_background_tagged_hooks_steps.rb +12 -0
- data/examples/tickets/features/306/only_background.feature +4 -0
- data/features/background.feature +2 -1
- data/features/cucumber_cli.feature +58 -12
- data/features/cucumber_cli_outlines.feature +32 -0
- data/features/custom_formatter.feature +2 -2
- data/features/usage.feature +9 -4
- data/lib/cucumber/ast/background.rb +9 -9
- data/lib/cucumber/ast/feature.rb +5 -0
- data/lib/cucumber/ast/feature_element.rb +6 -4
- data/lib/cucumber/ast/py_string.rb +5 -1
- data/lib/cucumber/ast/scenario.rb +1 -5
- data/lib/cucumber/ast/scenario_outline.rb +0 -5
- data/lib/cucumber/ast/step.rb +2 -1
- data/lib/cucumber/ast/table.rb +4 -0
- data/lib/cucumber/ast/visitor.rb +2 -2
- data/lib/cucumber/cli/configuration.rb +15 -14
- data/lib/cucumber/parser/feature.rb +20 -6
- data/lib/cucumber/parser/feature.tt +21 -7
- data/lib/cucumber/parser/treetop_ext.rb +3 -3
- data/lib/cucumber/rails/world.rb +1 -1
- data/lib/cucumber/version.rb +2 -2
- data/spec/cucumber/ast/feature_element_spec.rb +5 -0
- data/spec/cucumber/ast/py_string_spec.rb +4 -0
- data/spec/cucumber/ast/table_spec.rb +14 -2
- data/spec/cucumber/cli/configuration_spec.rb +4 -4
- metadata +4 -1
data/History.txt
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
== 0.3.
|
1
|
+
== 0.3.1 2009-04-26
|
2
2
|
|
3
|
-
With the addition of Latvian and Hungarian Cucumber
|
3
|
+
This release has several minor bug fixes and new features. With the addition of Latvian and Hungarian Cucumber
|
4
|
+
now supports 32(!!) languages.
|
4
5
|
|
5
6
|
=== New features
|
6
7
|
* Support multiline names for Scenarios, Scenario Outlines, Backgrounds, Examples (#231 Joseph Wilk)
|
@@ -10,11 +11,18 @@ With the addition of Latvian and Hungarian Cucumber now supports 32(!!) language
|
|
10
11
|
* Pick up failure on after hook (#272 Aslak Hellesøy)
|
11
12
|
|
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)
|
13
18
|
* Gem no longer depends on Hoe (Aslak Hellesøy)
|
14
19
|
* Span html tags appear on HTML results with 0.3.0 (#299 Aslak Hellesøy)
|
15
20
|
* Fixed incorrect colours in pretty formatter's table headers for outline tables (Aslak Hellesøy)
|
16
21
|
* Exceptions from steps called within hooks are now reraised. (#294 Ben Mabey)
|
17
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
|
+
|
18
26
|
== 0.3.0 2009-04-14
|
19
27
|
|
20
28
|
This release has some minor changes to the APIs, but big enough that a new major release is in order.
|
data/Manifest.txt
CHANGED
@@ -172,6 +172,7 @@ examples/self_test/features/lots_of_undefined.feature
|
|
172
172
|
examples/self_test/features/multiline_name.feature
|
173
173
|
examples/self_test/features/outline_sample.feature
|
174
174
|
examples/self_test/features/sample.feature
|
175
|
+
examples/self_test/features/search_sample.feature
|
175
176
|
examples/self_test/features/step_definitions/sample_steps.rb
|
176
177
|
examples/self_test/features/support/env.rb
|
177
178
|
examples/self_test/features/support/tag_count_formatter.rb
|
@@ -206,6 +207,9 @@ examples/tickets/features/272/hooks_steps.rb
|
|
206
207
|
examples/tickets/features/279/py_string_indent.feature
|
207
208
|
examples/tickets/features/279/py_string_indent.steps.rb
|
208
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
|
209
213
|
examples/tickets/features/lib/eatting_machine.rb
|
210
214
|
examples/tickets/features/lib/pantry.rb
|
211
215
|
examples/tickets/features/scenario_outline.feature
|
@@ -324,6 +328,7 @@ spec/cucumber/ast/scenario_spec.rb
|
|
324
328
|
spec/cucumber/ast/step_collection_spec.rb
|
325
329
|
spec/cucumber/ast/step_spec.rb
|
326
330
|
spec/cucumber/ast/table_spec.rb
|
331
|
+
spec/cucumber/ast/visitor_spec.rb
|
327
332
|
spec/cucumber/broadcaster_spec.rb
|
328
333
|
spec/cucumber/cli/configuration_spec.rb
|
329
334
|
spec/cucumber/cli/main_spec.rb
|
@@ -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
|
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
|
@@ -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
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
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
|
-
|
12
|
-
|
13
|
-
|
11
|
+
Examples:
|
12
|
+
| role |
|
13
|
+
| HUMAN RESOURCE |
|
data/features/background.feature
CHANGED
@@ -72,6 +72,7 @@ Feature: backgrounds
|
|
72
72
|
When I run cucumber -q features/background/failing_background.feature --require features
|
73
73
|
Then it should fail with
|
74
74
|
"""
|
75
|
+
@after_file
|
75
76
|
Feature: Failing background sample
|
76
77
|
|
77
78
|
Background:
|
@@ -79,7 +80,7 @@ Feature: backgrounds
|
|
79
80
|
FAIL (RuntimeError)
|
80
81
|
./features/step_definitions/sample_steps.rb:2:in `flunker'
|
81
82
|
./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
|
82
|
-
features/background/failing_background.feature:
|
83
|
+
features/background/failing_background.feature:5:in `Given failing without a table'
|
83
84
|
And '10' cukes
|
84
85
|
|
85
86
|
Scenario: failing background
|
@@ -259,6 +259,31 @@ Feature: Cucumber command line
|
|
259
259
|
hello
|
260
260
|
\"\"\"
|
261
261
|
|
262
|
+
Feature: search examples
|
263
|
+
|
264
|
+
Background: Hantu Pisang background match
|
265
|
+
Given passing without a table
|
266
|
+
|
267
|
+
Scenario: should match Hantu Pisang
|
268
|
+
Given passing without a table
|
269
|
+
|
270
|
+
Scenario: Ignore me
|
271
|
+
Given failing without a table
|
272
|
+
|
273
|
+
Scenario Outline: Ignore me
|
274
|
+
Given <state> without a table
|
275
|
+
|
276
|
+
Examples:
|
277
|
+
| state |
|
278
|
+
| failing |
|
279
|
+
|
280
|
+
Scenario Outline: Hantu Pisang match
|
281
|
+
Given <state> without a table
|
282
|
+
|
283
|
+
Examples:
|
284
|
+
| state |
|
285
|
+
| passing |
|
286
|
+
|
262
287
|
Feature: undefined multiline args
|
263
288
|
|
264
289
|
Scenario: pystring
|
@@ -272,8 +297,8 @@ Feature: Cucumber command line
|
|
272
297
|
| table |
|
273
298
|
| example |
|
274
299
|
|
275
|
-
|
276
|
-
|
300
|
+
21 scenarios
|
301
|
+
26 skipped steps
|
277
302
|
9 undefined steps
|
278
303
|
|
279
304
|
"""
|
@@ -304,24 +329,45 @@ Feature: Cucumber command line
|
|
304
329
|
|
305
330
|
"""
|
306
331
|
|
307
|
-
Scenario: Run
|
308
|
-
When I run cucumber --
|
332
|
+
Scenario: Run feature elements which matches a name using --name
|
333
|
+
When I run cucumber --name Pisang -q features/
|
309
334
|
Then it should pass with
|
310
335
|
"""
|
311
|
-
|
312
|
-
Feature: Sample
|
336
|
+
Feature: search examples
|
313
337
|
|
314
|
-
|
315
|
-
|
316
|
-
Given passing
|
317
|
-
| a | b |
|
318
|
-
| c | d |
|
338
|
+
Background: Hantu Pisang background match
|
339
|
+
Given passing without a table
|
319
340
|
|
320
|
-
|
341
|
+
Scenario: should match Hantu Pisang
|
342
|
+
Given passing without a table
|
343
|
+
|
344
|
+
Scenario Outline: Hantu Pisang match
|
345
|
+
Given <state> without a table
|
346
|
+
|
347
|
+
Examples:
|
348
|
+
| state |
|
349
|
+
| passing |
|
350
|
+
|
351
|
+
2 scenarios
|
352
|
+
4 passed steps
|
353
|
+
|
354
|
+
"""
|
355
|
+
|
356
|
+
Scenario: Run a single background which matches a name using --name
|
357
|
+
When I run cucumber --name 'Hantu Pisang background' -q features/
|
358
|
+
Then it should pass with
|
359
|
+
"""
|
360
|
+
Feature: search examples
|
361
|
+
|
362
|
+
Background: Hantu Pisang background match
|
363
|
+
Given passing without a table
|
364
|
+
|
365
|
+
0 scenarios
|
321
366
|
1 passed step
|
322
367
|
|
323
368
|
"""
|
324
369
|
|
370
|
+
|
325
371
|
Scenario: Run with a tag that exists on 2 scenarios
|
326
372
|
When I run cucumber -q features --tags three
|
327
373
|
Then it should pass with
|
@@ -2,6 +2,38 @@ Feature: Cucumber command line
|
|
2
2
|
In order to write better software
|
3
3
|
Developers should be able to execute requirements as tests
|
4
4
|
|
5
|
+
Scenario: Run scenario outline with filtering on outline name
|
6
|
+
When I run cucumber -q features --name "Test state"
|
7
|
+
Then it should fail with
|
8
|
+
"""
|
9
|
+
Feature: Outline Sample
|
10
|
+
|
11
|
+
Scenario Outline: Test state
|
12
|
+
Given <state> without a table
|
13
|
+
Given <other_state> without a table
|
14
|
+
|
15
|
+
Examples: Rainbow colours
|
16
|
+
| state | other_state |
|
17
|
+
| missing | passing |
|
18
|
+
| passing | passing |
|
19
|
+
| failing | passing |
|
20
|
+
FAIL (RuntimeError)
|
21
|
+
./features/step_definitions/sample_steps.rb:2:in `flunker'
|
22
|
+
./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
|
23
|
+
features/outline_sample.feature:6:in `Given <state> without a table'
|
24
|
+
|
25
|
+
Examples: Only passing
|
26
|
+
| state | other_state |
|
27
|
+
| passing | passing |
|
28
|
+
|
29
|
+
4 scenarios
|
30
|
+
1 failed step
|
31
|
+
2 skipped steps
|
32
|
+
1 undefined step
|
33
|
+
4 passed steps
|
34
|
+
|
35
|
+
"""
|
36
|
+
|
5
37
|
Scenario: Run scenario outline steps only
|
6
38
|
When I run cucumber -q features/outline_sample.feature:7
|
7
39
|
Then it should fail with
|
@@ -4,8 +4,8 @@ Feature: Custom Formatter
|
|
4
4
|
When I run cucumber --format Tag::Count features
|
5
5
|
Then it should fail with
|
6
6
|
"""
|
7
|
-
| four | lots | one | three | two |
|
8
|
-
| 1 | 1 | 1 | 2 | 1 |
|
7
|
+
| after_file | four | lots | one | three | two |
|
8
|
+
| 1 | 1 | 1 | 1 | 2 | 1 |
|
9
9
|
|
10
10
|
"""
|
11
11
|
|
data/features/usage.feature
CHANGED
@@ -15,16 +15,21 @@ Feature: Cucumber command line
|
|
15
15
|
Given <state> without a table # features/multiline_name.feature:22
|
16
16
|
Given <state> without a table # features/outline_sample.feature:6
|
17
17
|
Given <other_state> without a table # features/outline_sample.feature:7
|
18
|
+
Given passing without a table # features/search_sample.feature:4
|
19
|
+
Given passing without a table # features/search_sample.feature:7
|
20
|
+
Given <state> without a table # features/search_sample.feature:19
|
18
21
|
/^failing without a table$/ # features/step_definitions/sample_steps.rb:15
|
19
|
-
Given failing without a table # features/background/failing_background.feature:
|
22
|
+
Given failing without a table # features/background/failing_background.feature:5
|
20
23
|
Given failing without a table # features/background/scenario_outline_failing_background.feature:4
|
24
|
+
Given failing without a table # features/search_sample.feature:10
|
25
|
+
Given <state> without a table # features/search_sample.feature:13
|
21
26
|
/^a step definition that calls an undefined step$/ # features/step_definitions/sample_steps.rb:19
|
22
27
|
Given a step definition that calls an undefined step # features/call_undefined_step_from_step_def.feature:4
|
23
28
|
/^call step "(.*)"$/ # features/step_definitions/sample_steps.rb:23
|
24
29
|
Given call step "a step definition that calls an undefined step" # features/call_undefined_step_from_step_def.feature:7
|
25
30
|
/^'(.+)' cukes$/ # features/step_definitions/sample_steps.rb:27
|
26
31
|
Given '10' cukes # features/background/background_with_name.feature:4
|
27
|
-
And '10' cukes # features/background/failing_background.feature:
|
32
|
+
And '10' cukes # features/background/failing_background.feature:6
|
28
33
|
Given '10' cukes # features/background/passing_background.feature:4
|
29
34
|
Given '10' cukes # features/background/scenario_outline_passing_background.feature:4
|
30
35
|
Given '2' cukes # features/tons_of_cukes.feature:4
|
@@ -78,8 +83,8 @@ Feature: Cucumber command line
|
|
78
83
|
Given '2' cukes # features/tons_of_cukes.feature:52
|
79
84
|
/^I should have '(.+)' cukes$/ # features/step_definitions/sample_steps.rb:31
|
80
85
|
Then I should have '10' cukes # features/background/background_with_name.feature:7
|
81
|
-
Then I should have '10' cukes # features/background/failing_background.feature:
|
82
|
-
Then I should have '10' cukes # features/background/failing_background.feature:
|
86
|
+
Then I should have '10' cukes # features/background/failing_background.feature:9
|
87
|
+
Then I should have '10' cukes # features/background/failing_background.feature:12
|
83
88
|
Then I should have '10' cukes # features/background/passing_background.feature:7
|
84
89
|
Then I should have '10' cukes # features/background/passing_background.feature:10
|
85
90
|
Then I should have '10' cukes # features/background/pending_background.feature:7
|
@@ -4,12 +4,13 @@ module Cucumber
|
|
4
4
|
module Ast
|
5
5
|
class Background
|
6
6
|
include FeatureElement
|
7
|
-
|
7
|
+
attr_reader :feature_elements
|
8
8
|
|
9
9
|
def initialize(comment, line, keyword, name, steps)
|
10
10
|
@comment, @line, @keyword, @name, @steps = comment, line, keyword, name, StepCollection.new(steps)
|
11
11
|
attach_steps(steps)
|
12
12
|
@step_invocations = @steps.step_invocations(true)
|
13
|
+
@feature_elements = []
|
13
14
|
end
|
14
15
|
|
15
16
|
def step_collection(step_invocations)
|
@@ -24,25 +25,24 @@ module Cucumber
|
|
24
25
|
def accept(visitor)
|
25
26
|
visitor.visit_comment(@comment)
|
26
27
|
visitor.visit_background_name(@keyword, @name, file_colon_line(@line), source_indent(first_line_length))
|
27
|
-
visitor.step_mother.before(
|
28
|
+
visitor.step_mother.before(hook_context)
|
28
29
|
visitor.visit_steps(@step_invocations)
|
29
30
|
@failed = @step_invocations.detect{|step_invocation| step_invocation.exception}
|
30
|
-
visitor.step_mother.after(
|
31
|
+
visitor.step_mother.after(hook_context) if @failed
|
31
32
|
end
|
32
33
|
|
33
34
|
def accept_hook?(hook)
|
34
|
-
|
35
|
-
# the current implementation. All hooks will be executed. This is because of the line
|
36
|
-
# visitor.step_mother.before(self)
|
37
|
-
# in the #accept method above. Instead, we should really be passing the first scenario
|
38
|
-
# here. We currently don't have access to that, so a refactoring is in order to make that happen.
|
39
|
-
true
|
35
|
+
false
|
40
36
|
end
|
41
37
|
|
42
38
|
def failed?
|
43
39
|
@failed
|
44
40
|
end
|
45
41
|
|
42
|
+
def hook_context
|
43
|
+
@feature_elements.first || self
|
44
|
+
end
|
45
|
+
|
46
46
|
def to_sexp
|
47
47
|
sexp = [:background, @line, @keyword]
|
48
48
|
sexp += [@name] unless @name.empty?
|
data/lib/cucumber/ast/feature.rb
CHANGED
@@ -8,6 +8,7 @@ module Cucumber
|
|
8
8
|
def initialize(background, comment, tags, name, feature_elements)
|
9
9
|
@background, @comment, @tags, @name, @feature_elements = background, comment, tags, name, feature_elements
|
10
10
|
|
11
|
+
background.feature = self if background
|
11
12
|
@feature_elements.each do |feature_element|
|
12
13
|
feature_element.feature = self
|
13
14
|
end
|
@@ -23,6 +24,10 @@ module Cucumber
|
|
23
24
|
end
|
24
25
|
end
|
25
26
|
|
27
|
+
def accept_hook?(hook)
|
28
|
+
@tags.accept_hook?(hook)
|
29
|
+
end
|
30
|
+
|
26
31
|
def next_feature_element(feature_element, &proc)
|
27
32
|
index = @feature_elements.index(feature_element)
|
28
33
|
next_one = @feature_elements[index+1]
|
@@ -2,6 +2,8 @@ require 'enumerator'
|
|
2
2
|
|
3
3
|
module Cucumber
|
4
4
|
module FeatureElement
|
5
|
+
attr_writer :feature
|
6
|
+
|
5
7
|
def attach_steps(steps)
|
6
8
|
steps.each {|step| step.feature_element = self}
|
7
9
|
end
|
@@ -28,9 +30,9 @@ module Cucumber
|
|
28
30
|
end
|
29
31
|
end
|
30
32
|
|
31
|
-
def matches_scenario_names?(
|
32
|
-
|
33
|
-
end
|
33
|
+
def matches_scenario_names?(scenario_name_regexps)
|
34
|
+
scenario_name_regexps.detect{|name| name =~ @name}
|
35
|
+
end
|
34
36
|
|
35
37
|
def backtrace_line(name = "#{@keyword} #{@name}", line = @line)
|
36
38
|
@feature.backtrace_line(name, line) if @feature
|
@@ -45,7 +47,7 @@ module Cucumber
|
|
45
47
|
end
|
46
48
|
|
47
49
|
def accept_hook?(hook)
|
48
|
-
@tags.accept_hook?(hook)
|
50
|
+
@tags.accept_hook?(hook) || @feature.accept_hook?(hook)
|
49
51
|
end
|
50
52
|
end
|
51
53
|
end
|
@@ -12,16 +12,12 @@ module Cucumber
|
|
12
12
|
step_invocations = steps.map{|step| step.step_invocation}
|
13
13
|
if @background
|
14
14
|
@steps = @background.step_collection(step_invocations)
|
15
|
+
@background.feature_elements << self
|
15
16
|
else
|
16
17
|
@steps = StepCollection.new(step_invocations)
|
17
18
|
end
|
18
19
|
end
|
19
20
|
|
20
|
-
def feature=(feature)
|
21
|
-
@feature = feature
|
22
|
-
@background.feature = feature if @background
|
23
|
-
end
|
24
|
-
|
25
21
|
def accept(visitor)
|
26
22
|
visitor.visit_comment(@comment)
|
27
23
|
visitor.visit_tags(@tags)
|
data/lib/cucumber/ast/step.rb
CHANGED
@@ -82,7 +82,8 @@ module Cucumber
|
|
82
82
|
|
83
83
|
def matched_cells(cells)
|
84
84
|
cells.select do |cell|
|
85
|
-
|
85
|
+
delimited = delimited(cell.header_cell.value)
|
86
|
+
@name.index(delimited) || (@multiline_arg && @multiline_arg.has_text?(delimited))
|
86
87
|
end
|
87
88
|
end
|
88
89
|
|
data/lib/cucumber/ast/table.rb
CHANGED
@@ -191,6 +191,10 @@ module Cucumber
|
|
191
191
|
Table.new(raw_with_replaced_args)
|
192
192
|
end
|
193
193
|
|
194
|
+
def has_text?(text)
|
195
|
+
raw.flatten.detect{|cell_value| cell_value.index(text)}
|
196
|
+
end
|
197
|
+
|
194
198
|
def cells_rows
|
195
199
|
@rows ||= cell_matrix.map do |cell_row|
|
196
200
|
@cells_class.new(self, cell_row)
|
data/lib/cucumber/ast/visitor.rb
CHANGED
@@ -11,8 +11,8 @@ module Cucumber
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def matches_scenario_names?(node)
|
14
|
-
|
15
|
-
|
14
|
+
scenario_name_regexps = options[:name_regexps] || []
|
15
|
+
scenario_name_regexps.empty? || node.matches_scenario_names?(scenario_name_regexps)
|
16
16
|
end
|
17
17
|
|
18
18
|
def visit_features(features)
|
@@ -78,10 +78,11 @@ module Cucumber
|
|
78
78
|
"with or without the @ prefix.") do |v|
|
79
79
|
@options[:include_tags], @options[:exclude_tags] = *parse_tags(v)
|
80
80
|
end
|
81
|
-
opts.on("-
|
82
|
-
"Only execute the
|
83
|
-
"is given more than once,
|
84
|
-
|
81
|
+
opts.on("-n NAME", "--name NAME",
|
82
|
+
"Only execute the feature elements which match part of the given name.",
|
83
|
+
"If this option is given more than once, it will match against all the",
|
84
|
+
"given names.") do |v|
|
85
|
+
@options[:name_regexps] << /#{v}/
|
85
86
|
end
|
86
87
|
opts.on("-e", "--exclude PATTERN", "Don't run feature files matching PATTERN") do |v|
|
87
88
|
@options[:excludes] << v
|
@@ -334,16 +335,16 @@ Defined profiles in cucumber.yml:
|
|
334
335
|
|
335
336
|
def default_options
|
336
337
|
{
|
337
|
-
:strict
|
338
|
-
:require
|
339
|
-
:lang
|
340
|
-
:dry_run
|
341
|
-
:formats
|
342
|
-
:excludes
|
343
|
-
:include_tags
|
344
|
-
:exclude_tags
|
345
|
-
:
|
346
|
-
:diff_enabled
|
338
|
+
:strict => false,
|
339
|
+
:require => nil,
|
340
|
+
:lang => 'en',
|
341
|
+
:dry_run => false,
|
342
|
+
:formats => {},
|
343
|
+
:excludes => [],
|
344
|
+
:include_tags => [],
|
345
|
+
:exclude_tags => [],
|
346
|
+
:name_regexps => [],
|
347
|
+
:diff_enabled => true
|
347
348
|
}
|
348
349
|
end
|
349
350
|
|
@@ -61,8 +61,8 @@ module Cucumber
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def build(filter)
|
64
|
-
if(filter.nil? || feature_elements.accept?(filter))
|
65
|
-
background = bg.respond_to?(:build) ? bg.build : nil
|
64
|
+
if(filter.nil? || feature_elements.accept?(filter) || (!bg.empty? && filter.accept?(bg)))
|
65
|
+
background = bg.respond_to?(:build) ? bg.build : nil
|
66
66
|
Ast::Feature.new(
|
67
67
|
background,
|
68
68
|
comment.build,
|
@@ -481,6 +481,16 @@ module Cucumber
|
|
481
481
|
end
|
482
482
|
|
483
483
|
module Background1
|
484
|
+
|
485
|
+
def matches_name?(regexp_to_match)
|
486
|
+
name.build =~ regexp_to_match
|
487
|
+
end
|
488
|
+
|
489
|
+
def has_tags?(tag_names)
|
490
|
+
feature_tags = self.parent.tags
|
491
|
+
feature_tags.has_tags?(tag_names)
|
492
|
+
end
|
493
|
+
|
484
494
|
def build
|
485
495
|
Ast::Background.new(
|
486
496
|
comment.build,
|
@@ -678,8 +688,8 @@ module Cucumber
|
|
678
688
|
tags.has_tags?(tag_names) || feature_tags.has_tags?(tag_names)
|
679
689
|
end
|
680
690
|
|
681
|
-
def matches_name?(
|
682
|
-
name.build
|
691
|
+
def matches_name?(regexp_to_match)
|
692
|
+
name.build =~ regexp_to_match
|
683
693
|
end
|
684
694
|
|
685
695
|
def build(background, filter)
|
@@ -816,8 +826,8 @@ module Cucumber
|
|
816
826
|
tags.has_tags?(tag_names) || feature_tags.has_tags?(tag_names)
|
817
827
|
end
|
818
828
|
|
819
|
-
def matches_name?(
|
820
|
-
name.build
|
829
|
+
def matches_name?(regexp_to_match)
|
830
|
+
name.build =~ regexp_to_match
|
821
831
|
end
|
822
832
|
|
823
833
|
def build(background, filter)
|
@@ -1148,6 +1158,10 @@ module Cucumber
|
|
1148
1158
|
true
|
1149
1159
|
end
|
1150
1160
|
|
1161
|
+
def matches_name?(regexp_to_match)
|
1162
|
+
name.build =~ regexp_to_match
|
1163
|
+
end
|
1164
|
+
|
1151
1165
|
def build(filter, scenario_outline)
|
1152
1166
|
[examples_keyword.line, examples_keyword.text_value, name.build, table.raw(filter, scenario_outline)]
|
1153
1167
|
end
|
@@ -25,8 +25,8 @@ module Cucumber
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def build(filter)
|
28
|
-
if(filter.nil? || feature_elements.accept?(filter))
|
29
|
-
background = bg.respond_to?(:build) ? bg.build : nil
|
28
|
+
if(filter.nil? || feature_elements.accept?(filter) || (!bg.empty? && filter.accept?(bg)))
|
29
|
+
background = bg.respond_to?(:build) ? bg.build : nil
|
30
30
|
Ast::Feature.new(
|
31
31
|
background,
|
32
32
|
comment.build,
|
@@ -77,6 +77,16 @@ module Cucumber
|
|
77
77
|
|
78
78
|
rule background
|
79
79
|
comment white background_keyword space* name:lines_to_keyword? (eol+ / eof) steps {
|
80
|
+
|
81
|
+
def matches_name?(regexp_to_match)
|
82
|
+
name.build =~ regexp_to_match
|
83
|
+
end
|
84
|
+
|
85
|
+
def has_tags?(tag_names)
|
86
|
+
feature_tags = self.parent.tags
|
87
|
+
feature_tags.has_tags?(tag_names)
|
88
|
+
end
|
89
|
+
|
80
90
|
def build
|
81
91
|
Ast::Background.new(
|
82
92
|
comment.build,
|
@@ -118,8 +128,8 @@ module Cucumber
|
|
118
128
|
tags.has_tags?(tag_names) || feature_tags.has_tags?(tag_names)
|
119
129
|
end
|
120
130
|
|
121
|
-
def matches_name?(
|
122
|
-
name.build
|
131
|
+
def matches_name?(regexp_to_match)
|
132
|
+
name.build =~ regexp_to_match
|
123
133
|
end
|
124
134
|
|
125
135
|
def build(background, filter)
|
@@ -154,8 +164,8 @@ module Cucumber
|
|
154
164
|
tags.has_tags?(tag_names) || feature_tags.has_tags?(tag_names)
|
155
165
|
end
|
156
166
|
|
157
|
-
def matches_name?(
|
158
|
-
name.build
|
167
|
+
def matches_name?(regexp_to_match)
|
168
|
+
name.build =~ regexp_to_match
|
159
169
|
end
|
160
170
|
|
161
171
|
def build(background, filter)
|
@@ -233,6 +243,10 @@ module Cucumber
|
|
233
243
|
true
|
234
244
|
end
|
235
245
|
|
246
|
+
def matches_name?(regexp_to_match)
|
247
|
+
name.build =~ regexp_to_match
|
248
|
+
end
|
249
|
+
|
236
250
|
def build(filter, scenario_outline)
|
237
251
|
[examples_keyword.line, examples_keyword.text_value, name.build, table.raw(filter, scenario_outline)]
|
238
252
|
end
|
@@ -252,7 +266,7 @@ module Cucumber
|
|
252
266
|
def build
|
253
267
|
text.text_value.strip
|
254
268
|
end
|
255
|
-
|
269
|
+
}
|
256
270
|
end
|
257
271
|
|
258
272
|
rule lines_to_keyword
|
@@ -17,7 +17,7 @@ module Cucumber
|
|
17
17
|
@lines = lines
|
18
18
|
@include_tags = options[:include_tags] || []
|
19
19
|
@exclude_tags = options[:exclude_tags] || []
|
20
|
-
@
|
20
|
+
@name_regexps = options[:name_regexps] || []
|
21
21
|
end
|
22
22
|
|
23
23
|
def accept?(syntax_node)
|
@@ -48,7 +48,7 @@ module Cucumber
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def matches_names?(syntax_node)
|
51
|
-
@
|
51
|
+
@name_regexps.nil? || @name_regexps.empty? || @name_regexps.detect{|name_regexp| syntax_node.matches_name?(name_regexp)}
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -111,4 +111,4 @@ module Treetop
|
|
111
111
|
include Cucumber::Parser::TreetopExt
|
112
112
|
end
|
113
113
|
end
|
114
|
-
end
|
114
|
+
end
|
data/lib/cucumber/rails/world.rb
CHANGED
@@ -33,7 +33,7 @@ module Cucumber #:nodoc:
|
|
33
33
|
def self.use_transactional_fixtures
|
34
34
|
|
35
35
|
unless ::Rails.configuration.cache_classes
|
36
|
-
warn "WARNING: You have set
|
36
|
+
warn "WARNING: You have set Rails' config.cache_classes to false (most likely in config/environments/test.rb). This setting is known to break Cucumber's use_transactional_fixtures method. Set config.cache_classes to true if you want to use transactional fixtures. For more information see https://rspec.lighthouseapp.com/projects/16211/tickets/165."
|
37
37
|
end
|
38
38
|
|
39
39
|
World.use_transactional_fixtures = true
|
data/lib/cucumber/version.rb
CHANGED
@@ -109,10 +109,10 @@ module Cucumber
|
|
109
109
|
describe "replacing arguments" do
|
110
110
|
|
111
111
|
before(:each) do
|
112
|
-
@table =
|
112
|
+
@table = Table.new([
|
113
113
|
%w{qty book},
|
114
114
|
%w{<qty> <book>}
|
115
|
-
|
115
|
+
])
|
116
116
|
end
|
117
117
|
|
118
118
|
it "should return a new table with arguments replaced with values" do
|
@@ -122,6 +122,18 @@ module Cucumber
|
|
122
122
|
table_with_replaced_args.hashes[0]['qty'].should == '5'
|
123
123
|
end
|
124
124
|
|
125
|
+
it "should recognise when entire cell is delimited" do
|
126
|
+
@table.should have_text('<book>')
|
127
|
+
end
|
128
|
+
|
129
|
+
it "should recognise when just a subset of a cell is delimited" do
|
130
|
+
table = Table.new([
|
131
|
+
%w{qty book},
|
132
|
+
['<qty>', "This is <who>'s book"]
|
133
|
+
])
|
134
|
+
table.should have_text('<who>')
|
135
|
+
end
|
136
|
+
|
125
137
|
it "should replace nil values with nil" do
|
126
138
|
table_with_replaced_args = @table.arguments_replaced({'<book>' => nil})
|
127
139
|
|
@@ -255,12 +255,12 @@ END_OF_MESSAGE
|
|
255
255
|
|
256
256
|
end
|
257
257
|
|
258
|
-
it "should accept multiple --
|
258
|
+
it "should accept multiple --name options" do
|
259
259
|
config = Configuration.new
|
260
|
-
config.parse!(['--
|
260
|
+
config.parse!(['--name', "User logs in", '--name', "User signs up"])
|
261
261
|
|
262
|
-
config.options[:
|
263
|
-
config.options[:
|
262
|
+
config.options[:name_regexps].should include(/User logs in/)
|
263
|
+
config.options[:name_regexps].should include(/User signs up/)
|
264
264
|
end
|
265
265
|
|
266
266
|
it "should search for all features in the specified directory" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aslakhellesoy-cucumber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Aslak Helles\xC3\xB8y"
|
@@ -283,6 +283,9 @@ files:
|
|
283
283
|
- examples/tickets/features/279/py_string_indent.feature
|
284
284
|
- examples/tickets/features/279/py_string_indent.steps.rb
|
285
285
|
- examples/tickets/features/279/wrong.feature_
|
286
|
+
- examples/tickets/features/301/filter_background_tagged_hooks.feature
|
287
|
+
- examples/tickets/features/301/filter_background_tagged_hooks_steps.rb
|
288
|
+
- examples/tickets/features/306/only_background.feature
|
286
289
|
- examples/tickets/features/lib/eatting_machine.rb
|
287
290
|
- examples/tickets/features/lib/pantry.rb
|
288
291
|
- examples/tickets/features/scenario_outline.feature
|