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
@@ -0,0 +1,80 @@
|
|
1
|
+
module Cucumber
|
2
|
+
module Parser
|
3
|
+
module I18n
|
4
|
+
class Language
|
5
|
+
KEYWORD_KEYS = %w{name native encoding feature background scenario scenario_outline examples given when then but}
|
6
|
+
|
7
|
+
class << self
|
8
|
+
LANGUAGES = Hash.new{|h,k| h[k] = Language.new(k)}
|
9
|
+
|
10
|
+
def [](key)
|
11
|
+
LANGUAGES[key]
|
12
|
+
end
|
13
|
+
|
14
|
+
def alias_step_definitions(keywords) #:nodoc:
|
15
|
+
all_keywords = %w{given when then and but}.map{|keyword| keywords[keyword].split('|')}.flatten
|
16
|
+
alias_steps(all_keywords)
|
17
|
+
end
|
18
|
+
|
19
|
+
# Sets up additional method aliases for Given, When and Then.
|
20
|
+
# This does *not* affect how feature files are parsed. If you
|
21
|
+
# want to create aliases in the parser, you have to do this in
|
22
|
+
# languages.yml. For example:
|
23
|
+
#
|
24
|
+
# and: And|With
|
25
|
+
def alias_steps(keywords)
|
26
|
+
keywords.each do |adverb|
|
27
|
+
StepMother.alias_adverb(adverb)
|
28
|
+
World.alias_adverb(adverb)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
alias_step_definitions(Cucumber::LANGUAGES['en'])
|
34
|
+
|
35
|
+
attr_reader :parser
|
36
|
+
|
37
|
+
def initialize(lang)
|
38
|
+
@keywords = Cucumber::LANGUAGES[lang]
|
39
|
+
raise "Language not supported: #{lang.inspect}" if @keywords.nil?
|
40
|
+
@keywords['grammar_name'] = @keywords['name'].gsub(/\s/, '')
|
41
|
+
i18n_tt = File.expand_path(File.dirname(__FILE__) + '/../i18n.tt')
|
42
|
+
template = File.open(i18n_tt, Cucumber.file_mode('r')).read
|
43
|
+
erb = ERB.new(template)
|
44
|
+
grammar = erb.result(binding)
|
45
|
+
Treetop.load_from_string(grammar)
|
46
|
+
@parser = Parser::I18n.const_get("#{@keywords['grammar_name']}Parser").new
|
47
|
+
self.class.alias_step_definitions(@keywords)
|
48
|
+
end
|
49
|
+
|
50
|
+
def parse(source, path, filter)
|
51
|
+
feature = @parser.parse_or_fail(source, path, filter)
|
52
|
+
feature.language = self if feature
|
53
|
+
feature
|
54
|
+
end
|
55
|
+
|
56
|
+
def keywords(key, raw=false)
|
57
|
+
return @keywords[key] if raw
|
58
|
+
values = @keywords[key].split('|')
|
59
|
+
values.map{|value| "'#{value}'"}.join(" / ")
|
60
|
+
end
|
61
|
+
|
62
|
+
def language_incomplete?
|
63
|
+
KEYWORD_KEYS.detect{|key| @keywords[key].nil?}
|
64
|
+
end
|
65
|
+
|
66
|
+
def scenario_keyword
|
67
|
+
@keywords['scenario'].split('|')[0] + ':'
|
68
|
+
end
|
69
|
+
|
70
|
+
def but_keywords
|
71
|
+
@keywords['but'].split('|')
|
72
|
+
end
|
73
|
+
|
74
|
+
def and_keywords
|
75
|
+
@keywords['and'].split('|')
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -12,80 +12,19 @@ end
|
|
12
12
|
|
13
13
|
module Cucumber
|
14
14
|
module Parser
|
15
|
-
class
|
16
|
-
def initialize(
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
def accept?(syntax_node)
|
24
|
-
at_line?(syntax_node) &&
|
25
|
-
matches_tags?(syntax_node) &&
|
26
|
-
matches_names?(syntax_node)
|
27
|
-
end
|
28
|
-
|
29
|
-
def accept_example?(syntax_node, outline)
|
30
|
-
(at_line?(syntax_node) || outline_at_line?(outline)) &&
|
31
|
-
(matches_names?(syntax_node) || outline_matches_names?(outline))
|
32
|
-
end
|
33
|
-
|
34
|
-
def at_line?(syntax_node)
|
35
|
-
@lines.nil? || @lines.empty? || @lines.detect{|line| syntax_node.at_line?(line)}
|
36
|
-
end
|
37
|
-
|
38
|
-
def outline_at_line?(syntax_node)
|
39
|
-
@lines.nil? || @lines.empty? || @lines.detect{|line| syntax_node.outline_at_line?(line)}
|
40
|
-
end
|
41
|
-
|
42
|
-
def matches_tags?(syntax_node)
|
43
|
-
!excluded_by_tags?(syntax_node) &&
|
44
|
-
included_by_tags?(syntax_node)
|
45
|
-
end
|
46
|
-
|
47
|
-
def included_by_tags?(syntax_node)
|
48
|
-
@include_tags.empty? || syntax_node.has_tags?(@include_tags)
|
49
|
-
end
|
50
|
-
|
51
|
-
def excluded_by_tags?(syntax_node)
|
52
|
-
@exclude_tags.any? && syntax_node.has_tags?(@exclude_tags)
|
53
|
-
end
|
54
|
-
|
55
|
-
def outline_matches_names?(syntax_node)
|
56
|
-
@name_regexps.nil? || @name_regexps.empty? || @name_regexps.detect{|name_regexp| syntax_node.outline_matches_name?(name_regexp)}
|
57
|
-
end
|
58
|
-
|
59
|
-
def matches_names?(syntax_node)
|
60
|
-
@name_regexps.nil? || @name_regexps.empty? || @name_regexps.detect{|name_regexp| syntax_node.matches_name?(name_regexp)}
|
15
|
+
class SyntaxError < StandardError
|
16
|
+
def initialize(parser, file, line_offset)
|
17
|
+
tf = parser.terminal_failures
|
18
|
+
expected = tf.size == 1 ? tf[0].expected_string.inspect : "one of #{tf.map{|f| f.expected_string.inspect}.uniq*', '}"
|
19
|
+
line = parser.failure_line + line_offset
|
20
|
+
message = "#{file}:#{line}:#{parser.failure_column}: Parse error, expected #{expected}."
|
21
|
+
super(message)
|
61
22
|
end
|
62
23
|
end
|
63
|
-
|
64
|
-
module TreetopExt
|
65
|
-
|
66
|
-
|
67
|
-
# Parses a file and returns a Cucumber::Ast
|
68
|
-
def parse_file(file, options)
|
69
|
-
_, path, lines = *FILE_COLON_LINE_PATTERN.match(file)
|
70
|
-
if path
|
71
|
-
lines = lines.split(':').map { |line| line.to_i }
|
72
|
-
else
|
73
|
-
path = file
|
74
|
-
end
|
75
|
-
filter = Filter.new(lines, options)
|
76
|
-
|
77
|
-
loader = lambda { |io| parse_or_fail(io.read, filter, path) }
|
78
|
-
feature = if path =~ /^http/
|
79
|
-
require 'open-uri'
|
80
|
-
open(path, &loader)
|
81
|
-
else
|
82
|
-
File.open(path, Cucumber.file_mode('r'), &loader)
|
83
|
-
end
|
84
|
-
feature
|
85
|
-
end
|
86
|
-
|
87
|
-
def parse_or_fail(string, filter=nil, file=nil, line_offset=0)
|
88
|
-
parse_tree = parse(string)
|
24
|
+
|
25
|
+
module TreetopExt
|
26
|
+
def parse_or_fail(source, file=nil, filter=nil, line_offset=0)
|
27
|
+
parse_tree = parse(source)
|
89
28
|
if parse_tree.nil?
|
90
29
|
raise Cucumber::Parser::SyntaxError.new(self, file, line_offset)
|
91
30
|
else
|
@@ -95,16 +34,6 @@ module Cucumber
|
|
95
34
|
end
|
96
35
|
end
|
97
36
|
end
|
98
|
-
|
99
|
-
class SyntaxError < StandardError
|
100
|
-
def initialize(parser, file, line_offset)
|
101
|
-
tf = parser.terminal_failures
|
102
|
-
expected = tf.size == 1 ? tf[0].expected_string.inspect : "one of #{tf.map{|f| f.expected_string.inspect}.uniq*', '}"
|
103
|
-
line = parser.failure_line + line_offset
|
104
|
-
message = "#{file}:#{line}:#{parser.failure_column}: Parse error, expected #{expected}."
|
105
|
-
super(message)
|
106
|
-
end
|
107
|
-
end
|
108
37
|
end
|
109
38
|
end
|
110
39
|
|
@@ -115,7 +44,7 @@ module Treetop
|
|
115
44
|
input.line_of(interval.first)
|
116
45
|
end
|
117
46
|
end
|
118
|
-
|
47
|
+
|
119
48
|
class CompiledParser
|
120
49
|
include Cucumber::Parser::TreetopExt
|
121
50
|
end
|
data/lib/cucumber/platform.rb
CHANGED
@@ -4,9 +4,11 @@ require 'rbconfig'
|
|
4
4
|
require 'yaml'
|
5
5
|
|
6
6
|
module Cucumber
|
7
|
+
# TODO: Move these constants and the file to Language. Update wiki
|
7
8
|
LANGUAGE_FILE = File.expand_path(File.dirname(__FILE__) + '/languages.yml')
|
8
9
|
LANGUAGES = YAML.load_file(LANGUAGE_FILE)
|
9
10
|
BINARY = File.expand_path(File.dirname(__FILE__) + '/../../bin/cucumber')
|
11
|
+
LIBDIR = File.expand_path(File.dirname(__FILE__) + '/../../lib')
|
10
12
|
JRUBY = defined?(JRUBY_VERSION)
|
11
13
|
IRONRUBY = Config::CONFIG['sitedir'] =~ /IronRuby/
|
12
14
|
WINDOWS = Config::CONFIG['host_os'] =~ /mswin|mingw/
|
@@ -14,4 +16,8 @@ module Cucumber
|
|
14
16
|
RAILS = defined?(Rails)
|
15
17
|
RUBY_BINARY = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])
|
16
18
|
RUBY_1_9 = RUBY_VERSION =~ /^1\.9/
|
19
|
+
|
20
|
+
def self.file_mode(m)
|
21
|
+
RUBY_1_9 ? "#{m}:UTF-8" : m
|
22
|
+
end
|
17
23
|
end
|
data/lib/cucumber/step_mother.rb
CHANGED
@@ -254,12 +254,12 @@ module Cucumber
|
|
254
254
|
@snippet_generator.snippet_text(step_keyword, step_name, multiline_arg_class)
|
255
255
|
end
|
256
256
|
|
257
|
-
def before_and_after(scenario,
|
258
|
-
before(scenario) unless
|
257
|
+
def before_and_after(scenario, skip_hooks=false)
|
258
|
+
before(scenario) unless skip_hooks
|
259
259
|
@current_scenario = scenario
|
260
260
|
yield scenario
|
261
261
|
@current_scenario = nil
|
262
|
-
after(scenario) unless
|
262
|
+
after(scenario) unless skip_hooks
|
263
263
|
scenario_visited(scenario)
|
264
264
|
end
|
265
265
|
|
data/lib/cucumber/version.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
$LOAD_PATH.unshift(RAILS_ROOT + '/vendor/plugins/cucumber/lib') if File.directory?(RAILS_ROOT + '/vendor/plugins/cucumber/lib')
|
2
2
|
|
3
|
+
unless ARGV.any? {|a| a =~ /^gems/}
|
4
|
+
|
3
5
|
begin
|
4
6
|
require 'cucumber/rake/task'
|
5
7
|
|
@@ -14,3 +16,5 @@ rescue LoadError
|
|
14
16
|
abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
|
15
17
|
end
|
16
18
|
end
|
19
|
+
|
20
|
+
end
|
@@ -4,10 +4,11 @@ module Cucumber
|
|
4
4
|
module Ast
|
5
5
|
describe StepCollection do
|
6
6
|
it "should convert And to Given in snippets" do
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
])
|
7
|
+
s1 = Step.new(1, 'Given', 'cukes')
|
8
|
+
s2 = Step.new(2, 'And', 'turnips')
|
9
|
+
s1.stub!(:language).and_return(Parser::I18n::Language['en'])
|
10
|
+
s2.stub!(:language).and_return(Parser::I18n::Language['en'])
|
11
|
+
c = StepCollection.new([s1, s2])
|
11
12
|
actual_keywords = c.step_invocations.map{|i| i.actual_keyword}
|
12
13
|
actual_keywords.should == %w{Given Given}
|
13
14
|
end
|
@@ -138,12 +138,22 @@ module Cli
|
|
138
138
|
|
139
139
|
end
|
140
140
|
|
141
|
+
context '--drb in the default profile and no arguments specified' do
|
142
|
+
it "expands the profile's arguments into the args excpet for --drb" do
|
143
|
+
given_cucumber_yml_defined_as({'default' => '--drb features --format pretty'})
|
144
|
+
config = Configuration.new(StringIO.new)
|
145
|
+
args = []
|
146
|
+
config.parse!(args)
|
147
|
+
args.should == %w{features --format pretty}
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
141
151
|
it "should expand args from YAML file" do
|
142
152
|
given_cucumber_yml_defined_as({'bongo' => '--require from/yml'})
|
143
153
|
|
144
154
|
config = Configuration.new
|
145
155
|
config.parse!(%w{--format progress --profile bongo})
|
146
|
-
config.options[:formats].should ==
|
156
|
+
config.options[:formats].should == [['progress', STDOUT]]
|
147
157
|
config.options[:require].should == ['from/yml']
|
148
158
|
end
|
149
159
|
|
@@ -255,26 +265,34 @@ END_OF_MESSAGE
|
|
255
265
|
it "should accept --out option" do
|
256
266
|
config = Configuration.new(StringIO.new)
|
257
267
|
config.parse!(%w{--out jalla.txt})
|
258
|
-
config.options[:formats]
|
268
|
+
config.options[:formats].should == [['pretty', 'jalla.txt']]
|
259
269
|
end
|
260
270
|
|
261
271
|
it "should accept multiple --out options" do
|
262
272
|
config = Configuration.new(StringIO.new)
|
263
273
|
config.parse!(%w{--format progress --out file1 --out file2})
|
264
|
-
config.options[:formats].should ==
|
274
|
+
config.options[:formats].should == [['progress', 'file2']]
|
265
275
|
end
|
266
276
|
|
267
|
-
it "should accept multiple --format options" do
|
268
|
-
|
269
|
-
config.
|
270
|
-
config.
|
271
|
-
config.options[:formats].should
|
277
|
+
it "should accept multiple --format options and put the STDOUT one first so progress is seen" do
|
278
|
+
io = StringIO.new
|
279
|
+
config = Configuration.new(io)
|
280
|
+
config.parse!(%w{--format pretty --out pretty.txt --format progress})
|
281
|
+
config.options[:formats].should == [['progress', io], ['pretty', 'pretty.txt']]
|
282
|
+
end
|
283
|
+
|
284
|
+
it "should not accept multiple --format options when both use implicit STDOUT" do
|
285
|
+
io = StringIO.new
|
286
|
+
config = Configuration.new(io)
|
287
|
+
lambda do
|
288
|
+
config.parse!(%w{--format pretty --format progress})
|
289
|
+
end.should raise_error("All but one formatter must use --out, only one can print to STDOUT")
|
272
290
|
end
|
273
291
|
|
274
292
|
it "should associate --out to previous --format" do
|
275
293
|
config = Configuration.new(StringIO.new)
|
276
294
|
config.parse!(%w{--format progress --out file1 --format profile --out file2})
|
277
|
-
config.options[:formats].should ==
|
295
|
+
config.options[:formats].should == [["progress", "file1"], ["profile" ,"file2"]]
|
278
296
|
end
|
279
297
|
|
280
298
|
it "should accept --color option" do
|
@@ -358,6 +376,21 @@ END_OF_MESSAGE
|
|
358
376
|
config.feature_files.should == ["cucumber.feature"]
|
359
377
|
end
|
360
378
|
|
379
|
+
it "should allow specifying environment variables on the command line" do
|
380
|
+
config = Configuration.new
|
381
|
+
config.parse!(["foo=bar"])
|
382
|
+
ENV["foo"].should == "bar"
|
383
|
+
config.feature_files.should == []
|
384
|
+
end
|
385
|
+
|
386
|
+
it "should allow specifying environment variables in profiles" do
|
387
|
+
given_cucumber_yml_defined_as({'selenium' => 'RAILS_ENV=selenium'})
|
388
|
+
config = Configuration.new
|
389
|
+
config.parse!(["--profile", "selenium"])
|
390
|
+
ENV["RAILS_ENV"].should == "selenium"
|
391
|
+
config.feature_files.should == []
|
392
|
+
end
|
393
|
+
|
361
394
|
end
|
362
395
|
end
|
363
396
|
end
|
@@ -35,7 +35,7 @@ module Cucumber
|
|
35
35
|
@cli = Main.new(%w{--verbose example.feature}, @out)
|
36
36
|
@cli.stub!(:require)
|
37
37
|
|
38
|
-
|
38
|
+
FeatureFile.stub!(:new).and_return(mock("feature file", :parse => @empty_feature))
|
39
39
|
|
40
40
|
@cli.execute!(Object.new.extend(StepMother))
|
41
41
|
|
@@ -115,10 +115,9 @@ module Cucumber
|
|
115
115
|
@cli.execute!(@step_mother).should == 'foo'
|
116
116
|
end
|
117
117
|
|
118
|
-
|
119
118
|
it "ceases execution if the DrbClient is able to perform the execution" do
|
120
119
|
DRbClient.stub!(:run).and_return(true)
|
121
|
-
@configuration.should_not_receive(:
|
120
|
+
@configuration.should_not_receive(:build_formatter_broadcaster)
|
122
121
|
@cli.execute!(@step_mother)
|
123
122
|
end
|
124
123
|
|
@@ -134,15 +133,8 @@ module Cucumber
|
|
134
133
|
@configuration.should_receive(:parse!).exactly(:twice)
|
135
134
|
@cli.execute!(@step_mother)
|
136
135
|
end
|
137
|
-
|
138
|
-
it "proceeds with the execution locally" do
|
139
|
-
@configuration.should_receive(:load_language)
|
140
|
-
@cli.execute!(@step_mother)
|
141
|
-
end
|
142
136
|
end
|
143
|
-
|
144
137
|
end
|
145
|
-
|
146
138
|
end
|
147
139
|
end
|
148
140
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
-
require 'cucumber/parser'
|
2
|
+
require 'cucumber/parser/i18n/language'
|
3
3
|
|
4
4
|
module Cucumber
|
5
5
|
module Parser
|
6
6
|
describe Feature do
|
7
7
|
before do
|
8
|
-
@parser =
|
8
|
+
@parser = I18n::Language['en'].parser
|
9
9
|
end
|
10
10
|
|
11
11
|
def parse(text)
|
@@ -13,11 +13,11 @@ module Cucumber
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def parse_file(file)
|
16
|
-
|
16
|
+
FeatureFile.new(File.dirname(__FILE__) + "/../treetop_parser/" + file).parse
|
17
17
|
end
|
18
18
|
|
19
19
|
def parse_example_file(file)
|
20
|
-
|
20
|
+
FeatureFile.new(File.dirname(__FILE__) + "/../../../examples/" + file).parse
|
21
21
|
end
|
22
22
|
|
23
23
|
describe "Comments" do
|
@@ -25,7 +25,7 @@ module Cucumber
|
|
25
25
|
parse(%{# My comment
|
26
26
|
Feature: hi
|
27
27
|
}).to_sexp.should ==
|
28
|
-
[:feature, nil, "Feature: hi
|
28
|
+
[:feature, nil, "Feature: hi",
|
29
29
|
[:comment, "# My comment\n"]]
|
30
30
|
end
|
31
31
|
|
@@ -34,13 +34,13 @@ Feature: hi
|
|
34
34
|
# World
|
35
35
|
Feature: hi
|
36
36
|
}).to_sexp.should ==
|
37
|
-
[:feature, nil, "Feature: hi
|
37
|
+
[:feature, nil, "Feature: hi",
|
38
38
|
[:comment, "# Hello\n# World\n"]]
|
39
39
|
end
|
40
40
|
|
41
41
|
it "should parse a file with no comments" do
|
42
42
|
parse("Feature: hi\n").to_sexp.should ==
|
43
|
-
[:feature, nil, "Feature: hi
|
43
|
+
[:feature, nil, "Feature: hi"]
|
44
44
|
end
|
45
45
|
|
46
46
|
it "should parse a file with only a multiline comment with newlines" do
|
@@ -61,7 +61,7 @@ Feature: hi
|
|
61
61
|
describe "Tags" do
|
62
62
|
it "should parse a file with tags on a feature" do
|
63
63
|
parse("# My comment\n@hello @world Feature: hi\n").to_sexp.should ==
|
64
|
-
[:feature, nil, "Feature: hi
|
64
|
+
[:feature, nil, "Feature: hi",
|
65
65
|
[:comment, "# My comment\n"],
|
66
66
|
[:tag, "hello"],
|
67
67
|
[:tag, "world"]]
|
@@ -352,7 +352,9 @@ Given I am a step
|
|
352
352
|
|
353
353
|
describe "Filtering" do
|
354
354
|
it "should filter outline tables" do
|
355
|
-
|
355
|
+
ff = FeatureFile.new(
|
356
|
+
File.dirname(__FILE__) + '/../../../examples/self_test/features/outline_sample.feature:12')
|
357
|
+
f = ff.parse({:lang => 'en'})
|
356
358
|
f.to_sexp.should ==
|
357
359
|
[:feature,
|
358
360
|
"./spec/cucumber/parser/../../../examples/self_test/features/outline_sample.feature",
|