cucumber 0.2.3 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +56 -1
- data/Manifest.txt +70 -49
- data/config/hoe.rb +1 -1
- data/cucumber.yml +1 -1
- data/examples/i18n/bg/Rakefile +6 -0
- data/examples/i18n/bg/features/addition.feature +11 -0
- data/examples/i18n/bg/features/consecutive_calculations.feature +18 -0
- data/examples/i18n/bg/features/division.feature +16 -0
- data/examples/i18n/bg/features/step_definitons/calculator_steps.rb +24 -0
- data/examples/i18n/bg/features/support/env.rb +6 -0
- data/examples/i18n/bg/features/support/world.rb +8 -0
- data/examples/i18n/bg/lib/calculator.rb +24 -0
- data/examples/i18n/ru/features/support/world.rb +4 -3
- data/examples/i18n/sk/Rakefile +6 -0
- data/examples/i18n/sk/features/addition.feature +16 -0
- data/examples/i18n/sk/features/division.feature +9 -0
- data/examples/i18n/sk/features/step_definitons/calculator_steps.rb +24 -0
- data/examples/i18n/sk/lib/calculator.rb +14 -0
- data/examples/self_test/features/background/background_with_name.feature +7 -0
- data/examples/self_test/features/background/passing_background.feature +2 -2
- data/examples/self_test/features/step_definitions/sample_steps.rb +18 -2
- data/examples/self_test/features/undefined_multiline_args.feature +12 -0
- data/examples/sinatra/features/support/env.rb +2 -6
- data/examples/test_unit/features/step_definitions/test_unit_steps.rb +1 -4
- data/examples/tickets/Rakefile +1 -1
- data/examples/tickets/features/229/tagged_hooks.feature +8 -0
- data/examples/tickets/features/229/tagged_hooks.rb +14 -0
- data/examples/tickets/features/270/back.feature +14 -0
- data/examples/tickets/features/270/back.steps.rb +14 -0
- data/examples/tickets/features/279/py_string_indent.feature +25 -0
- data/examples/tickets/features/279/py_string_indent.steps.rb +12 -0
- data/examples/tickets/features/279/wrong.feature_ +11 -0
- data/examples/tickets/features/step_definitons/tickets_steps.rb +0 -7
- data/features/background.feature +21 -3
- data/features/cucumber_cli.feature +18 -5
- data/features/cucumber_cli_outlines.feature +4 -1
- data/features/rake_task.feature +132 -0
- data/features/snippet.feature +23 -0
- data/features/step_definitions/cucumber_steps.rb +46 -15
- data/features/support/env.rb +61 -4
- data/features/usage.feature +5 -0
- data/gem_tasks/deployment.rake +1 -1
- data/lib/cucumber/ast/background.rb +14 -4
- data/lib/cucumber/ast/examples.rb +0 -12
- data/lib/cucumber/ast/feature.rb +2 -12
- data/lib/cucumber/ast/feature_element.rb +4 -8
- data/lib/cucumber/ast/features.rb +1 -1
- data/lib/cucumber/ast/outline_table.rb +20 -20
- data/lib/cucumber/ast/py_string.rb +6 -11
- data/lib/cucumber/ast/scenario.rb +1 -8
- data/lib/cucumber/ast/scenario_outline.rb +1 -11
- data/lib/cucumber/ast/step.rb +3 -9
- data/lib/cucumber/ast/step_collection.rb +0 -4
- data/lib/cucumber/ast/step_invocation.rb +5 -6
- data/lib/cucumber/ast/table.rb +5 -22
- data/lib/cucumber/ast/tags.rb +9 -9
- data/lib/cucumber/ast/visitor.rb +12 -25
- data/lib/cucumber/cli/configuration.rb +4 -4
- data/lib/cucumber/cli/main.rb +10 -3
- data/lib/cucumber/core_ext/instance_exec.rb +17 -4
- data/lib/cucumber/formatter/ansicolor.rb +1 -1
- data/lib/cucumber/formatter/console.rb +2 -1
- data/lib/cucumber/formatter/html.rb +21 -7
- data/lib/cucumber/formatter/pretty.rb +27 -20
- data/lib/cucumber/formatter/usage.rb +16 -0
- data/lib/cucumber/languages.yml +23 -5
- data/lib/cucumber/parser/feature.rb +231 -114
- data/lib/cucumber/parser/feature.tt +120 -25
- data/lib/cucumber/parser/table.rb +37 -25
- data/lib/cucumber/parser/table.tt +15 -3
- data/lib/cucumber/parser/treetop_ext.rb +48 -9
- data/lib/cucumber/rake/task.rb +29 -6
- data/lib/cucumber/step_definition.rb +4 -2
- data/lib/cucumber/step_mother.rb +143 -26
- data/lib/cucumber/version.rb +2 -2
- data/rails_generators/cucumber/templates/paths.rb +13 -4
- data/rails_generators/cucumber/templates/webrat_steps.rb +16 -0
- data/{specs → spec}/cucumber/ast/background_spec.rb +1 -0
- data/{specs → spec}/cucumber/ast/feature_factory.rb +1 -1
- data/{specs → spec}/cucumber/ast/feature_spec.rb +2 -2
- data/{specs → spec}/cucumber/ast/py_string_spec.rb +0 -0
- data/{specs → spec}/cucumber/ast/scenario_outline_spec.rb +0 -0
- data/{specs → spec}/cucumber/ast/scenario_spec.rb +0 -27
- data/{specs → spec}/cucumber/ast/step_collection_spec.rb +0 -0
- data/{specs → spec}/cucumber/ast/step_spec.rb +0 -0
- data/{specs → spec}/cucumber/ast/table_spec.rb +2 -2
- data/{specs → spec}/cucumber/broadcaster_spec.rb +0 -0
- data/{specs → spec}/cucumber/cli/configuration_spec.rb +0 -0
- data/{specs → spec}/cucumber/cli/main_spec.rb +5 -1
- data/spec/cucumber/core_ext/proc_spec.rb +54 -0
- data/{specs → spec}/cucumber/core_ext/string_spec.rb +0 -0
- data/{specs → spec}/cucumber/formatter/ansicolor_spec.rb +0 -0
- data/{specs → spec}/cucumber/formatter/color_io_spec.rb +0 -0
- data/{specs → spec}/cucumber/formatter/html/cucumber.css +0 -0
- data/{specs → spec}/cucumber/formatter/html/cucumber.js +0 -0
- data/{specs → spec}/cucumber/formatter/html/index.html +0 -0
- data/{specs → spec}/cucumber/formatter/html/jquery-1.3.min.js +0 -0
- data/{specs → spec}/cucumber/formatter/html/jquery.uitableedit.js +0 -0
- data/{specs → spec}/cucumber/formatters/profile_formatter_spec.rb +0 -0
- data/{specs → spec}/cucumber/parser/feature_parser_spec.rb +43 -41
- data/{specs → spec}/cucumber/parser/table_parser_spec.rb +0 -0
- data/{specs → spec}/cucumber/rails/stubs/mini_rails.rb +0 -0
- data/{specs → spec}/cucumber/rails/stubs/test_help.rb +0 -0
- data/{specs → spec}/cucumber/rails/world_spec.rb +0 -0
- data/{specs → spec}/cucumber/sell_cucumbers.feature +0 -0
- data/{specs → spec}/cucumber/step_definition_spec.rb +0 -0
- data/{specs → spec}/cucumber/step_mother_spec.rb +63 -4
- data/{specs → spec}/cucumber/treetop_parser/empty_feature.feature +0 -0
- data/{specs → spec}/cucumber/treetop_parser/empty_scenario.feature +0 -0
- data/{specs → spec}/cucumber/treetop_parser/empty_scenario_outline.feature +0 -0
- data/{specs → spec}/cucumber/treetop_parser/fit_scenario.feature +0 -0
- data/{specs → spec}/cucumber/treetop_parser/given_scenario.feature +0 -0
- data/{specs → spec}/cucumber/treetop_parser/invalid_scenario_outlines.feature +0 -0
- data/{specs → spec}/cucumber/treetop_parser/multiline_steps.feature +0 -0
- data/{specs → spec}/cucumber/treetop_parser/multiple_tables.feature +0 -0
- data/{specs → spec}/cucumber/treetop_parser/scenario_outline.feature +0 -0
- data/{specs → spec}/cucumber/treetop_parser/spaces.feature +0 -0
- data/{specs → spec}/cucumber/treetop_parser/test_dos.feature +0 -0
- data/{specs → spec}/cucumber/treetop_parser/with_comments.feature +0 -0
- data/{specs → spec}/cucumber/treetop_parser/with_tags.feature +0 -0
- data/{specs → spec}/cucumber/world/pending_spec.rb +0 -0
- data/{specs → spec}/spec.opts +0 -0
- data/{specs → spec}/spec_helper.rb +2 -11
- metadata +72 -51
- data/examples/tickets/cucumber.yml +0 -3
- data/lib/cucumber/parser/basic.rb +0 -0
- data/specs/cucumber/ast/tags_spec.rb +0 -19
- data/specs/cucumber/core_ext/proc_spec.rb +0 -37
@@ -25,9 +25,9 @@ Given /^call step "(.*)"$/ do |step|
|
|
25
25
|
end
|
26
26
|
|
27
27
|
Given /^'(.+)' cukes$/ do |cukes|
|
28
|
+
raise "We already have #{@cukes} cukes!" if @cukes
|
28
29
|
@cukes = cukes
|
29
30
|
end
|
30
|
-
|
31
31
|
Then /^I should have '(.+)' cukes$/ do |cukes|
|
32
32
|
@cukes.should == cukes
|
33
33
|
end
|
@@ -52,7 +52,7 @@ Given /^multiline string$/ do |string|
|
|
52
52
|
end
|
53
53
|
|
54
54
|
Then /^the table should be$/ do |table|
|
55
|
-
@table.
|
55
|
+
@table.raw.should == table.raw
|
56
56
|
end
|
57
57
|
|
58
58
|
Then /^the multiline string should be$/ do |string|
|
@@ -62,3 +62,19 @@ end
|
|
62
62
|
Given /^failing expectation$/ do
|
63
63
|
'this'.should == 'that'
|
64
64
|
end
|
65
|
+
|
66
|
+
Given /^unused$/ do
|
67
|
+
end
|
68
|
+
|
69
|
+
Given /^another unused$/ do
|
70
|
+
end
|
71
|
+
|
72
|
+
after_file = File.dirname(__FILE__) + '/../../tmp/after.txt'
|
73
|
+
|
74
|
+
Before('@after_file') do
|
75
|
+
FileUtils.rm(after_file) if File.exist?(after_file)
|
76
|
+
end
|
77
|
+
|
78
|
+
After('@after_file') do
|
79
|
+
FileUtils.touch(after_file)
|
80
|
+
end
|
@@ -16,9 +16,5 @@ Webrat.configure do |config|
|
|
16
16
|
config.mode = :sinatra
|
17
17
|
end
|
18
18
|
|
19
|
-
World
|
20
|
-
|
21
|
-
session.extend(Webrat::Matchers)
|
22
|
-
session.extend(Webrat::HaveTagMatcher)
|
23
|
-
session
|
24
|
-
end
|
19
|
+
World{Webrat::SinatraSession.new}
|
20
|
+
World(Webrat::Matchers, Webrat::HaveTagMatcher)
|
data/examples/tickets/Rakefile
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'spec/expectations'
|
2
|
+
|
3
|
+
Before('@i_am_so_special') do
|
4
|
+
@something_special = 10
|
5
|
+
end
|
6
|
+
|
7
|
+
After('@i_am_so_special') do
|
8
|
+
@something_special.should == 20
|
9
|
+
end
|
10
|
+
|
11
|
+
When /special me goes to town/ do
|
12
|
+
@something_special.should == 10
|
13
|
+
@something_special = 20
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Feature: Background
|
2
|
+
In for background to work properly
|
3
|
+
As a user
|
4
|
+
I want it to run transactionally and only once when I call an individual scenario
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given plop
|
8
|
+
|
9
|
+
Scenario: Barping
|
10
|
+
When I barp
|
11
|
+
|
12
|
+
|
13
|
+
Scenario: Wibbling
|
14
|
+
When I wibble
|
@@ -0,0 +1,25 @@
|
|
1
|
+
Feature: pystring indentaion testcase
|
2
|
+
|
3
|
+
Scenario: example of correct indentation
|
4
|
+
Given multiline string
|
5
|
+
"""
|
6
|
+
I'm a cucumber and I'm ok
|
7
|
+
I sleep all night and test all day
|
8
|
+
"""
|
9
|
+
Then string is
|
10
|
+
"""
|
11
|
+
I'm a cucumber and I'm ok
|
12
|
+
I sleep all night and test all day
|
13
|
+
"""
|
14
|
+
|
15
|
+
Scenario: example of wrong indentation
|
16
|
+
Given I am in tickets/features/279
|
17
|
+
When I run cucumber -q wrong.feature_
|
18
|
+
Then it should fail with
|
19
|
+
"""
|
20
|
+
|
21
|
+
"""
|
22
|
+
And STDERR should match
|
23
|
+
"""
|
24
|
+
wrong.feature_:8:10: Parse error
|
25
|
+
"""
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec/expectations'
|
2
|
+
|
3
|
+
require File.dirname(__FILE__) + '/../../../../features/step_definitions/cucumber_steps.rb'
|
4
|
+
require File.dirname(__FILE__) + '/../../../../features/support/env.rb'
|
5
|
+
|
6
|
+
Given /^multiline string$/ do |string|
|
7
|
+
@string = string
|
8
|
+
end
|
9
|
+
|
10
|
+
Then /^string is$/ do |string|
|
11
|
+
@string.should == string
|
12
|
+
end
|
data/features/background.feature
CHANGED
@@ -16,7 +16,7 @@ Feature: backgrounds
|
|
16
16
|
Then I should have '10' cukes
|
17
17
|
|
18
18
|
1 scenario
|
19
|
-
|
19
|
+
2 passed steps
|
20
20
|
|
21
21
|
"""
|
22
22
|
|
@@ -64,7 +64,7 @@ Feature: backgrounds
|
|
64
64
|
| 10 |
|
65
65
|
|
66
66
|
2 scenarios
|
67
|
-
|
67
|
+
4 passed steps
|
68
68
|
|
69
69
|
"""
|
70
70
|
|
@@ -93,6 +93,7 @@ Feature: backgrounds
|
|
93
93
|
5 skipped steps
|
94
94
|
|
95
95
|
"""
|
96
|
+
And "examples/self_test/tmp/after.txt" should exist
|
96
97
|
|
97
98
|
Scenario: run a feature with scenario outlines that has a background that fails
|
98
99
|
When I run cucumber -q features/background/scenario_outline_failing_background.feature --require features
|
@@ -123,7 +124,7 @@ Feature: backgrounds
|
|
123
124
|
|
124
125
|
2 scenarios
|
125
126
|
1 failed step
|
126
|
-
|
127
|
+
3 skipped steps
|
127
128
|
|
128
129
|
"""
|
129
130
|
|
@@ -217,5 +218,22 @@ Feature: backgrounds
|
|
217
218
|
|
218
219
|
"""
|
219
220
|
|
221
|
+
Scenario: background with name
|
222
|
+
When I run cucumber -q features/background/background_with_name.feature --require features
|
223
|
+
Then it should pass with
|
224
|
+
"""
|
225
|
+
Feature: background with name
|
226
|
+
|
227
|
+
Background: I'm a background and I'm ok
|
228
|
+
Given '10' cukes
|
229
|
+
|
230
|
+
Scenario: example
|
231
|
+
Then I should have '10' cukes
|
232
|
+
|
233
|
+
1 scenario
|
234
|
+
2 passed steps
|
235
|
+
|
236
|
+
"""
|
237
|
+
|
220
238
|
@josephwilk
|
221
239
|
Scenario: run a scenario showing explicit background steps --explicit-background
|
@@ -229,15 +229,28 @@ Feature: Cucumber command line
|
|
229
229
|
hello
|
230
230
|
\"\"\"
|
231
231
|
|
232
|
-
|
232
|
+
Feature: undefined multiline args
|
233
|
+
|
234
|
+
Scenario: pystring
|
235
|
+
Given a pystring
|
236
|
+
\"\"\"
|
237
|
+
example
|
238
|
+
\"\"\"
|
239
|
+
|
240
|
+
Scenario: table
|
241
|
+
Given a table
|
242
|
+
| table |
|
243
|
+
| example |
|
244
|
+
|
245
|
+
14 scenarios
|
233
246
|
12 skipped steps
|
234
|
-
|
247
|
+
9 undefined steps
|
235
248
|
|
236
249
|
"""
|
237
250
|
|
238
251
|
Scenario: Multiple formatters and outputs
|
239
252
|
When I run cucumber --format progress --out tmp/progress.txt --format pretty --out tmp/pretty.txt --dry-run features/lots_of_undefined.feature
|
240
|
-
And examples/self_test/tmp/progress.txt should contain
|
253
|
+
And "examples/self_test/tmp/progress.txt" should contain
|
241
254
|
"""
|
242
255
|
UUUUU
|
243
256
|
|
@@ -245,7 +258,7 @@ Feature: Cucumber command line
|
|
245
258
|
5 undefined steps
|
246
259
|
|
247
260
|
"""
|
248
|
-
And examples/self_test/tmp/pretty.txt should match
|
261
|
+
And "examples/self_test/tmp/pretty.txt" should match
|
249
262
|
"""
|
250
263
|
Feature: Lots of undefined
|
251
264
|
|
@@ -362,7 +375,7 @@ Feature: Cucumber command line
|
|
362
375
|
|
363
376
|
Scenario: Reformat files with --autoformat
|
364
377
|
When I run cucumber --autoformat tmp/formatted features
|
365
|
-
Then examples/self_test/tmp/formatted/features/sample.feature should contain
|
378
|
+
Then "examples/self_test/tmp/formatted/features/sample.feature" should contain
|
366
379
|
"""
|
367
380
|
@one
|
368
381
|
Feature: Sample
|
@@ -41,7 +41,7 @@ Feature: Cucumber command line
|
|
41
41
|
Feature: Outline Sample
|
42
42
|
|
43
43
|
Scenario Outline: Test state # features/outline_sample.feature:5
|
44
|
-
Given <state> without a table # features/step_definitions/sample_steps.rb:
|
44
|
+
Given <state> without a table # features/step_definitions/sample_steps.rb:15
|
45
45
|
Given <other_state> without a table # features/step_definitions/sample_steps.rb:12
|
46
46
|
|
47
47
|
Examples: Rainbow colours
|
@@ -58,6 +58,9 @@ Feature: Cucumber command line
|
|
58
58
|
|
59
59
|
"""
|
60
60
|
|
61
|
+
# There are 10 characters in the progress, but only 8 reported steps. Needs investigation.
|
62
|
+
# Looks like we're outputting too many characters.
|
63
|
+
@buggy
|
61
64
|
Scenario: Run all with progress formatter
|
62
65
|
When I run cucumber -q --format progress features/outline_sample.feature
|
63
66
|
Then it should fail with
|
@@ -0,0 +1,132 @@
|
|
1
|
+
Feature: Rake task
|
2
|
+
In order to ease the development process
|
3
|
+
As a developer and CI server administrator
|
4
|
+
Cucumber features should be executable via Rake
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given a standard Cucumber project directory structure
|
8
|
+
And a file named "features/missing_step_definitions.feature" with:
|
9
|
+
"""
|
10
|
+
Feature: Sample
|
11
|
+
|
12
|
+
Scenario: Wanted
|
13
|
+
Given I want to run this
|
14
|
+
|
15
|
+
Scenario: Unwanted
|
16
|
+
Given I don't want this ran
|
17
|
+
"""
|
18
|
+
|
19
|
+
|
20
|
+
Scenario: rake task with a defined profile
|
21
|
+
Given the following profile is defined:
|
22
|
+
"""
|
23
|
+
foo: --quiet --no-color features/missing_step_definitions.feature:3
|
24
|
+
"""
|
25
|
+
And a file named "Rakefile" with:
|
26
|
+
"""
|
27
|
+
$LOAD_PATH.unshift(CUCUMBER_LIB)
|
28
|
+
require 'cucumber/rake/task'
|
29
|
+
|
30
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
31
|
+
t.profile = "foo"
|
32
|
+
end
|
33
|
+
"""
|
34
|
+
|
35
|
+
When I run rake features
|
36
|
+
Then it should pass
|
37
|
+
And the output should contain
|
38
|
+
"""
|
39
|
+
Feature: Sample
|
40
|
+
|
41
|
+
Scenario: Wanted
|
42
|
+
Given I want to run this
|
43
|
+
|
44
|
+
1 scenario
|
45
|
+
1 undefined step
|
46
|
+
"""
|
47
|
+
|
48
|
+
Scenario: rake task with a defined profile and cucumber_opts
|
49
|
+
Given the following profile is defined:
|
50
|
+
"""
|
51
|
+
bar: features/missing_step_definitions.feature:3
|
52
|
+
"""
|
53
|
+
And a file named "Rakefile" with:
|
54
|
+
"""
|
55
|
+
$LOAD_PATH.unshift(CUCUMBER_LIB)
|
56
|
+
require 'cucumber/rake/task'
|
57
|
+
|
58
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
59
|
+
t.profile = "bar"
|
60
|
+
t.cucumber_opts = "--quiet --no-color"
|
61
|
+
end
|
62
|
+
"""
|
63
|
+
|
64
|
+
When I run rake features
|
65
|
+
Then it should pass
|
66
|
+
And the output should contain
|
67
|
+
"""
|
68
|
+
Feature: Sample
|
69
|
+
|
70
|
+
Scenario: Wanted
|
71
|
+
Given I want to run this
|
72
|
+
|
73
|
+
1 scenario
|
74
|
+
1 undefined step
|
75
|
+
"""
|
76
|
+
|
77
|
+
Scenario: rake task with a defined profile and feature list
|
78
|
+
Given a file named "features/the_one_i_want_to_run.feature" with:
|
79
|
+
"""
|
80
|
+
Feature: Desired
|
81
|
+
|
82
|
+
Scenario: Something
|
83
|
+
Given this is missing
|
84
|
+
"""
|
85
|
+
Given the following profile is defined:
|
86
|
+
"""
|
87
|
+
baz: --quiet --no-color
|
88
|
+
"""
|
89
|
+
And a file named "Rakefile" with:
|
90
|
+
"""
|
91
|
+
$LOAD_PATH.unshift(CUCUMBER_LIB)
|
92
|
+
require 'cucumber/rake/task'
|
93
|
+
|
94
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
95
|
+
t.profile = "baz"
|
96
|
+
t.feature_list = ['features/the_one_i_want_to_run.feature']
|
97
|
+
end
|
98
|
+
"""
|
99
|
+
|
100
|
+
When I run rake features
|
101
|
+
Then it should pass
|
102
|
+
And the output should contain
|
103
|
+
"""
|
104
|
+
Feature: Desired
|
105
|
+
|
106
|
+
Scenario: Something
|
107
|
+
Given this is missing
|
108
|
+
|
109
|
+
1 scenario
|
110
|
+
1 undefined step
|
111
|
+
"""
|
112
|
+
|
113
|
+
Scenario: deprecation warnings
|
114
|
+
Given a file named "Rakefile" with:
|
115
|
+
"""
|
116
|
+
$LOAD_PATH.unshift(CUCUMBER_LIB)
|
117
|
+
require 'cucumber/rake/task'
|
118
|
+
|
119
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
120
|
+
t.feature_list = ['features/missing_step_definitions.feature']
|
121
|
+
end
|
122
|
+
"""
|
123
|
+
When I run rake features
|
124
|
+
Then it should pass
|
125
|
+
And STDERR should match
|
126
|
+
"""
|
127
|
+
Cucumber::Rake::Task#feature_list is deprecated and will be removed in 0.4.0. Please use profiles for complex settings: http://wiki.github.com/aslakhellesoy/cucumber/using-rake#profiles
|
128
|
+
"""
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|