aslakhellesoy-cucumber 0.3.11.3 → 0.3.11.5
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +35 -0
- data/Manifest.txt +5 -0
- data/config/hoe.rb +1 -2
- 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 +1 -0
- data/examples/i18n/ko/features/division.feature +1 -0
- 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/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/sinatra/features/step_definitions/add_steps.rb +1 -1
- data/examples/sinatra/features/support/env.rb +13 -5
- 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 +7 -1
- data/features/drb_server_integration.feature +5 -4
- data/features/expand.feature +2 -1
- data/features/html_formatter/a.html +33 -30
- data/features/junit_formatter.feature +4 -4
- data/features/language_from_header.feature +30 -0
- data/features/step_definitions/cucumber_steps.rb +2 -2
- data/features/support/env.rb +7 -4
- data/features/work_in_progress.feature +3 -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/scenario.rb +5 -3
- data/lib/cucumber/ast/scenario_outline.rb +6 -1
- data/lib/cucumber/ast/step.rb +4 -0
- data/lib/cucumber/ast/step_invocation.rb +6 -1
- data/lib/cucumber/cli/configuration.rb +36 -26
- data/lib/cucumber/cli/main.rb +4 -5
- data/lib/cucumber/feature_file.rb +47 -0
- data/lib/cucumber/filter.rb +50 -0
- data/lib/cucumber/formatter/console.rb +12 -0
- data/lib/cucumber/formatter/cucumber.css +19 -14
- data/lib/cucumber/formatter/cucumber.sass +18 -13
- data/lib/cucumber/formatter/html.rb +4 -3
- data/lib/cucumber/formatter/junit.rb +3 -6
- data/lib/cucumber/formatter/pretty.rb +2 -4
- data/lib/cucumber/formatter/profile.rb +1 -1
- data/lib/cucumber/parser.rb +1 -33
- data/lib/cucumber/parser/feature.rb +12 -16
- data/lib/cucumber/parser/feature.tt +1 -3
- data/lib/cucumber/parser/i18n.tt +30 -23
- data/lib/cucumber/parser/i18n/language.rb +80 -0
- data/lib/cucumber/parser/treetop_ext.rb +12 -83
- data/lib/cucumber/platform.rb +6 -0
- data/lib/cucumber/step_mother.rb +3 -3
- data/lib/cucumber/version.rb +1 -1
- data/rails_generators/cucumber/templates/cucumber.rake +4 -0
- data/spec/cucumber/ast/step_collection_spec.rb +5 -4
- data/spec/cucumber/cli/configuration_spec.rb +42 -9
- data/spec/cucumber/cli/main_spec.rb +2 -10
- 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 +0 -1
- metadata +8 -13
@@ -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
|
+
"""
|
@@ -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
|
data/features/support/env.rb
CHANGED
@@ -75,17 +75,20 @@ class CucumberWorld
|
|
75
75
|
@last_stderr = IO.read(stderr_file.path)
|
76
76
|
end
|
77
77
|
|
78
|
-
def
|
78
|
+
def run_spork_in_background
|
79
79
|
pid = fork
|
80
80
|
in_current_dir do
|
81
81
|
if pid
|
82
82
|
background_jobs << pid
|
83
83
|
else
|
84
|
-
#STDOUT.close
|
85
|
-
#STDERR.close
|
86
|
-
|
84
|
+
# STDOUT.close
|
85
|
+
# STDERR.close
|
86
|
+
spork = `which spork`.strip
|
87
|
+
cmd = "#{Cucumber::RUBY_BINARY} -I #{Cucumber::LIBDIR} #{spork} cuc"
|
88
|
+
exec cmd
|
87
89
|
end
|
88
90
|
end
|
91
|
+
sleep 0.2
|
89
92
|
end
|
90
93
|
|
91
94
|
def terminate_background_jobs
|
@@ -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/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|
|
@@ -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
|
@@ -88,7 +88,8 @@ module Cucumber
|
|
88
88
|
end
|
89
89
|
|
90
90
|
def actual_keyword
|
91
|
-
|
91
|
+
repeat_keywords = [language.but_keywords, language.and_keywords].flatten
|
92
|
+
if repeat_keywords.index(@step.keyword) && previous
|
92
93
|
previous.actual_keyword
|
93
94
|
else
|
94
95
|
keyword
|
@@ -123,6 +124,10 @@ module Cucumber
|
|
123
124
|
@step.backtrace_line
|
124
125
|
end
|
125
126
|
|
127
|
+
def language
|
128
|
+
@step.language
|
129
|
+
end
|
130
|
+
|
126
131
|
def to_sexp
|
127
132
|
[:step_invocation, @step.line, @step.keyword, @name, (@multiline_arg.nil? ? nil : @multiline_arg.to_sexp)].compact
|
128
133
|
end
|
@@ -4,15 +4,15 @@ module Cucumber
|
|
4
4
|
|
5
5
|
class Configuration
|
6
6
|
BUILTIN_FORMATS = {
|
7
|
-
'html'
|
8
|
-
'pretty'
|
9
|
-
'profile'
|
10
|
-
'progress'
|
11
|
-
'rerun'
|
12
|
-
'usage'
|
13
|
-
'junit'
|
7
|
+
'html' => 'Cucumber::Formatter::Html',
|
8
|
+
'pretty' => 'Cucumber::Formatter::Pretty',
|
9
|
+
'profile' => 'Cucumber::Formatter::Profile',
|
10
|
+
'progress' => 'Cucumber::Formatter::Progress',
|
11
|
+
'rerun' => 'Cucumber::Formatter::Rerun',
|
12
|
+
'usage' => 'Cucumber::Formatter::Usage',
|
13
|
+
'junit' => 'Cucumber::Formatter::Junit',
|
14
|
+
'tag_cloud' => 'Cucumber::Formatter::TagCloud'
|
14
15
|
}
|
15
|
-
DEFAULT_FORMAT = 'pretty'
|
16
16
|
DRB_FLAG = '--drb'
|
17
17
|
PROFILE_SHORT_FLAG = '-p'
|
18
18
|
PROFILE_LONG_FLAG = '--profile'
|
@@ -26,15 +26,21 @@ module Cucumber
|
|
26
26
|
|
27
27
|
@paths = []
|
28
28
|
@options = default_options
|
29
|
-
|
30
|
-
@active_format = DEFAULT_FORMAT
|
31
29
|
end
|
32
30
|
|
33
31
|
def parse!(args)
|
34
|
-
|
32
|
+
args.concat(%w{--profile default}) if args.empty?
|
33
|
+
@args = args
|
35
34
|
expand_profiles_into_args
|
36
35
|
return if parse_drb
|
37
36
|
|
37
|
+
@args.each do |arg|
|
38
|
+
if arg =~ /^(\w+)=(.*)$/
|
39
|
+
ENV[$1] = $2
|
40
|
+
@args.delete(arg)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
38
44
|
@args.extend(::OptionParser::Arguable)
|
39
45
|
|
40
46
|
@args.options do |opts|
|
@@ -69,7 +75,7 @@ module Cucumber
|
|
69
75
|
end
|
70
76
|
end
|
71
77
|
opts.on("-f FORMAT", "--format FORMAT",
|
72
|
-
"How to format features (Default:
|
78
|
+
"How to format features (Default: pretty)",
|
73
79
|
"Available formats: #{BUILTIN_FORMATS.keys.sort.join(", ")}",
|
74
80
|
"FORMAT can also be the fully qualified class name of",
|
75
81
|
"your own custom formatter. If the class isn't loaded,",
|
@@ -79,7 +85,7 @@ module Cucumber
|
|
79
85
|
"foo/bar_zap.rb. You can place the file with this relative",
|
80
86
|
"path underneath your features/support directory or anywhere",
|
81
87
|
"on Ruby's LOAD_PATH, for example in a Ruby gem.") do |v|
|
82
|
-
@options[:formats][v
|
88
|
+
@options[:formats] << [v, @out_stream]
|
83
89
|
@active_format = v
|
84
90
|
end
|
85
91
|
opts.on("-o", "--out [FILE|DIR]",
|
@@ -87,7 +93,8 @@ module Cucumber
|
|
87
93
|
"applies to the previously specified --format, or the",
|
88
94
|
"default format if no format is specified. Check the specific",
|
89
95
|
"formatter's docs to see whether to pass a file or a dir.") do |v|
|
90
|
-
@options[:formats][
|
96
|
+
@options[:formats] << ['pretty', nil] if @options[:formats].empty?
|
97
|
+
@options[:formats][-1][1] = v
|
91
98
|
end
|
92
99
|
opts.on("-t TAGS", "--tags TAGS",
|
93
100
|
"Only execute the features or scenarios with the specified tags.",
|
@@ -176,7 +183,7 @@ module Cucumber
|
|
176
183
|
end
|
177
184
|
end.parse!
|
178
185
|
|
179
|
-
|
186
|
+
arrange_formats
|
180
187
|
|
181
188
|
@options[:snippets] = true if !@quiet && @options[:snippets].nil?
|
182
189
|
@options[:source] = true if !@quiet && @options[:source].nil?
|
@@ -211,14 +218,6 @@ module Cucumber
|
|
211
218
|
@drb
|
212
219
|
end
|
213
220
|
|
214
|
-
def load_language
|
215
|
-
if Cucumber.language_incomplete?(@options[:lang])
|
216
|
-
list_keywords_and_exit(@options[:lang])
|
217
|
-
else
|
218
|
-
Cucumber.load_language(@options[:lang])
|
219
|
-
end
|
220
|
-
end
|
221
|
-
|
222
221
|
def parse_tags(tag_string)
|
223
222
|
tag_names = tag_string.split(",")
|
224
223
|
excludes, includes = tag_names.partition{|tag| tag =~ /^~/}
|
@@ -232,7 +231,9 @@ module Cucumber
|
|
232
231
|
|
233
232
|
def build_formatter_broadcaster(step_mother)
|
234
233
|
return Formatter::Pretty.new(step_mother, nil, @options) if @options[:autoformat]
|
235
|
-
formatters = @options[:formats].map do |
|
234
|
+
formatters = @options[:formats].map do |format_and_out|
|
235
|
+
format = format_and_out[0]
|
236
|
+
out = format_and_out[1]
|
236
237
|
if String === out # file name
|
237
238
|
unless File.directory?(out)
|
238
239
|
out = File.open(out, Cucumber.file_mode('w'))
|
@@ -292,6 +293,14 @@ module Cucumber
|
|
292
293
|
|
293
294
|
protected
|
294
295
|
|
296
|
+
def arrange_formats
|
297
|
+
@options[:formats] << ['pretty', @out_stream] if @options[:formats].empty?
|
298
|
+
@options[:formats] = @options[:formats].sort_by{|f| f[1] == @out_stream ? -1 : 1}
|
299
|
+
if @options[:formats].length > 1 && @options[:formats][1][1] == @out_stream
|
300
|
+
raise "All but one formatter must use --out, only one can print to STDOUT"
|
301
|
+
end
|
302
|
+
end
|
303
|
+
|
295
304
|
def remove_excluded_files_from(files)
|
296
305
|
files.reject! {|path| @options[:excludes].detect {|pattern| path =~ pattern } }
|
297
306
|
end
|
@@ -377,6 +386,7 @@ Defined profiles in cucumber.yml:
|
|
377
386
|
return @cucumber_yml
|
378
387
|
end
|
379
388
|
|
389
|
+
# TODO: Move to Language
|
380
390
|
def list_keywords_and_exit(lang)
|
381
391
|
unless Cucumber::LANGUAGES[lang]
|
382
392
|
raise("No language with key #{lang}")
|
@@ -398,9 +408,9 @@ Defined profiles in cucumber.yml:
|
|
398
408
|
{
|
399
409
|
:strict => false,
|
400
410
|
:require => nil,
|
401
|
-
:lang =>
|
411
|
+
:lang => nil,
|
402
412
|
:dry_run => false,
|
403
|
-
:formats =>
|
413
|
+
:formats => [],
|
404
414
|
:excludes => [],
|
405
415
|
:include_tags => [],
|
406
416
|
:exclude_tags => [],
|
data/lib/cucumber/cli/main.rb
CHANGED
@@ -2,6 +2,7 @@ require 'optparse'
|
|
2
2
|
require 'cucumber'
|
3
3
|
require 'ostruct'
|
4
4
|
require 'cucumber/parser'
|
5
|
+
require 'cucumber/feature_file'
|
5
6
|
require 'cucumber/formatter/color_io'
|
6
7
|
require 'cucumber/cli/language_help_formatter'
|
7
8
|
require 'cucumber/cli/configuration'
|
@@ -41,13 +42,11 @@ module Cucumber
|
|
41
42
|
configuration.parse!(@args)
|
42
43
|
end
|
43
44
|
end
|
44
|
-
configuration.load_language
|
45
45
|
step_mother.options = configuration.options
|
46
46
|
|
47
|
+
features = load_plain_text_features
|
47
48
|
require_files
|
48
49
|
enable_diffing
|
49
|
-
|
50
|
-
features = load_plain_text_features
|
51
50
|
|
52
51
|
visitor = configuration.build_formatter_broadcaster(step_mother)
|
53
52
|
step_mother.visitor = visitor # Needed to support World#announce
|
@@ -63,11 +62,11 @@ module Cucumber
|
|
63
62
|
|
64
63
|
def load_plain_text_features
|
65
64
|
features = Ast::Features.new
|
66
|
-
parser = Parser::FeatureParser.new
|
67
65
|
|
68
66
|
verbose_log("Features:")
|
69
67
|
configuration.feature_files.each do |f|
|
70
|
-
|
68
|
+
feature_file = FeatureFile.new(f)
|
69
|
+
feature = feature_file.parse(configuration.options)
|
71
70
|
if feature
|
72
71
|
features.add_feature(feature)
|
73
72
|
verbose_log(" * #{f}")
|