cucumber 2.0.2 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -6
- data/CONTRIBUTING.md +3 -1
- data/Gemfile +1 -1
- data/History.md +17 -0
- data/README.md +3 -3
- data/bin/cucumber +1 -2
- data/cucumber.gemspec +2 -2
- data/examples/i18n/ht/features/adisyon.feature +7 -7
- data/features/docs/api/listen_for_events.feature +58 -0
- data/features/docs/cli/fail_fast.feature +46 -0
- data/features/docs/defining_steps/nested_steps_with_second_arg.feature +3 -22
- data/features/docs/extending_cucumber/custom_formatter.feature +40 -4
- data/features/docs/gherkin/doc_strings.feature +5 -5
- data/features/docs/gherkin/language_help.feature +15 -15
- data/features/docs/gherkin/using_descriptions.feature +0 -5
- data/lib/cucumber/cli/configuration.rb +10 -92
- data/lib/cucumber/cli/main.rb +1 -7
- data/lib/cucumber/cli/options.rb +47 -12
- data/lib/cucumber/configuration.rb +195 -7
- data/lib/cucumber/events.rb +20 -0
- data/lib/cucumber/events/after_test_case.rb +25 -0
- data/lib/cucumber/events/after_test_step.rb +30 -0
- data/lib/cucumber/events/before_test_case.rb +18 -0
- data/lib/cucumber/events/before_test_step.rb +23 -0
- data/lib/cucumber/events/bus.rb +86 -0
- data/lib/cucumber/events/step_match.rb +23 -0
- data/lib/cucumber/filters/prepare_world.rb +2 -2
- data/lib/cucumber/formatter/backtrace_filter.rb +9 -8
- data/lib/cucumber/formatter/console.rb +1 -1
- data/lib/cucumber/formatter/event_bus_report.rb +37 -0
- data/lib/cucumber/formatter/fail_fast.rb +18 -0
- data/lib/cucumber/formatter/html.rb +1 -1
- data/lib/cucumber/formatter/io.rb +3 -1
- data/lib/cucumber/formatter/json.rb +19 -1
- data/lib/cucumber/formatter/legacy_api/adapter.rb +5 -13
- data/lib/cucumber/formatter/legacy_api/ast.rb +2 -2
- data/lib/cucumber/formatter/legacy_api/runtime_facade.rb +3 -1
- data/lib/cucumber/formatter/pretty.rb +5 -7
- data/lib/cucumber/formatter/progress.rb +1 -1
- data/lib/cucumber/formatter/rerun.rb +1 -1
- data/lib/cucumber/formatter/steps.rb +1 -1
- data/lib/cucumber/formatter/usage.rb +12 -8
- data/lib/cucumber/gherkin/data_table_parser.rb +23 -0
- data/lib/cucumber/gherkin/formatter/ansi_escapes.rb +99 -0
- data/lib/cucumber/gherkin/formatter/argument.rb +17 -0
- data/lib/cucumber/gherkin/formatter/escaping.rb +17 -0
- data/lib/cucumber/gherkin/formatter/hashable.rb +27 -0
- data/lib/cucumber/gherkin/i18n.rb +15 -0
- data/lib/cucumber/gherkin/steps_parser.rb +41 -0
- data/lib/cucumber/language_support/language_methods.rb +6 -5
- data/lib/cucumber/multiline_argument.rb +0 -3
- data/lib/cucumber/multiline_argument/data_table.rb +6 -5
- data/lib/cucumber/multiline_argument/doc_string.rb +1 -2
- data/lib/cucumber/platform.rb +1 -1
- data/lib/cucumber/rake/task.rb +2 -2
- data/lib/cucumber/rb_support/rb_hook.rb +1 -6
- data/lib/cucumber/rb_support/rb_language.rb +15 -5
- data/lib/cucumber/rb_support/rb_step_definition.rb +11 -17
- data/lib/cucumber/rb_support/rb_world.rb +6 -4
- data/lib/cucumber/rb_support/regexp_argument_matcher.rb +2 -2
- data/lib/cucumber/runtime.rb +36 -16
- data/lib/cucumber/runtime/support_code.rb +19 -15
- data/lib/cucumber/step_definition_light.rb +5 -5
- data/lib/cucumber/step_definitions.rb +2 -2
- data/lib/cucumber/step_match.rb +11 -2
- data/lib/cucumber/wire_support/wire_protocol/requests.rb +2 -2
- data/lib/cucumber/wire_support/wire_step_definition.rb +4 -2
- data/{spec → lib}/simplecov_setup.rb +0 -0
- data/spec/cucumber/cli/configuration_spec.rb +2 -104
- data/spec/cucumber/cli/main_spec.rb +0 -22
- data/spec/cucumber/cli/options_spec.rb +3 -1
- data/spec/cucumber/configuration_spec.rb +123 -0
- data/spec/cucumber/events/bus_spec.rb +94 -0
- data/spec/cucumber/formatter/event_bus_report_spec.rb +79 -0
- data/spec/cucumber/formatter/fail_fast_spec.rb +88 -0
- data/spec/cucumber/formatter/json_spec.rb +43 -1
- data/spec/cucumber/formatter/rerun_spec.rb +4 -20
- data/spec/cucumber/rb_support/rb_step_definition_spec.rb +29 -0
- data/spec/cucumber/runtime_spec.rb +2 -28
- data/spec/spec_helper.rb +1 -1
- data/spec/support/standard_step_actions.rb +18 -0
- metadata +37 -13
- data/lib/cucumber/core_ext/proc.rb +0 -36
- data/spec/cucumber/core_ext/proc_spec.rb +0 -69
@@ -104,7 +104,7 @@ module Cucumber
|
|
104
104
|
:embeddings) do
|
105
105
|
extend Forwardable
|
106
106
|
|
107
|
-
def_delegators :step, :keyword, :name, :multiline_arg, :location
|
107
|
+
def_delegators :step, :keyword, :name, :multiline_arg, :location
|
108
108
|
|
109
109
|
def accept(formatter)
|
110
110
|
formatter.before_step(self)
|
@@ -252,7 +252,7 @@ module Cucumber
|
|
252
252
|
def keyword
|
253
253
|
# This method is only called when used for the scenario name line with
|
254
254
|
# the expand option, and on that line the keyword is "Scenario"
|
255
|
-
language.
|
255
|
+
language.scenario_keywords[0]
|
256
256
|
end
|
257
257
|
end
|
258
258
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'cucumber/gherkin/i18n'
|
2
|
+
|
1
3
|
module Cucumber
|
2
4
|
module Formatter
|
3
5
|
module LegacyApi
|
@@ -9,7 +11,7 @@ module Cucumber
|
|
9
11
|
end
|
10
12
|
|
11
13
|
def snippet_text(step_keyword, step_name, multiline_arg) #:nodoc:
|
12
|
-
support_code.snippet_text(::Gherkin::I18n.code_keyword_for(step_keyword), step_name, multiline_arg)
|
14
|
+
support_code.snippet_text(Cucumber::Gherkin::I18n.code_keyword_for(step_keyword).strip, step_name, multiline_arg)
|
13
15
|
end
|
14
16
|
|
15
17
|
def unknown_programming_language?
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
require 'cucumber/formatter/console'
|
3
3
|
require 'cucumber/formatter/io'
|
4
|
-
require 'gherkin/formatter/escaping'
|
4
|
+
require 'cucumber/gherkin/formatter/escaping'
|
5
5
|
|
6
6
|
module Cucumber
|
7
7
|
module Formatter
|
@@ -16,12 +16,12 @@ module Cucumber
|
|
16
16
|
include FileUtils
|
17
17
|
include Console
|
18
18
|
include Io
|
19
|
-
include Gherkin::Formatter::Escaping
|
19
|
+
include Cucumber::Gherkin::Formatter::Escaping
|
20
20
|
attr_writer :indent
|
21
21
|
attr_reader :runtime
|
22
22
|
|
23
23
|
def initialize(runtime, path_or_io, options)
|
24
|
-
@runtime, @io, @options = runtime, ensure_io(path_or_io
|
24
|
+
@runtime, @io, @options = runtime, ensure_io(path_or_io), options
|
25
25
|
@exceptions = []
|
26
26
|
@indent = 0
|
27
27
|
@prefixes = options[:prefixes] || {}
|
@@ -105,9 +105,7 @@ module Cucumber
|
|
105
105
|
def examples_name(keyword, name)
|
106
106
|
@io.puts unless @visiting_first_example_name
|
107
107
|
@visiting_first_example_name = false
|
108
|
-
|
109
|
-
@io.puts(" #{keyword}: #{names[0]}")
|
110
|
-
names[1..-1].each {|s| @io.puts " #{s}" } unless names.empty?
|
108
|
+
@io.puts(" #{keyword}: #{name}")
|
111
109
|
@io.flush
|
112
110
|
@indent = 6
|
113
111
|
@scenario_indent = 6
|
@@ -231,7 +229,7 @@ module Cucumber
|
|
231
229
|
@io.print(format_string(line_comment, :comment))
|
232
230
|
end
|
233
231
|
@io.puts
|
234
|
-
names[1..-1].each {|s| @io.puts "
|
232
|
+
names[1..-1].each {|s| @io.puts "#{s}"}
|
235
233
|
@io.flush
|
236
234
|
end
|
237
235
|
|
@@ -12,7 +12,7 @@ module Cucumber
|
|
12
12
|
attr_reader :runtime
|
13
13
|
|
14
14
|
def initialize(runtime, path_or_io, options)
|
15
|
-
@runtime, @io, @options = runtime, ensure_io(path_or_io
|
15
|
+
@runtime, @io, @options = runtime, ensure_io(path_or_io), options
|
16
16
|
@previous_step_keyword = nil
|
17
17
|
@snippets_input = []
|
18
18
|
@total_duration = 0
|
@@ -12,26 +12,30 @@ module Cucumber
|
|
12
12
|
|
13
13
|
def initialize(runtime, path_or_io, options)
|
14
14
|
@runtime = runtime
|
15
|
-
@io = ensure_io(path_or_io
|
15
|
+
@io = ensure_io(path_or_io)
|
16
16
|
@options = options
|
17
17
|
@stepdef_to_match = Hash.new { |h, stepdef_key| h[stepdef_key] = [] }
|
18
18
|
@total_duration = 0
|
19
|
+
@matches = {}
|
20
|
+
runtime.configuration.on_event :step_match do |event|
|
21
|
+
@matches[event.test_step.source] = event.step_match
|
22
|
+
end
|
19
23
|
end
|
20
24
|
|
21
25
|
def after_test_step(test_step, result)
|
22
26
|
return if HookQueryVisitor.new(test_step).hook?
|
23
27
|
|
24
|
-
step_match = @
|
28
|
+
step_match = @matches[test_step.source]
|
25
29
|
step_definition = step_match.step_definition
|
26
|
-
stepdef_key = StepDefKey.new(step_definition.regexp_source, step_definition.
|
27
|
-
unless @stepdef_to_match[stepdef_key].map { |key| key[:
|
30
|
+
stepdef_key = StepDefKey.new(step_definition.regexp_source, step_definition.location)
|
31
|
+
unless @stepdef_to_match[stepdef_key].map { |key| key[:location] }.include? test_step.location
|
28
32
|
duration = DurationExtractor.new(result).result_duration
|
29
33
|
|
30
34
|
@stepdef_to_match[stepdef_key] << {
|
31
35
|
keyword: test_step.source.last.keyword,
|
32
36
|
step_match: step_match,
|
33
37
|
status: result.to_sym,
|
34
|
-
|
38
|
+
location: test_step.location,
|
35
39
|
duration: duration
|
36
40
|
}
|
37
41
|
end
|
@@ -68,7 +72,7 @@ module Cucumber
|
|
68
72
|
@io.print format_string(stepdef_key.regexp_source, stepdef_key.status)
|
69
73
|
if @options[:source]
|
70
74
|
indent = max_length - stepdef_key.regexp_source.unpack('U*').length
|
71
|
-
line_comment = " # #{stepdef_key.
|
75
|
+
line_comment = " # #{stepdef_key.location}".indent(indent)
|
72
76
|
@io.print(format_string(line_comment, :comment))
|
73
77
|
end
|
74
78
|
@io.puts
|
@@ -81,7 +85,7 @@ module Cucumber
|
|
81
85
|
@io.print format_step(step[:keyword], step[:step_match], step[:status], nil)
|
82
86
|
if @options[:source]
|
83
87
|
indent = max_length - (step[:keyword].unpack('U*').length + step[:step_match].format_args.unpack('U*').length)
|
84
|
-
line_comment = " # #{step[:
|
88
|
+
line_comment = " # #{step[:location]}".indent(indent)
|
85
89
|
@io.print(format_string(line_comment, :comment))
|
86
90
|
end
|
87
91
|
@io.puts
|
@@ -123,7 +127,7 @@ module Cucumber
|
|
123
127
|
|
124
128
|
def add_unused_stepdefs
|
125
129
|
@runtime.unmatched_step_definitions.each do |step_definition|
|
126
|
-
stepdef_key = StepDefKey.new(step_definition.regexp_source, step_definition.
|
130
|
+
stepdef_key = StepDefKey.new(step_definition.regexp_source, step_definition.location)
|
127
131
|
@stepdef_to_match[stepdef_key] = []
|
128
132
|
end
|
129
133
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'gherkin3/token_scanner'
|
2
|
+
require 'gherkin3/token_matcher'
|
3
|
+
|
4
|
+
module Cucumber
|
5
|
+
module Gherkin
|
6
|
+
class DataTableParser
|
7
|
+
def initialize(builder)
|
8
|
+
@builder = builder
|
9
|
+
end
|
10
|
+
def parse(text)
|
11
|
+
scanner = ::Gherkin3::TokenScanner.new(text)
|
12
|
+
matcher = ::Gherkin3::TokenMatcher.new
|
13
|
+
token = scanner.read
|
14
|
+
until matcher.match_EOF(token) do
|
15
|
+
if matcher.match_TableRow(token)
|
16
|
+
@builder.row(token.matched_items.map { |cell_item| cell_item.text })
|
17
|
+
end
|
18
|
+
token = scanner.read
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
module Cucumber
|
2
|
+
module Gherkin
|
3
|
+
module Formatter
|
4
|
+
# Defines aliases for ANSI coloured output. Default colours can be overridden by defining
|
5
|
+
# a <tt>GHERKIN_COLORS</tt> variable in your shell, very much like how you can
|
6
|
+
# tweak the familiar POSIX command <tt>ls</tt> with
|
7
|
+
# $LSCOLORS: http://linux-sxs.org/housekeeping/lscolors.html
|
8
|
+
#
|
9
|
+
# The colours that you can change are:
|
10
|
+
#
|
11
|
+
# <tt>undefined</tt>:: defaults to <tt>yellow</tt>
|
12
|
+
# <tt>pending</tt>:: defaults to <tt>yellow</tt>
|
13
|
+
# <tt>pending_arg</tt>:: defaults to <tt>yellow,bold</tt>
|
14
|
+
# <tt>executing</tt>:: defaults to <tt>grey</tt>
|
15
|
+
# <tt>executing_arg</tt>:: defaults to <tt>grey,bold</tt>
|
16
|
+
# <tt>failed</tt>:: defaults to <tt>red</tt>
|
17
|
+
# <tt>failed_arg</tt>:: defaults to <tt>red,bold</tt>
|
18
|
+
# <tt>passed</tt>:: defaults to <tt>green</tt>
|
19
|
+
# <tt>passed_arg</tt>:: defaults to <tt>green,bold</tt>
|
20
|
+
# <tt>outline</tt>:: defaults to <tt>cyan</tt>
|
21
|
+
# <tt>outline_arg</tt>:: defaults to <tt>cyan,bold</tt>
|
22
|
+
# <tt>skipped</tt>:: defaults to <tt>cyan</tt>
|
23
|
+
# <tt>skipped_arg</tt>:: defaults to <tt>cyan,bold</tt>
|
24
|
+
# <tt>comment</tt>:: defaults to <tt>grey</tt>
|
25
|
+
# <tt>tag</tt>:: defaults to <tt>cyan</tt>
|
26
|
+
#
|
27
|
+
# For instance, if your shell has a black background and a green font (like the
|
28
|
+
# "Homebrew" settings for OS X' Terminal.app), you may want to override passed
|
29
|
+
# steps to be white instead of green. Examples:
|
30
|
+
#
|
31
|
+
# export GHERKIN_COLORS="passed=white"
|
32
|
+
# export GHERKIN_COLORS="passed=white,bold:passed_arg=white,bold,underline"
|
33
|
+
#
|
34
|
+
# (If you're on Windows, use SET instead of export).
|
35
|
+
# To see what colours and effects are available, just run this in your shell:
|
36
|
+
#
|
37
|
+
# ruby -e "require 'rubygems'; require 'term/ansicolor'; puts Term::ANSIColor.attributes"
|
38
|
+
#
|
39
|
+
# Although not listed, you can also use <tt>grey</tt>
|
40
|
+
module AnsiEscapes
|
41
|
+
COLORS = {
|
42
|
+
'black' => "\e[30m",
|
43
|
+
'red' => "\e[31m",
|
44
|
+
'green' => "\e[32m",
|
45
|
+
'yellow' => "\e[33m",
|
46
|
+
'blue' => "\e[34m",
|
47
|
+
'magenta' => "\e[35m",
|
48
|
+
'cyan' => "\e[36m",
|
49
|
+
'white' => "\e[37m",
|
50
|
+
'grey' => "\e[90m",
|
51
|
+
'bold' => "\e[1m"
|
52
|
+
}
|
53
|
+
|
54
|
+
ALIASES = Hash.new do |h,k|
|
55
|
+
if k.to_s =~ /(.*)_arg/
|
56
|
+
h[$1] + ',bold'
|
57
|
+
end
|
58
|
+
end.merge({
|
59
|
+
'undefined' => 'yellow',
|
60
|
+
'pending' => 'yellow',
|
61
|
+
'executing' => 'grey',
|
62
|
+
'failed' => 'red',
|
63
|
+
'passed' => 'green',
|
64
|
+
'outline' => 'cyan',
|
65
|
+
'skipped' => 'cyan',
|
66
|
+
'comments' => 'grey',
|
67
|
+
'tag' => 'cyan'
|
68
|
+
})
|
69
|
+
|
70
|
+
if ENV['GHERKIN_COLORS'] # Example: export GHERKIN_COLORS="passed=red:failed=yellow"
|
71
|
+
ENV['GHERKIN_COLORS'].split(':').each do |pair|
|
72
|
+
a = pair.split('=')
|
73
|
+
ALIASES[a[0]] = a[1]
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
ALIASES.keys.each do |key|
|
78
|
+
define_method(key) do
|
79
|
+
ALIASES[key].split(',').map{|color| COLORS[color]}.join('')
|
80
|
+
end
|
81
|
+
|
82
|
+
define_method("#{key}_arg") do
|
83
|
+
ALIASES["#{key}_arg"].split(',').map{|color| COLORS[color]}.join('')
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def reset
|
88
|
+
"\e[0m"
|
89
|
+
end
|
90
|
+
|
91
|
+
def up(n)
|
92
|
+
"\e[#{n}A"
|
93
|
+
end
|
94
|
+
|
95
|
+
extend self
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'cucumber/gherkin/formatter/hashable'
|
2
|
+
|
3
|
+
module Cucumber
|
4
|
+
module Gherkin
|
5
|
+
module Formatter
|
6
|
+
class Argument < Hashable
|
7
|
+
#native_impl('gherkin')
|
8
|
+
attr_reader :offset, :val
|
9
|
+
|
10
|
+
# Creates a new Argument that starts at character offset +offset+ with value +val+
|
11
|
+
def initialize(offset, val)
|
12
|
+
@offset, @val = offset, val
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Cucumber
|
2
|
+
module Gherkin
|
3
|
+
module Formatter
|
4
|
+
module Escaping
|
5
|
+
# Escapes a pipes and backslashes:
|
6
|
+
#
|
7
|
+
# * | becomes \|
|
8
|
+
# * \ becomes \\
|
9
|
+
#
|
10
|
+
# This is used in the pretty formatter.
|
11
|
+
def escape_cell(s)
|
12
|
+
s.gsub(/\\(?!\|)/, "\\\\\\\\").gsub(/\n/, "\\n").gsub(/\|/, "\\|")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Cucumber
|
2
|
+
module Gherkin
|
3
|
+
module Formatter
|
4
|
+
class Hashable
|
5
|
+
def to_hash
|
6
|
+
ivars = instance_variables
|
7
|
+
# When tests are runn with therubyracer (JavaScript), an extra field might
|
8
|
+
# exist - added by Ref::WeakReference
|
9
|
+
# https://github.com/bdurand/ref/blob/master/lib/ref/weak_reference/pure_ruby.rb
|
10
|
+
# Remove it - we don't want it in the JSON.
|
11
|
+
ivars.delete(:@__weak_backreferences__)
|
12
|
+
ivars.inject({}) do |hash, ivar|
|
13
|
+
value = instance_variable_get(ivar)
|
14
|
+
value = value.to_hash if value.respond_to?(:to_hash)
|
15
|
+
if Array === value
|
16
|
+
value = value.map do |e|
|
17
|
+
e.respond_to?(:to_hash) ? e.to_hash : e
|
18
|
+
end
|
19
|
+
end
|
20
|
+
hash[ivar[1..-1]] = value unless [[], nil].index(value)
|
21
|
+
hash
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Cucumber
|
2
|
+
module Gherkin
|
3
|
+
module I18n
|
4
|
+
class << self
|
5
|
+
def code_keyword_for(gherkin_keyword)
|
6
|
+
gherkin_keyword.gsub(/[\s',!]/, '').strip
|
7
|
+
end
|
8
|
+
|
9
|
+
def code_keywords_for(gherkin_keywords)
|
10
|
+
gherkin_keywords.reject { |kw| kw == '* ' }.map { |kw| code_keyword_for(kw) }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'gherkin3/token_scanner'
|
2
|
+
require 'gherkin3/token_matcher'
|
3
|
+
require 'gherkin3/ast_builder'
|
4
|
+
require 'gherkin3/parser'
|
5
|
+
|
6
|
+
module Cucumber
|
7
|
+
module Gherkin
|
8
|
+
class StepsParser
|
9
|
+
def initialize(builder, language)
|
10
|
+
@builder = builder
|
11
|
+
@language = language
|
12
|
+
end
|
13
|
+
def parse(text)
|
14
|
+
ast_builder = ::Gherkin3::AstBuilder.new
|
15
|
+
token_matcher = ::Gherkin3::TokenMatcher.new
|
16
|
+
token_matcher.send(:change_dialect, @language, nil) unless @language == 'en'
|
17
|
+
context = ::Gherkin3::ParserContext.new(
|
18
|
+
::Gherkin3::TokenScanner.new(text),
|
19
|
+
token_matcher,
|
20
|
+
[],
|
21
|
+
[]
|
22
|
+
)
|
23
|
+
parser = ::Gherkin3::Parser.new(ast_builder)
|
24
|
+
|
25
|
+
parser.start_rule(context, :ScenarioDefinition)
|
26
|
+
parser.start_rule(context, :Scenario)
|
27
|
+
scenario = ast_builder.current_node
|
28
|
+
state = 12
|
29
|
+
token = nil
|
30
|
+
begin
|
31
|
+
token = parser.read_token(context)
|
32
|
+
state = parser.match_token(state, token, context)
|
33
|
+
end until(token.eof?)
|
34
|
+
|
35
|
+
raise CompositeParserException.new(context.errors) if context.errors.any?
|
36
|
+
|
37
|
+
@builder.steps(ast_builder.get_steps(scenario))
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -5,7 +5,8 @@ module Cucumber
|
|
5
5
|
module LanguageSupport
|
6
6
|
module LanguageMethods
|
7
7
|
|
8
|
-
def after_configuration(
|
8
|
+
def after_configuration(cli_configuration)
|
9
|
+
configuration = Configuration.new(cli_configuration)
|
9
10
|
hooks[:after_configuration].each do |hook|
|
10
11
|
hook.invoke('AfterConfiguration', configuration)
|
11
12
|
end
|
@@ -40,12 +41,12 @@ module Cucumber
|
|
40
41
|
available_step_definition_hash.keys - invoked_step_definition_hash.keys
|
41
42
|
end
|
42
43
|
|
43
|
-
def available_step_definition(regexp_source,
|
44
|
-
available_step_definition_hash[StepDefinitionLight.new(regexp_source,
|
44
|
+
def available_step_definition(regexp_source, location)
|
45
|
+
available_step_definition_hash[StepDefinitionLight.new(regexp_source, location)] = nil
|
45
46
|
end
|
46
47
|
|
47
|
-
def invoked_step_definition(regexp_source,
|
48
|
-
invoked_step_definition_hash[StepDefinitionLight.new(regexp_source,
|
48
|
+
def invoked_step_definition(regexp_source, location)
|
49
|
+
invoked_step_definition_hash[StepDefinitionLight.new(regexp_source, location)] = nil
|
49
50
|
end
|
50
51
|
|
51
52
|
private
|
@@ -1,11 +1,9 @@
|
|
1
1
|
require 'delegate'
|
2
2
|
require 'cucumber/multiline_argument/data_table'
|
3
3
|
require 'cucumber/multiline_argument/doc_string'
|
4
|
-
require 'gherkin/rubify'
|
5
4
|
|
6
5
|
module Cucumber
|
7
6
|
module MultilineArgument
|
8
|
-
extend Gherkin::Rubify
|
9
7
|
|
10
8
|
class << self
|
11
9
|
def from_core(node)
|
@@ -14,7 +12,6 @@ module Cucumber
|
|
14
12
|
|
15
13
|
def from(argument, location=nil)
|
16
14
|
location ||= Core::Ast::Location.of_caller
|
17
|
-
argument = rubify(argument)
|
18
15
|
case argument
|
19
16
|
when String
|
20
17
|
doc_string(argument, 'text/plain', location)
|