cucumber 0.3.11 → 0.3.90
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +101 -0
- data/Manifest.txt +14 -5
- data/config/hoe.rb +1 -2
- data/cucumber.yml +1 -0
- data/examples/i18n/ar/Rakefile +1 -1
- data/examples/i18n/ar/features/addition.feature +1 -0
- data/examples/i18n/bg/Rakefile +1 -1
- data/examples/i18n/bg/features/addition.feature +1 -0
- data/examples/i18n/bg/features/consecutive_calculations.feature +1 -0
- data/examples/i18n/bg/features/division.feature +1 -0
- data/examples/i18n/cat/Rakefile +1 -1
- data/examples/i18n/cat/features/suma.feature +1 -0
- data/examples/i18n/da/Rakefile +1 -1
- data/examples/i18n/da/features/summering.feature +1 -0
- data/examples/i18n/de/Rakefile +1 -1
- data/examples/i18n/de/features/addition.feature +1 -0
- data/examples/i18n/de/features/division.feature +1 -0
- data/examples/i18n/en-lol/features/stuffing.feature +1 -1
- data/examples/i18n/en/Rakefile +1 -1
- data/examples/i18n/en/features/addition.feature +1 -0
- data/examples/i18n/en/features/division.feature +1 -0
- data/examples/i18n/es/Rakefile +1 -1
- data/examples/i18n/es/features/adicion.feature +1 -0
- data/examples/i18n/et/Rakefile +1 -1
- data/examples/i18n/et/features/jagamine.feature +1 -0
- data/examples/i18n/et/features/liitmine.feature +1 -0
- data/examples/i18n/fi/Rakefile +1 -1
- data/examples/i18n/fi/features/jakolasku.feature +1 -0
- data/examples/i18n/fr/Rakefile +1 -1
- data/examples/i18n/fr/features/addition.feature +2 -1
- data/examples/i18n/he/Rakefile +1 -1
- data/examples/i18n/he/features/addition.feature +1 -0
- data/examples/i18n/he/features/division.feature +1 -0
- data/examples/i18n/hu/Rakefile +1 -1
- data/examples/i18n/hu/features/addition.feature +1 -0
- data/examples/i18n/hu/features/division.feature +1 -0
- data/examples/i18n/id/Rakefile +1 -1
- data/examples/i18n/id/features/addition.feature +1 -0
- data/examples/i18n/id/features/division.feature +1 -0
- data/examples/i18n/it/Rakefile +1 -1
- data/examples/i18n/it/features/somma.feature +1 -0
- data/examples/i18n/ja/Rakefile +1 -1
- data/examples/i18n/ja/features/addition.feature +1 -0
- data/examples/i18n/ja/features/division.feature +1 -0
- data/examples/i18n/ko/Rakefile +1 -1
- data/examples/i18n/ko/features/addition.feature +6 -5
- data/examples/i18n/ko/features/division.feature +1 -0
- data/examples/i18n/ko/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/lt/Rakefile +1 -1
- data/examples/i18n/lt/features/addition.feature +1 -0
- data/examples/i18n/lt/features/division.feature +1 -0
- data/examples/i18n/lv/Rakefile +1 -1
- data/examples/i18n/lv/features/addition.feature +1 -0
- data/examples/i18n/lv/features/division.feature +1 -0
- data/examples/i18n/no/Rakefile +1 -1
- data/examples/i18n/no/features/step_definitons/kalkulator_steps.rb +1 -1
- data/examples/i18n/no/features/summering.feature +1 -0
- data/examples/i18n/pl/Rakefile +1 -1
- data/examples/i18n/pl/features/addition.feature +1 -0
- data/examples/i18n/pl/features/division.feature +1 -0
- data/examples/i18n/pt/Rakefile +1 -1
- data/examples/i18n/pt/features/adicao.feature +1 -0
- data/examples/i18n/ro/Rakefile +1 -1
- data/examples/i18n/ro/features/suma.feature +1 -0
- data/examples/i18n/ru/Rakefile +1 -1
- data/examples/i18n/ru/features/addition.feature +1 -0
- data/examples/i18n/ru/features/consecutive_calculations.feature +1 -0
- data/examples/i18n/ru/features/division.feature +1 -0
- data/examples/i18n/se/Rakefile +1 -1
- data/examples/i18n/se/features/summering.feature +1 -0
- data/examples/i18n/sk/Rakefile +1 -1
- data/examples/i18n/sk/features/addition.feature +1 -0
- data/examples/i18n/sk/features/division.feature +1 -0
- data/examples/i18n/zh-CN/features/addition.feature +1 -0
- data/examples/i18n/zh-TW/features/addition.feature +1 -0
- data/examples/i18n/zh-TW/features/division.feature +1 -0
- data/examples/self_test/features/support/env.rb +2 -1
- data/examples/sinatra/features/step_definitions/add_steps.rb +1 -1
- data/examples/sinatra/features/support/env.rb +13 -5
- data/examples/steps_library/features/step_definitions/steps_lib1.rb +8 -0
- data/examples/steps_library/features/step_definitions/steps_lib2.rb +8 -0
- data/examples/tickets/features/step_definitons/tickets_steps.rb +15 -0
- data/examples/tickets/features/table_diffing.feature +13 -0
- data/features/after_block_exceptions.feature +4 -1
- data/features/after_step_block_exceptions.feature +4 -1
- data/features/background.feature +6 -0
- data/features/bug_371.feature +32 -0
- data/features/cucumber_cli.feature +11 -1
- data/features/cucumber_cli_diff_disabled.feature +9 -2
- data/features/drb_server_integration.feature +28 -5
- data/features/expand.feature +2 -1
- data/features/html_formatter/a.html +129 -1614
- data/features/junit_formatter.feature +4 -4
- data/features/language_from_header.feature +30 -0
- data/features/rake_task.feature +28 -0
- data/features/step_definitions/cucumber_steps.rb +2 -2
- data/features/steps_formatter.feature +25 -0
- data/features/support/env.rb +13 -5
- data/features/table_diffing.feature +45 -0
- data/features/unicode_table.feature +35 -0
- data/features/work_in_progress.feature +3 -0
- data/gem_tasks/sass.rake +4 -0
- data/lib/cucumber.rb +0 -57
- data/lib/cucumber/ast/comment.rb +1 -1
- data/lib/cucumber/ast/feature.rb +2 -2
- data/lib/cucumber/ast/feature_element.rb +4 -0
- data/lib/cucumber/ast/outline_table.rb +2 -1
- data/lib/cucumber/ast/py_string.rb +0 -1
- data/lib/cucumber/ast/scenario.rb +5 -3
- data/lib/cucumber/ast/scenario_outline.rb +6 -1
- data/lib/cucumber/ast/step.rb +8 -1
- data/lib/cucumber/ast/step_invocation.rb +6 -1
- data/lib/cucumber/ast/table.rb +287 -49
- data/lib/cucumber/ast/visitor.rb +2 -1
- data/lib/cucumber/cli/configuration.rb +45 -28
- data/lib/cucumber/cli/drb_client.rb +8 -9
- data/lib/cucumber/cli/language_help_formatter.rb +9 -7
- data/lib/cucumber/cli/main.rb +8 -9
- data/lib/cucumber/feature_file.rb +53 -0
- data/lib/cucumber/filter.rb +50 -0
- data/lib/cucumber/formatter/console.rb +12 -0
- data/lib/cucumber/formatter/cucumber.css +106 -48
- data/lib/cucumber/formatter/cucumber.sass +121 -31
- data/lib/cucumber/formatter/html.rb +6 -5
- data/lib/cucumber/formatter/junit.rb +3 -6
- data/lib/cucumber/formatter/pretty.rb +22 -9
- data/lib/cucumber/formatter/profile.rb +1 -1
- data/lib/cucumber/formatter/progress.rb +1 -1
- data/lib/cucumber/formatter/steps.rb +49 -0
- data/lib/cucumber/languages.yml +3 -3
- data/lib/cucumber/parser.rb +1 -33
- data/lib/cucumber/parser/feature.rb +39 -16
- data/lib/cucumber/parser/feature.tt +1 -3
- data/lib/cucumber/parser/i18n.tt +30 -23
- data/lib/cucumber/parser/i18n/language.rb +83 -0
- data/lib/cucumber/parser/treetop_ext.rb +12 -83
- data/lib/cucumber/platform.rb +6 -0
- data/lib/cucumber/rake/task.rb +6 -0
- data/lib/cucumber/step_definition.rb +6 -0
- data/lib/cucumber/step_match.rb +1 -1
- data/lib/cucumber/step_mother.rb +3 -3
- data/lib/cucumber/version.rb +1 -1
- data/lib/cucumber/webrat/table_locator.rb +66 -0
- data/rails_generators/cucumber/templates/cucumber.rake +4 -0
- data/rails_generators/cucumber/templates/env.rb +1 -0
- data/rails_generators/cucumber/templates/spork_env.rb +1 -1
- data/rails_generators/cucumber/templates/webrat_steps.rb +17 -0
- data/rails_generators/feature/templates/feature.erb +1 -1
- data/rails_generators/feature/templates/steps.erb +2 -8
- data/spec/cucumber/ast/step_collection_spec.rb +5 -4
- data/spec/cucumber/ast/table_spec.rb +145 -0
- data/spec/cucumber/cli/configuration_spec.rb +55 -9
- data/spec/cucumber/cli/drb_client_spec.rb +5 -4
- data/spec/cucumber/cli/main_spec.rb +9 -12
- data/spec/cucumber/formatter/progress_spec.rb +2 -2
- data/spec/cucumber/parser/feature_parser_spec.rb +11 -9
- data/spec/cucumber/parser/table_parser_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -1
- metadata +21 -20
- data/spec/cucumber/formatter/html/cucumber.css +0 -37
- data/spec/cucumber/formatter/html/cucumber.js +0 -13
- data/spec/cucumber/formatter/html/index.html +0 -45
- data/spec/cucumber/formatter/html/jquery-1.3.min.js +0 -19
- data/spec/cucumber/formatter/html/jquery.uitableedit.js +0 -100
@@ -13,7 +13,7 @@ Feature: JUnit output formatter
|
|
13
13
|
"""
|
14
14
|
|
15
15
|
"""
|
16
|
-
And "examples/junit/tmp/TEST-
|
16
|
+
And "examples/junit/tmp/TEST-one_passing_one_failing.xml" should contain XML
|
17
17
|
"""
|
18
18
|
<?xml version="1.0" encoding="UTF-8"?>
|
19
19
|
<testsuite errors="0" tests="2" name="One passing scenario, one failing scenario" failures="1">
|
@@ -36,7 +36,7 @@ Feature: JUnit output formatter
|
|
36
36
|
"""
|
37
37
|
|
38
38
|
"""
|
39
|
-
And "examples/junit/tmp/TEST-
|
39
|
+
And "examples/junit/tmp/TEST-pending.xml" should contain XML
|
40
40
|
"""
|
41
41
|
<?xml version="1.0" encoding="UTF-8"?>
|
42
42
|
<testsuite errors="0" tests="1" name="Pending step" failures="1">
|
@@ -56,8 +56,8 @@ Feature: JUnit output formatter
|
|
56
56
|
"""
|
57
57
|
|
58
58
|
"""
|
59
|
-
And "examples/junit/tmp/TEST-
|
60
|
-
And "examples/junit/tmp/TEST-
|
59
|
+
And "examples/junit/tmp/TEST-one_passing_one_failing.xml" should exist
|
60
|
+
And "examples/junit/tmp/TEST-pending.xml" should exist
|
61
61
|
|
62
62
|
Scenario: show correct error message if no --out is passed
|
63
63
|
When I run cucumber --format junit features
|
@@ -0,0 +1,30 @@
|
|
1
|
+
Feature: Language from header
|
2
|
+
In order to simplify command line and
|
3
|
+
settings in IDEs, Cucumber should pick
|
4
|
+
up parser language from a header.
|
5
|
+
|
6
|
+
Scenario: LOLCAT
|
7
|
+
Given a standard Cucumber project directory structure
|
8
|
+
And a file named "features/lolcat.feature" with:
|
9
|
+
"""
|
10
|
+
# language: en-lol
|
11
|
+
OH HAI: STUFFING
|
12
|
+
B4: HUNGRY
|
13
|
+
MISHUN: CUKES
|
14
|
+
DEN KTHXBAI
|
15
|
+
"""
|
16
|
+
When I run cucumber -i features/lolcat.feature
|
17
|
+
Then it should pass with
|
18
|
+
"""
|
19
|
+
# language: en-lol
|
20
|
+
OH HAI: STUFFING
|
21
|
+
|
22
|
+
B4: HUNGRY # features/lolcat.feature:3
|
23
|
+
|
24
|
+
MISHUN: CUKES # features/lolcat.feature:4
|
25
|
+
DEN KTHXBAI # features/lolcat.feature:5
|
26
|
+
|
27
|
+
1 scenario (1 undefined)
|
28
|
+
1 step (1 undefined)
|
29
|
+
|
30
|
+
"""
|
data/features/rake_task.feature
CHANGED
@@ -148,3 +148,31 @@ Feature: Rake task
|
|
148
148
|
"""
|
149
149
|
* features/support/dont_require_me.rb
|
150
150
|
"""
|
151
|
+
|
152
|
+
Scenario: feature files with spaces
|
153
|
+
Given a file named "features/spaces are nasty.feature" with:
|
154
|
+
"""
|
155
|
+
Feature: The futures green
|
156
|
+
|
157
|
+
Scenario: Orange
|
158
|
+
Given this is missing
|
159
|
+
"""
|
160
|
+
And a file named "Rakefile" with:
|
161
|
+
"""
|
162
|
+
$LOAD_PATH.unshift(CUCUMBER_LIB)
|
163
|
+
require 'cucumber/rake/task'
|
164
|
+
|
165
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
166
|
+
t.cucumber_opts = %w{--quiet --no-color}
|
167
|
+
end
|
168
|
+
"""
|
169
|
+
When I run rake features
|
170
|
+
Then it should pass
|
171
|
+
And the output should contain
|
172
|
+
"""
|
173
|
+
Feature: The futures green
|
174
|
+
|
175
|
+
Scenario: Orange
|
176
|
+
Given this is missing
|
177
|
+
|
178
|
+
"""
|
@@ -31,8 +31,8 @@ Given /^the following profiles? (?:are|is) defined:$/ do |profiles|
|
|
31
31
|
create_file('cucumber.yml', profiles)
|
32
32
|
end
|
33
33
|
|
34
|
-
Given /^I am running
|
35
|
-
|
34
|
+
Given /^I am running spork in the background$/ do
|
35
|
+
run_spork_in_background
|
36
36
|
end
|
37
37
|
|
38
38
|
Given /^I am not running (?:.*) in the background$/ do
|
@@ -0,0 +1,25 @@
|
|
1
|
+
Feature: --formatter steps option - Steps Formatter
|
2
|
+
In order to easily see which steps are already defined,
|
3
|
+
specially when using 3rd party steps libraries,
|
4
|
+
Cucumber should show the available steps in a user-friendly format
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given I am in steps_library
|
8
|
+
|
9
|
+
Scenario: Printing steps
|
10
|
+
When I run cucumber -f steps features
|
11
|
+
Then it should pass with
|
12
|
+
"""
|
13
|
+
features/step_definitions/steps_lib1.rb
|
14
|
+
/^I defined a first step$/ # features/step_definitions/steps_lib1.rb:1
|
15
|
+
/^I define a second step$/ # features/step_definitions/steps_lib1.rb:4
|
16
|
+
/^I should also have a third step$/ # features/step_definitions/steps_lib1.rb:7
|
17
|
+
|
18
|
+
features/step_definitions/steps_lib2.rb
|
19
|
+
/^I defined a step 4$/ # features/step_definitions/steps_lib2.rb:1
|
20
|
+
/^I create a step 5$/ # features/step_definitions/steps_lib2.rb:4
|
21
|
+
/^I should be too tired for step 6$/ # features/step_definitions/steps_lib2.rb:7
|
22
|
+
|
23
|
+
6 step definition(s) in 2 source file(s).
|
24
|
+
|
25
|
+
"""
|
data/features/support/env.rb
CHANGED
@@ -4,7 +4,7 @@ require 'spec/expectations'
|
|
4
4
|
require 'fileutils'
|
5
5
|
require 'forwardable'
|
6
6
|
begin
|
7
|
-
|
7
|
+
gem "spork", ">= 0.5.1" # Ensure correct spork version number to avoid false-negatives.
|
8
8
|
rescue Gem::LoadError => ex
|
9
9
|
warn "WARNING: #{ex.message} You need to have the spork gem installed to run the DRb feature properly!"
|
10
10
|
end
|
@@ -70,22 +70,30 @@ class CucumberWorld
|
|
70
70
|
stderr_file.close
|
71
71
|
in_current_dir do
|
72
72
|
@last_stdout = `#{command} 2> #{stderr_file.path}`
|
73
|
+
mode = Cucumber::RUBY_1_9 ? {:external_encoding=>"UTF-8"} : 'r'
|
74
|
+
IO.popen("#{command} 2> #{stderr_file.path}", mode) do |io|
|
75
|
+
@last_stdout = io.read
|
76
|
+
end
|
77
|
+
|
73
78
|
@last_exit_status = $?.exitstatus
|
74
79
|
end
|
75
80
|
@last_stderr = IO.read(stderr_file.path)
|
76
81
|
end
|
77
82
|
|
78
|
-
def
|
83
|
+
def run_spork_in_background
|
79
84
|
pid = fork
|
80
85
|
in_current_dir do
|
81
86
|
if pid
|
82
87
|
background_jobs << pid
|
83
88
|
else
|
84
|
-
#STDOUT.close
|
85
|
-
#STDERR.close
|
86
|
-
|
89
|
+
# STDOUT.close
|
90
|
+
# STDERR.close
|
91
|
+
spork = `which spork`.strip
|
92
|
+
cmd = "#{Cucumber::RUBY_BINARY} -I #{Cucumber::LIBDIR} #{spork} cuc"
|
93
|
+
exec cmd
|
87
94
|
end
|
88
95
|
end
|
96
|
+
sleep 0.2
|
89
97
|
end
|
90
98
|
|
91
99
|
def terminate_background_jobs
|
@@ -0,0 +1,45 @@
|
|
1
|
+
Feature: Table diffing
|
2
|
+
In order to more easily compare data in tables
|
3
|
+
step definition writers should be able to diff
|
4
|
+
a table with expected data and see the diff inline
|
5
|
+
|
6
|
+
Scenario: Extra row
|
7
|
+
Given a standard Cucumber project directory structure
|
8
|
+
And a file named "features/tables.feature" with:
|
9
|
+
"""
|
10
|
+
Feature: Tables
|
11
|
+
Scenario: Extra row
|
12
|
+
Then the table should be:
|
13
|
+
| x | y |
|
14
|
+
| a | b |
|
15
|
+
"""
|
16
|
+
And a file named "features/step_definitions/table_steps.rb" with:
|
17
|
+
"""
|
18
|
+
Then /the table should be:/ do |expected|
|
19
|
+
expected.diff!(table(%{
|
20
|
+
| x | y |
|
21
|
+
| a | c |
|
22
|
+
}))
|
23
|
+
end
|
24
|
+
"""
|
25
|
+
When I run cucumber -i features/tables.feature
|
26
|
+
Then it should fail with
|
27
|
+
"""
|
28
|
+
Feature: Tables
|
29
|
+
|
30
|
+
Scenario: Extra row # features/tables.feature:2
|
31
|
+
Then the table should be: # features/step_definitions/table_steps.rb:1
|
32
|
+
| x | y |
|
33
|
+
| a | b |
|
34
|
+
| a | c |
|
35
|
+
Tables were not identical (RuntimeError)
|
36
|
+
./features/step_definitions/table_steps.rb:2:in `/the table should be:/'
|
37
|
+
features/tables.feature:3:in `Then the table should be:'
|
38
|
+
|
39
|
+
Failing Scenarios:
|
40
|
+
cucumber features/tables.feature:2 # Scenario: Extra row
|
41
|
+
|
42
|
+
1 scenario (1 failed)
|
43
|
+
1 step (1 failed)
|
44
|
+
|
45
|
+
"""
|
@@ -0,0 +1,35 @@
|
|
1
|
+
Feature: Unicode in tables
|
2
|
+
In order to please the whole world,
|
3
|
+
unicode characters in tables should be
|
4
|
+
properly aligned
|
5
|
+
|
6
|
+
Scenario: All sorts of weird stuff
|
7
|
+
Given a standard Cucumber project directory structure
|
8
|
+
And a file named "features/unicode.feature" with:
|
9
|
+
"""
|
10
|
+
Feature: Featuring unicode
|
11
|
+
|
12
|
+
Scenario: So what, whatever
|
13
|
+
Given passing
|
14
|
+
| Brüno | abc |
|
15
|
+
| Bruno | æøå |
|
16
|
+
"""
|
17
|
+
And a file named "features/env.rb" with:
|
18
|
+
"""
|
19
|
+
$KCODE='u'
|
20
|
+
"""
|
21
|
+
When I run cucumber -q --dry-run features/unicode.feature
|
22
|
+
Then it should pass with
|
23
|
+
"""
|
24
|
+
Feature: Featuring unicode
|
25
|
+
|
26
|
+
Scenario: So what, whatever
|
27
|
+
Given passing
|
28
|
+
| Brüno | abc |
|
29
|
+
| Bruno | æøå |
|
30
|
+
|
31
|
+
1 scenario (1 undefined)
|
32
|
+
1 step (1 undefined)
|
33
|
+
|
34
|
+
"""
|
35
|
+
|
@@ -62,6 +62,9 @@ Feature: Cucumber --work-in-progress switch
|
|
62
62
|
I fail (RuntimeError)
|
63
63
|
./features/step_definitions/steps.rb:2:in `/^a failing step$/'
|
64
64
|
features/wip.feature:4:in `Given a failing step'
|
65
|
+
|
66
|
+
Failing Scenarios:
|
67
|
+
cucumber features/wip.feature:3 # Scenario: Failing
|
65
68
|
|
66
69
|
1 scenario (1 failed)
|
67
70
|
1 step (1 failed)
|
data/gem_tasks/sass.rake
ADDED
data/lib/cucumber.rb
CHANGED
@@ -9,60 +9,3 @@ require 'cucumber/step_mother'
|
|
9
9
|
require 'cucumber/cli/main'
|
10
10
|
require 'cucumber/broadcaster'
|
11
11
|
require 'cucumber/core_ext/exception'
|
12
|
-
|
13
|
-
module Cucumber
|
14
|
-
KEYWORD_KEYS = %w{name native encoding feature background scenario scenario_outline examples given when then but}
|
15
|
-
|
16
|
-
class << self
|
17
|
-
# The currently active language
|
18
|
-
attr_reader :lang
|
19
|
-
|
20
|
-
def load_language(lang) #:nodoc:
|
21
|
-
return if @lang
|
22
|
-
@lang = lang
|
23
|
-
alias_step_definitions(lang)
|
24
|
-
Parser.load_parser(keyword_hash)
|
25
|
-
end
|
26
|
-
|
27
|
-
def language_incomplete?(lang=@lang)
|
28
|
-
KEYWORD_KEYS.detect{|key| keyword_hash(lang)[key].nil?}
|
29
|
-
end
|
30
|
-
|
31
|
-
# File mode that accounts for Ruby platform and current language
|
32
|
-
def file_mode(m)
|
33
|
-
Cucumber::RUBY_1_9 ? "#{m}:#{keyword_hash['encoding']}" : m
|
34
|
-
end
|
35
|
-
|
36
|
-
# Returns a Hash of the currently active
|
37
|
-
# language, or for a specific language if +lang+ is
|
38
|
-
# specified.
|
39
|
-
def keyword_hash(lang=@lang)
|
40
|
-
LANGUAGES[lang]
|
41
|
-
end
|
42
|
-
|
43
|
-
def scenario_keyword
|
44
|
-
keyword_hash['scenario'].split('|')[0] + ':'
|
45
|
-
end
|
46
|
-
|
47
|
-
def alias_step_definitions(lang) #:nodoc:
|
48
|
-
keywords = %w{given when then and but}.map{|keyword| keyword_hash(lang)[keyword].split('|')}
|
49
|
-
alias_steps(keywords.flatten)
|
50
|
-
end
|
51
|
-
|
52
|
-
# Sets up additional method aliases for Given, When and Then.
|
53
|
-
# This does *not* affect how feature files are parsed. If you
|
54
|
-
# want to create aliases in the parser, you have to do this in
|
55
|
-
# languages.yml. For example:
|
56
|
-
#
|
57
|
-
# and: And|With
|
58
|
-
def alias_steps(keywords)
|
59
|
-
keywords.each do |adverb|
|
60
|
-
StepMother.alias_adverb(adverb)
|
61
|
-
World.alias_adverb(adverb)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
# Make sure we always have English aliases
|
67
|
-
alias_step_definitions('en')
|
68
|
-
end
|
data/lib/cucumber/ast/comment.rb
CHANGED
data/lib/cucumber/ast/feature.rb
CHANGED
@@ -2,12 +2,12 @@ module Cucumber
|
|
2
2
|
module Ast
|
3
3
|
# Represents the root node of a parsed feature.
|
4
4
|
class Feature
|
5
|
-
attr_accessor :file
|
5
|
+
attr_accessor :file, :language
|
6
6
|
attr_writer :features
|
7
7
|
attr_reader :name
|
8
8
|
|
9
9
|
def initialize(background, comment, tags, name, feature_elements)
|
10
|
-
@background, @comment, @tags, @name, @feature_elements = background, comment, tags, name, feature_elements
|
10
|
+
@background, @comment, @tags, @name, @feature_elements = background, comment, tags, name.strip, feature_elements
|
11
11
|
|
12
12
|
background.feature = self if background
|
13
13
|
@feature_elements.each do |feature_element|
|
@@ -44,7 +44,8 @@ module Cucumber
|
|
44
44
|
end
|
45
45
|
|
46
46
|
class ExampleRow < Cells
|
47
|
-
|
47
|
+
attr_reader :scenario_outline # https://rspec.lighthouseapp.com/projects/16211/tickets/342
|
48
|
+
|
48
49
|
def create_step_invocations!(scenario_outline)
|
49
50
|
@scenario_outline = scenario_outline
|
50
51
|
@step_invocations = scenario_outline.step_invocations(self)
|
@@ -25,12 +25,14 @@ module Cucumber
|
|
25
25
|
visitor.visit_tags(@tags)
|
26
26
|
visitor.visit_scenario_name(@keyword, @name, file_colon_line(@line), source_indent(first_line_length))
|
27
27
|
|
28
|
-
|
29
|
-
skip_invoke! if
|
30
|
-
|
28
|
+
background_failed = @background && @background.failed?
|
29
|
+
skip_invoke! if background_failed
|
30
|
+
skip_hooks = background_failed || @executed
|
31
|
+
visitor.step_mother.before_and_after(self, skip_hooks) do
|
31
32
|
visitor.visit_steps(@steps)
|
32
33
|
end
|
33
34
|
visitor.visit_exception(@exception, :failed) if @exception
|
35
|
+
@executed = true
|
34
36
|
end
|
35
37
|
|
36
38
|
# Returns true if one or more steps failed
|
@@ -69,7 +69,12 @@ module Cucumber
|
|
69
69
|
end
|
70
70
|
|
71
71
|
def visit_scenario_name(visitor, row)
|
72
|
-
visitor.visit_scenario_name(
|
72
|
+
visitor.visit_scenario_name(
|
73
|
+
@feature.language.scenario_keyword,
|
74
|
+
row.name,
|
75
|
+
file_colon_line(row.line),
|
76
|
+
source_indent(first_line_length)
|
77
|
+
)
|
73
78
|
end
|
74
79
|
|
75
80
|
def to_sexp
|
data/lib/cucumber/ast/step.rb
CHANGED
@@ -74,6 +74,10 @@ module Cucumber
|
|
74
74
|
@file_colon_line ||= @feature_element.file_colon_line(@line) unless @feature_element.nil?
|
75
75
|
end
|
76
76
|
|
77
|
+
def language
|
78
|
+
@feature_element.language
|
79
|
+
end
|
80
|
+
|
77
81
|
def dom_id
|
78
82
|
@dom_id ||= file_colon_line.gsub(/\//, '_').gsub(/\./, '_').gsub(/:/, '_')
|
79
83
|
end
|
@@ -81,8 +85,11 @@ module Cucumber
|
|
81
85
|
private
|
82
86
|
|
83
87
|
def matched_cells(cells)
|
88
|
+
col_index = 0
|
84
89
|
cells.select do |cell|
|
85
|
-
|
90
|
+
header_cell = cell.table.header_cell(col_index)
|
91
|
+
col_index += 1
|
92
|
+
delimited = delimited(header_cell.value)
|
86
93
|
@name.index(delimited) || (@multiline_arg && @multiline_arg.has_text?(delimited))
|
87
94
|
end
|
88
95
|
end
|