cucumber 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.rvmrc +1 -1
- data/.travis.yml +3 -2
- data/DEVELOPERS.md +48 -0
- data/History.md +22 -3
- data/README.md +13 -31
- data/Rakefile +1 -0
- data/cucumber.gemspec +18 -17
- data/cucumber.yml +3 -2
- data/examples/i18n/cs/Rakefile +6 -0
- data/examples/i18n/cs/features/addition.feature +17 -0
- data/examples/i18n/cs/features/division.feature +11 -0
- data/examples/i18n/cs/features/step_definitons/calculator_steps.rb +24 -0
- data/examples/i18n/cs/lib/calculator.rb +14 -0
- data/examples/i18n/hi/Rakefile +6 -0
- data/examples/i18n/hi/features/addition.feature +16 -0
- data/examples/i18n/hi/features/division.feature +10 -0
- data/examples/i18n/hi/features/step_definitons/calculator_steps.rb +24 -0
- data/examples/i18n/hi/lib/calculator.rb +15 -0
- data/examples/python/README.textile +2 -1
- data/examples/ruby2python/README.textile +2 -1
- data/features/.cucumber/stepdefs.json +1688 -445
- data/features/assertions.feature +69 -0
- data/features/formatter_callbacks.feature +189 -0
- data/features/html_formatter.feature +19 -0
- data/features/json_formatter.feature +8 -4
- data/features/nested_steps_with_second_arg.feature +73 -0
- data/features/step_definitions.feature +65 -0
- data/features/step_definitions/cucumber_steps.rb +18 -3
- data/fixtures/self_test/features/support/env.rb +1 -1
- data/gem_tasks/cucumber.rake +5 -3
- data/gem_tasks/downloads.rb +3 -3
- data/gem_tasks/stats +4 -2
- data/gem_tasks/yard.rake +31 -13
- data/legacy_features/default_snippets.feature +3 -3
- data/legacy_features/language_help.feature +4 -0
- data/legacy_features/report_called_undefined_steps.feature +1 -1
- data/legacy_features/snippet.feature +3 -3
- data/legacy_features/snippets_when_using_star_keyword.feature +1 -1
- data/legacy_features/step_definitions/cucumber_steps.rb +4 -3
- data/legacy_features/support/env.rb +1 -1
- data/legacy_features/support/fake_wire_server.rb +9 -9
- data/lib/autotest/cucumber_mixin.rb +14 -14
- data/lib/autotest/discover.rb +2 -0
- data/lib/cucumber.rb +2 -2
- data/lib/cucumber/ast.rb +1 -1
- data/lib/cucumber/ast/background.rb +11 -7
- data/lib/cucumber/ast/comment.rb +2 -2
- data/lib/cucumber/ast/doc_string.rb +1 -1
- data/lib/cucumber/ast/examples.rb +1 -1
- data/lib/cucumber/ast/feature.rb +2 -2
- data/lib/cucumber/ast/feature_element.rb +1 -1
- data/lib/cucumber/ast/multiline_argument.rb +2 -2
- data/lib/cucumber/ast/names.rb +2 -2
- data/lib/cucumber/ast/outline_table.rb +4 -5
- data/lib/cucumber/ast/scenario.rb +14 -14
- data/lib/cucumber/ast/scenario_outline.rb +4 -4
- data/lib/cucumber/ast/step.rb +3 -3
- data/lib/cucumber/ast/step_collection.rb +5 -5
- data/lib/cucumber/ast/step_invocation.rb +8 -8
- data/lib/cucumber/ast/table.rb +40 -27
- data/lib/cucumber/ast/tree_walker.rb +9 -8
- data/lib/cucumber/ast/visitor.rb +1 -1
- data/lib/cucumber/cli/configuration.rb +10 -10
- data/lib/cucumber/cli/drb_client.rb +1 -1
- data/lib/cucumber/cli/main.rb +3 -3
- data/lib/cucumber/cli/options.rb +3 -2
- data/lib/cucumber/cli/profile_loader.rb +1 -1
- data/lib/cucumber/configuration.rb +12 -12
- data/lib/cucumber/constantize.rb +11 -2
- data/lib/cucumber/core_ext/disable_mini_and_test_unit_autorun.rb +1 -1
- data/lib/cucumber/core_ext/instance_exec.rb +4 -4
- data/lib/cucumber/core_ext/proc.rb +3 -3
- data/lib/cucumber/errors.rb +1 -1
- data/lib/cucumber/feature_file.rb +1 -1
- data/lib/cucumber/formatter/ansicolor.rb +36 -23
- data/lib/cucumber/formatter/console.rb +45 -25
- data/lib/cucumber/formatter/debug.rb +7 -7
- data/lib/cucumber/formatter/duration.rb +1 -1
- data/lib/cucumber/formatter/gherkin_formatter_adapter.rb +7 -0
- data/lib/cucumber/formatter/gpretty.rb +1 -1
- data/lib/cucumber/formatter/html.rb +52 -53
- data/lib/cucumber/formatter/interceptor.rb +2 -2
- data/lib/cucumber/formatter/json.rb +1 -1
- data/lib/cucumber/formatter/json_pretty.rb +2 -1
- data/lib/cucumber/formatter/junit.rb +1 -1
- data/lib/cucumber/formatter/ordered_xml_markup.rb +1 -1
- data/lib/cucumber/formatter/pretty.rb +12 -12
- data/lib/cucumber/formatter/progress.rb +5 -5
- data/lib/cucumber/formatter/rerun.rb +5 -5
- data/lib/cucumber/formatter/stepdefs.rb +1 -1
- data/lib/cucumber/formatter/steps.rb +6 -6
- data/lib/cucumber/formatter/summary.rb +6 -6
- data/lib/cucumber/formatter/unicode.rb +18 -18
- data/lib/cucumber/formatter/usage.rb +7 -7
- data/lib/cucumber/js_support/js_dsl.js +1 -1
- data/lib/cucumber/language_support.rb +1 -1
- data/lib/cucumber/parser/gherkin_builder.rb +33 -33
- data/lib/cucumber/platform.rb +3 -2
- data/lib/cucumber/py_support/py_dsl.py +2 -2
- data/lib/cucumber/py_support/py_language.py +2 -2
- data/lib/cucumber/py_support/py_language.rb +2 -2
- data/lib/cucumber/rake/task.rb +4 -3
- data/lib/cucumber/rb_support/rb_dsl.rb +10 -10
- data/lib/cucumber/rb_support/rb_language.rb +27 -19
- data/lib/cucumber/rb_support/rb_step_definition.rb +39 -11
- data/lib/cucumber/rb_support/rb_transform.rb +3 -3
- data/lib/cucumber/rb_support/rb_world.rb +15 -15
- data/lib/cucumber/rb_support/regexp_argument_matcher.rb +1 -1
- data/lib/cucumber/rspec/disable_option_parser.rb +1 -1
- data/lib/cucumber/rspec/doubles.rb +1 -1
- data/lib/cucumber/runtime.rb +11 -10
- data/lib/cucumber/runtime/features_loader.rb +6 -6
- data/lib/cucumber/runtime/for_programming_languages.rb +8 -15
- data/lib/cucumber/runtime/results.rb +6 -6
- data/lib/cucumber/runtime/support_code.rb +37 -28
- data/lib/cucumber/runtime/user_interface.rb +4 -4
- data/lib/cucumber/step_definition_light.rb +4 -4
- data/lib/cucumber/step_definitions.rb +2 -3
- data/lib/cucumber/step_match.rb +6 -6
- data/lib/cucumber/step_mother.rb +1 -1
- data/lib/cucumber/term/ansicolor.rb +22 -22
- data/lib/cucumber/wire_support/configuration.rb +11 -14
- data/lib/cucumber/wire_support/connection.rb +10 -9
- data/lib/cucumber/wire_support/request_handler.rb +3 -3
- data/lib/cucumber/wire_support/wire_exception.rb +3 -3
- data/lib/cucumber/wire_support/wire_language.rb +11 -11
- data/lib/cucumber/wire_support/wire_packet.rb +7 -5
- data/lib/cucumber/wire_support/wire_protocol.rb +6 -6
- data/lib/cucumber/wire_support/wire_protocol/requests.rb +20 -20
- data/lib/cucumber/wire_support/wire_step_definition.rb +4 -4
- data/spec/cucumber/ast/background_spec.rb +4 -4
- data/spec/cucumber/ast/doc_string_spec.rb +8 -8
- data/spec/cucumber/ast/feature_factory.rb +4 -4
- data/spec/cucumber/ast/feature_spec.rb +18 -18
- data/spec/cucumber/ast/outline_table_spec.rb +3 -3
- data/spec/cucumber/ast/step_spec.rb +4 -4
- data/spec/cucumber/ast/table_spec.rb +50 -29
- data/spec/cucumber/ast/tree_walker_spec.rb +12 -4
- data/spec/cucumber/broadcaster_spec.rb +1 -1
- data/spec/cucumber/cli/configuration_spec.rb +10 -4
- data/spec/cucumber/cli/drb_client_spec.rb +1 -1
- data/spec/cucumber/cli/main_spec.rb +28 -7
- data/spec/cucumber/cli/options_spec.rb +3 -3
- data/spec/cucumber/configuration_spec.rb +4 -4
- data/spec/cucumber/constantize_spec.rb +2 -0
- data/spec/cucumber/core_ext/proc_spec.rb +7 -7
- data/spec/cucumber/formatter/ansicolor_spec.rb +2 -2
- data/spec/cucumber/formatter/duration_spec.rb +2 -2
- data/spec/cucumber/formatter/html_spec.rb +31 -31
- data/spec/cucumber/formatter/interceptor_spec.rb +10 -0
- data/spec/cucumber/formatter/progress_spec.rb +1 -1
- data/spec/cucumber/formatter/spec_helper.rb +7 -7
- data/spec/cucumber/rake/forked_spec.rb +15 -2
- data/spec/cucumber/rake/rcov_spec.rb +2 -2
- data/spec/cucumber/rb_support/rb_language_spec.rb +34 -17
- data/spec/cucumber/rb_support/rb_step_definition_spec.rb +45 -35
- data/spec/cucumber/rb_support/rb_transform_spec.rb +3 -3
- data/spec/cucumber/runtime/for_programming_languages_spec.rb +31 -0
- data/spec/cucumber/runtime/results_spec.rb +5 -5
- data/spec/cucumber/runtime/support_code_spec.rb +13 -2
- data/spec/cucumber/runtime_spec.rb +7 -7
- data/spec/cucumber/step_match_spec.rb +2 -2
- data/spec/cucumber/wire_support/configuration_spec.rb +16 -6
- data/spec/cucumber/wire_support/connection_spec.rb +25 -11
- data/spec/cucumber/wire_support/wire_exception_spec.rb +3 -3
- data/spec/cucumber/wire_support/wire_language_spec.rb +3 -3
- data/spec/cucumber/wire_support/wire_packet_spec.rb +4 -4
- data/spec/cucumber/wire_support/wire_step_definition_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -2
- metadata +98 -128
- data/legacy_features/html_formatter.feature +0 -8
- data/legacy_features/html_formatter/a.html +0 -561
data/lib/cucumber/runtime.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'fileutils'
|
2
|
+
require 'multi_json'
|
2
3
|
require 'gherkin/rubify'
|
3
4
|
require 'gherkin/i18n'
|
4
5
|
require 'cucumber/configuration'
|
@@ -13,7 +14,7 @@ module Cucumber
|
|
13
14
|
# This is the meaty part of Cucumber that ties everything together.
|
14
15
|
class Runtime
|
15
16
|
attr_reader :results
|
16
|
-
|
17
|
+
|
17
18
|
include Formatter::Duration
|
18
19
|
include Runtime::UserInterface
|
19
20
|
|
@@ -24,28 +25,28 @@ module Cucumber
|
|
24
25
|
@support_code = SupportCode.new(self, @configuration)
|
25
26
|
@results = Results.new(@configuration)
|
26
27
|
end
|
27
|
-
|
28
|
+
|
28
29
|
# Allows you to take an existing runtime and change it's configuration
|
29
30
|
def configure(new_configuration)
|
30
31
|
@configuration = Configuration.parse(new_configuration)
|
31
32
|
@support_code.configure(@configuration)
|
32
33
|
@results.configure(@configuration)
|
33
34
|
end
|
34
|
-
|
35
|
+
|
35
36
|
def load_programming_language(language)
|
36
37
|
@support_code.load_programming_language(language)
|
37
38
|
end
|
38
|
-
|
39
|
+
|
39
40
|
def run!
|
40
41
|
load_step_definitions
|
41
42
|
fire_after_configuration_hook
|
42
43
|
|
43
44
|
tree_walker = @configuration.build_tree_walker(self)
|
44
45
|
self.visitor = tree_walker # Ugly circular dependency, but needed to support World#puts
|
45
|
-
|
46
|
+
|
46
47
|
tree_walker.visit_features(features)
|
47
48
|
end
|
48
|
-
|
49
|
+
|
49
50
|
def features_paths
|
50
51
|
@configuration.paths
|
51
52
|
end
|
@@ -151,7 +152,7 @@ module Cucumber
|
|
151
152
|
FileUtils.mkdir_p(@configuration.dotcucumber)
|
152
153
|
end
|
153
154
|
File.open(File.join(@configuration.dotcucumber, 'stepdefs.json'), 'w') do |io|
|
154
|
-
io.write(
|
155
|
+
io.write(MultiJson.dump(stepdefs, :pretty => true))
|
155
156
|
end
|
156
157
|
end
|
157
158
|
end
|
@@ -164,8 +165,8 @@ module Cucumber
|
|
164
165
|
|
165
166
|
def features
|
166
167
|
@loader ||= Runtime::FeaturesLoader.new(
|
167
|
-
@configuration.feature_files,
|
168
|
-
@configuration.filters,
|
168
|
+
@configuration.feature_files,
|
169
|
+
@configuration.filters,
|
169
170
|
@configuration.tag_expression)
|
170
171
|
@loader.features
|
171
172
|
end
|
@@ -180,4 +181,4 @@ module Cucumber
|
|
180
181
|
end
|
181
182
|
end
|
182
183
|
|
183
|
-
end
|
184
|
+
end
|
@@ -2,21 +2,21 @@ require 'cucumber/errors'
|
|
2
2
|
|
3
3
|
module Cucumber
|
4
4
|
class Runtime
|
5
|
-
|
5
|
+
|
6
6
|
class FeaturesLoader
|
7
7
|
include Formatter::Duration
|
8
8
|
|
9
9
|
def initialize(feature_files, filters, tag_expression)
|
10
10
|
@feature_files, @filters, @tag_expression = feature_files, filters, tag_expression
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
def features
|
14
|
-
load unless @features
|
14
|
+
load unless (defined? @features) and @features
|
15
15
|
@features
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
private
|
19
|
-
|
19
|
+
|
20
20
|
def load
|
21
21
|
features = Ast::Features.new
|
22
22
|
|
@@ -52,7 +52,7 @@ module Cucumber
|
|
52
52
|
end
|
53
53
|
raise TagExcess.new(error_messages) if error_messages.any?
|
54
54
|
end
|
55
|
-
|
55
|
+
|
56
56
|
def log
|
57
57
|
Cucumber.logger
|
58
58
|
end
|
@@ -3,12 +3,12 @@ require 'forwardable'
|
|
3
3
|
module Cucumber
|
4
4
|
class Runtime
|
5
5
|
# This is what a programming language will consider to be a runtime.
|
6
|
-
#
|
6
|
+
#
|
7
7
|
# It's a thin class that directs the handul of methods needed by the
|
8
8
|
# programming languages to the right place.
|
9
9
|
class ForProgrammingLanguages
|
10
10
|
extend Forwardable
|
11
|
-
|
11
|
+
|
12
12
|
def initialize(support_code, user_interface)
|
13
13
|
@support_code, @user_interface = support_code, user_interface
|
14
14
|
end
|
@@ -19,12 +19,12 @@ module Cucumber
|
|
19
19
|
:puts,
|
20
20
|
:features_paths,
|
21
21
|
:step_match
|
22
|
-
|
22
|
+
|
23
23
|
def_delegators :@support_code,
|
24
24
|
:invoke_steps,
|
25
25
|
:invoke,
|
26
26
|
:load_programming_language
|
27
|
-
|
27
|
+
|
28
28
|
# Returns a Cucumber::Ast::Table for +text_or_table+, which can either
|
29
29
|
# be a String:
|
30
30
|
#
|
@@ -50,18 +50,11 @@ module Cucumber
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
# Returns
|
54
|
-
#
|
55
|
-
# """
|
56
|
-
# hello
|
57
|
-
# world
|
58
|
-
# """
|
59
|
-
#
|
60
|
-
# Is retured as: " hello\nworld"
|
53
|
+
# Returns Ast::DocString for +string_without_triple_quotes+.
|
61
54
|
#
|
62
|
-
def doc_string(
|
63
|
-
Ast::DocString.
|
55
|
+
def doc_string(string_without_triple_quotes, content_type='', line_offset=0)
|
56
|
+
Ast::DocString.new(string_without_triple_quotes,content_type)
|
64
57
|
end
|
65
58
|
end
|
66
59
|
end
|
67
|
-
end
|
60
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Cucumber
|
2
2
|
class Runtime
|
3
|
-
|
3
|
+
|
4
4
|
class Results
|
5
5
|
def initialize(configuration)
|
6
6
|
@configuration = configuration
|
@@ -22,7 +22,7 @@ module Cucumber
|
|
22
22
|
steps.push(step)
|
23
23
|
end
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
def scenario_visited(scenario) #:nodoc:
|
27
27
|
scenario_id = scenario.object_id
|
28
28
|
|
@@ -31,7 +31,7 @@ module Cucumber
|
|
31
31
|
scenarios.push(scenario)
|
32
32
|
end
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
def steps(status = nil) #:nodoc:
|
36
36
|
@steps ||= []
|
37
37
|
if(status)
|
@@ -40,7 +40,7 @@ module Cucumber
|
|
40
40
|
@steps
|
41
41
|
end
|
42
42
|
end
|
43
|
-
|
43
|
+
|
44
44
|
def scenarios(status = nil) #:nodoc:
|
45
45
|
@scenarios ||= []
|
46
46
|
if(status)
|
@@ -49,7 +49,7 @@ module Cucumber
|
|
49
49
|
@scenarios
|
50
50
|
end
|
51
51
|
end
|
52
|
-
|
52
|
+
|
53
53
|
def failure?
|
54
54
|
if @configuration.wip?
|
55
55
|
scenarios(:passed).any?
|
@@ -59,6 +59,6 @@ module Cucumber
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
62
|
-
|
62
|
+
|
63
63
|
end
|
64
64
|
end
|
@@ -5,9 +5,9 @@ require 'cucumber/runtime/for_programming_languages'
|
|
5
5
|
module Cucumber
|
6
6
|
|
7
7
|
class Runtime
|
8
|
-
|
8
|
+
|
9
9
|
class SupportCode
|
10
|
-
|
10
|
+
|
11
11
|
require 'forwardable'
|
12
12
|
class StepInvoker
|
13
13
|
include Gherkin::Rubify
|
@@ -20,15 +20,15 @@ module Cucumber
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def step(step)
|
23
|
-
@support_code.invoke(step.name, Ast::MultilineArgument.from(step.doc_string || step.rows))
|
23
|
+
@support_code.invoke(step.name, Ast::MultilineArgument.from(step.doc_string || step.rows))
|
24
24
|
end
|
25
25
|
|
26
26
|
def eof
|
27
27
|
end
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
include Constantize
|
31
|
-
|
31
|
+
|
32
32
|
def initialize(user_interface, configuration={})
|
33
33
|
@configuration = Configuration.parse(configuration)
|
34
34
|
@runtime_facade = Runtime::ForProgrammingLanguages.new(self, user_interface)
|
@@ -36,11 +36,11 @@ module Cucumber
|
|
36
36
|
@programming_languages = []
|
37
37
|
@language_map = {}
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
def configure(new_configuration)
|
41
41
|
@configuration = Configuration.parse(new_configuration)
|
42
42
|
end
|
43
|
-
|
43
|
+
|
44
44
|
# Invokes a series of steps +steps_text+. Example:
|
45
45
|
#
|
46
46
|
# invoke(%Q{
|
@@ -55,7 +55,7 @@ module Cucumber
|
|
55
55
|
|
56
56
|
def invoke(step_name, multiline_argument=nil)
|
57
57
|
multiline_argument = Cucumber::Ast::MultilineArgument.from(multiline_argument)
|
58
|
-
# It is very important to leave multiline_argument=nil as a vararg. Cuke4Duke needs it that way.
|
58
|
+
# It is very important to leave multiline_argument=nil as a vararg. Cuke4Duke needs it that way.
|
59
59
|
begin
|
60
60
|
step_match(step_name).invoke(multiline_argument)
|
61
61
|
rescue Exception => e
|
@@ -63,7 +63,7 @@ module Cucumber
|
|
63
63
|
raise e
|
64
64
|
end
|
65
65
|
end
|
66
|
-
|
66
|
+
|
67
67
|
# Loads and registers programming language implementation.
|
68
68
|
# Instances are cached, so calling with the same argument
|
69
69
|
# twice will return the same instance.
|
@@ -76,7 +76,7 @@ module Cucumber
|
|
76
76
|
@language_map[ext] = programming_language
|
77
77
|
programming_language
|
78
78
|
end
|
79
|
-
|
79
|
+
|
80
80
|
def load_files!(files)
|
81
81
|
log.debug("Code:\n")
|
82
82
|
files.each do |file|
|
@@ -84,14 +84,14 @@ module Cucumber
|
|
84
84
|
end
|
85
85
|
log.debug("\n")
|
86
86
|
end
|
87
|
-
|
87
|
+
|
88
88
|
def load_files_from_paths(paths)
|
89
89
|
files = paths.map { |path| Dir["#{path}/**/*"] }.flatten
|
90
90
|
load_files! files
|
91
91
|
end
|
92
|
-
|
92
|
+
|
93
93
|
def unmatched_step_definitions
|
94
|
-
@programming_languages.map do |programming_language|
|
94
|
+
@programming_languages.map do |programming_language|
|
95
95
|
programming_language.unmatched_step_definitions
|
96
96
|
end.flatten
|
97
97
|
end
|
@@ -102,17 +102,17 @@ module Cucumber
|
|
102
102
|
programming_language.snippet_text(step_keyword, step_name, multiline_arg_class)
|
103
103
|
end.join("\n")
|
104
104
|
end
|
105
|
-
|
105
|
+
|
106
106
|
def unknown_programming_language?
|
107
107
|
@programming_languages.empty?
|
108
108
|
end
|
109
|
-
|
109
|
+
|
110
110
|
def fire_hook(name, *args)
|
111
111
|
@programming_languages.each do |programming_language|
|
112
112
|
programming_language.send(name, *args)
|
113
113
|
end
|
114
114
|
end
|
115
|
-
|
115
|
+
|
116
116
|
def around(scenario, block)
|
117
117
|
@programming_languages.reverse.inject(block) do |blk, programming_language|
|
118
118
|
proc do
|
@@ -122,29 +122,38 @@ module Cucumber
|
|
122
122
|
end
|
123
123
|
end.call
|
124
124
|
end
|
125
|
-
|
125
|
+
|
126
126
|
def step_definitions
|
127
127
|
@programming_languages.map do |programming_language|
|
128
128
|
programming_language.step_definitions
|
129
129
|
end.flatten
|
130
130
|
end
|
131
|
-
|
131
|
+
|
132
132
|
def step_match(step_name, name_to_report=nil) #:nodoc:
|
133
|
+
@match_cache ||= {}
|
134
|
+
|
135
|
+
match = @match_cache[[step_name, name_to_report]]
|
136
|
+
return match if match
|
137
|
+
|
138
|
+
@match_cache[[step_name, name_to_report]] = step_match_without_cache(step_name, name_to_report)
|
139
|
+
end
|
140
|
+
|
141
|
+
private
|
142
|
+
|
143
|
+
def step_match_without_cache(step_name, name_to_report=nil)
|
133
144
|
matches = matches(step_name, name_to_report)
|
134
145
|
raise Undefined.new(step_name) if matches.empty?
|
135
146
|
matches = best_matches(step_name, matches) if matches.size > 1 && guess_step_matches?
|
136
147
|
raise Ambiguous.new(step_name, matches, guess_step_matches?) if matches.size > 1
|
137
148
|
matches[0]
|
138
149
|
end
|
139
|
-
|
140
|
-
private
|
141
|
-
|
150
|
+
|
142
151
|
def guess_step_matches?
|
143
152
|
@configuration.guess?
|
144
153
|
end
|
145
|
-
|
154
|
+
|
146
155
|
def matches(step_name, name_to_report)
|
147
|
-
@programming_languages.map do |programming_language|
|
156
|
+
@programming_languages.map do |programming_language|
|
148
157
|
programming_language.step_matches(step_name, name_to_report).to_a
|
149
158
|
end.flatten
|
150
159
|
end
|
@@ -164,7 +173,7 @@ module Cucumber
|
|
164
173
|
top_groups
|
165
174
|
end
|
166
175
|
end
|
167
|
-
|
176
|
+
|
168
177
|
def load_file(file)
|
169
178
|
if programming_language = programming_language_for(file)
|
170
179
|
log.debug(" * #{file}\n")
|
@@ -173,11 +182,11 @@ module Cucumber
|
|
173
182
|
log.debug(" * #{file} [NOT SUPPORTED]\n")
|
174
183
|
end
|
175
184
|
end
|
176
|
-
|
185
|
+
|
177
186
|
def log
|
178
187
|
Cucumber.logger
|
179
188
|
end
|
180
|
-
|
189
|
+
|
181
190
|
def programming_language_for(step_def_file)
|
182
191
|
if ext = File.extname(step_def_file)[1..-1]
|
183
192
|
return nil if @unsupported_programming_languages.index(ext)
|
@@ -192,7 +201,7 @@ module Cucumber
|
|
192
201
|
nil
|
193
202
|
end
|
194
203
|
end
|
195
|
-
|
204
|
+
|
196
205
|
end
|
197
206
|
end
|
198
|
-
end
|
207
|
+
end
|
@@ -47,7 +47,7 @@ module Cucumber
|
|
47
47
|
end
|
48
48
|
|
49
49
|
# Embed +src+ of MIME type +mime_type+ into the output. The +src+ argument may
|
50
|
-
# be a path to a file, or if it's an image it may also be a Base64 encoded image.
|
50
|
+
# be a path to a file, or if it's an image it may also be a Base64 encoded image.
|
51
51
|
# The embedded data may or may not be ignored, depending on what kind of formatter(s) are active.
|
52
52
|
#
|
53
53
|
def embed(src, mime_type, label)
|
@@ -55,13 +55,13 @@ module Cucumber
|
|
55
55
|
end
|
56
56
|
|
57
57
|
private
|
58
|
-
|
58
|
+
|
59
59
|
def mri_gets(timeout_seconds)
|
60
60
|
begin
|
61
61
|
Timeout.timeout(timeout_seconds) do
|
62
62
|
STDIN.gets
|
63
63
|
end
|
64
|
-
rescue Timeout::Error
|
64
|
+
rescue Timeout::Error
|
65
65
|
nil
|
66
66
|
end
|
67
67
|
end
|
@@ -76,6 +76,6 @@ module Cucumber
|
|
76
76
|
answer
|
77
77
|
end
|
78
78
|
end
|
79
|
-
|
79
|
+
|
80
80
|
end
|
81
81
|
end
|
@@ -4,17 +4,17 @@ module Cucumber
|
|
4
4
|
# Used for reporting purposes only (usage formatter).
|
5
5
|
class StepDefinitionLight
|
6
6
|
attr_reader :regexp_source, :file_colon_line
|
7
|
-
|
7
|
+
|
8
8
|
def initialize(regexp_source, file_colon_line)
|
9
9
|
@regexp_source, @file_colon_line = regexp_source, file_colon_line
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
def eql?(o)
|
13
13
|
regexp_source == o.regexp_source && file_colon_line == o.file_colon_line
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
def hash
|
17
17
|
regexp_source.hash + 31*file_colon_line.hash
|
18
18
|
end
|
19
19
|
end
|
20
|
-
end
|
20
|
+
end
|