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
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'json'
|
2
1
|
module Cucumber
|
3
2
|
class StepDefinitions
|
4
3
|
def initialize(configuration = Configuration.default)
|
@@ -6,9 +5,9 @@ module Cucumber
|
|
6
5
|
@support_code = Runtime::SupportCode.new(nil, false)
|
7
6
|
@support_code.load_files_from_paths(configuration.autoload_code_paths)
|
8
7
|
end
|
9
|
-
|
8
|
+
|
10
9
|
def to_json
|
11
10
|
@support_code.step_definitions.map{|stepdef| stepdef.to_hash}.to_json
|
12
11
|
end
|
13
12
|
end
|
14
|
-
end
|
13
|
+
end
|
data/lib/cucumber/step_match.rb
CHANGED
@@ -2,9 +2,9 @@ module Cucumber
|
|
2
2
|
class StepMatch #:nodoc:
|
3
3
|
attr_reader :step_definition, :step_arguments
|
4
4
|
|
5
|
-
# Creates a new StepMatch. The +name_to_report+ argument is what's
|
6
|
-
# in which case +name_to_report+ is used instead.
|
7
|
-
#
|
5
|
+
# Creates a new StepMatch. The +name_to_report+ argument is what's
|
6
|
+
# reported, unless it's is, in which case +name_to_report+ is used instead.
|
7
|
+
#
|
8
8
|
def initialize(step_definition, name_to_match, name_to_report, step_arguments)
|
9
9
|
raise "name_to_match can't be nil" if name_to_match.nil?
|
10
10
|
raise "step_arguments can't be nil (but it can be an empty array)" if step_arguments.nil?
|
@@ -61,7 +61,7 @@ module Cucumber
|
|
61
61
|
offset = past_offset = 0
|
62
62
|
step_arguments.each do |step_argument|
|
63
63
|
next if step_argument.offset.nil? || step_argument.offset < past_offset
|
64
|
-
|
64
|
+
|
65
65
|
replacement = if block_given?
|
66
66
|
proc.call(step_argument.val)
|
67
67
|
elsif Proc === format
|
@@ -81,7 +81,7 @@ module Cucumber
|
|
81
81
|
sprintf("#<%s:0x%x>", self.class, self.object_id)
|
82
82
|
end
|
83
83
|
end
|
84
|
-
|
84
|
+
|
85
85
|
class NoStepMatch #:nodoc:
|
86
86
|
attr_reader :step_definition, :name
|
87
87
|
|
@@ -89,7 +89,7 @@ module Cucumber
|
|
89
89
|
@step = step
|
90
90
|
@name = name
|
91
91
|
end
|
92
|
-
|
92
|
+
|
93
93
|
def format_args(format)
|
94
94
|
@name
|
95
95
|
end
|
data/lib/cucumber/step_mother.rb
CHANGED
@@ -5,34 +5,34 @@ module Cucumber
|
|
5
5
|
module ANSIColor
|
6
6
|
# :stopdoc:
|
7
7
|
ATTRIBUTES = [
|
8
|
-
[ :clear , 0 ],
|
8
|
+
[ :clear , 0 ],
|
9
9
|
[ :reset , 0 ], # synonym for :clear
|
10
|
-
[ :bold , 1 ],
|
11
|
-
[ :dark , 2 ],
|
10
|
+
[ :bold , 1 ],
|
11
|
+
[ :dark , 2 ],
|
12
12
|
[ :italic , 3 ], # not widely implemented
|
13
|
-
[ :underline , 4 ],
|
13
|
+
[ :underline , 4 ],
|
14
14
|
[ :underscore , 4 ], # synonym for :underline
|
15
|
-
[ :blink , 5 ],
|
15
|
+
[ :blink , 5 ],
|
16
16
|
[ :rapid_blink , 6 ], # not widely implemented
|
17
17
|
[ :negative , 7 ], # no reverse because of String#reverse
|
18
|
-
[ :concealed , 8 ],
|
18
|
+
[ :concealed , 8 ],
|
19
19
|
[ :strikethrough, 9 ], # not widely implemented
|
20
|
-
[ :black , 30 ],
|
21
|
-
[ :red , 31 ],
|
22
|
-
[ :green , 32 ],
|
23
|
-
[ :yellow , 33 ],
|
24
|
-
[ :blue , 34 ],
|
25
|
-
[ :magenta , 35 ],
|
26
|
-
[ :cyan , 36 ],
|
27
|
-
[ :white , 37 ],
|
28
|
-
[ :on_black , 40 ],
|
29
|
-
[ :on_red , 41 ],
|
30
|
-
[ :on_green , 42 ],
|
31
|
-
[ :on_yellow , 43 ],
|
32
|
-
[ :on_blue , 44 ],
|
33
|
-
[ :on_magenta , 45 ],
|
34
|
-
[ :on_cyan , 46 ],
|
35
|
-
[ :on_white , 47 ],
|
20
|
+
[ :black , 30 ],
|
21
|
+
[ :red , 31 ],
|
22
|
+
[ :green , 32 ],
|
23
|
+
[ :yellow , 33 ],
|
24
|
+
[ :blue , 34 ],
|
25
|
+
[ :magenta , 35 ],
|
26
|
+
[ :cyan , 36 ],
|
27
|
+
[ :white , 37 ],
|
28
|
+
[ :on_black , 40 ],
|
29
|
+
[ :on_red , 41 ],
|
30
|
+
[ :on_green , 42 ],
|
31
|
+
[ :on_yellow , 43 ],
|
32
|
+
[ :on_blue , 44 ],
|
33
|
+
[ :on_magenta , 45 ],
|
34
|
+
[ :on_cyan , 46 ],
|
35
|
+
[ :on_white , 47 ],
|
36
36
|
]
|
37
37
|
|
38
38
|
ATTRIBUTE_NAMES = ATTRIBUTES.transpose.first
|
@@ -5,27 +5,24 @@ module Cucumber
|
|
5
5
|
module WireSupport
|
6
6
|
class Configuration
|
7
7
|
attr_reader :host, :port
|
8
|
-
|
8
|
+
|
9
9
|
def initialize(wire_file)
|
10
10
|
params = YAML.load(ERB.new(File.read(wire_file)).result)
|
11
11
|
@host = params['host']
|
12
12
|
@port = params['port']
|
13
|
-
@timeouts =
|
13
|
+
@timeouts = DEFAULT_TIMEOUTS.merge(params['timeout'] || {})
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
def timeout(message = nil)
|
17
17
|
return @timeouts[message.to_s] || 3
|
18
18
|
end
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
'end_scenario' => 120
|
27
|
-
}
|
28
|
-
end
|
19
|
+
|
20
|
+
DEFAULT_TIMEOUTS = {
|
21
|
+
'connect' => 11,
|
22
|
+
'invoke' => 120,
|
23
|
+
'begin_scenario' => 120,
|
24
|
+
'end_scenario' => 120
|
25
|
+
}
|
29
26
|
end
|
30
27
|
end
|
31
|
-
end
|
28
|
+
end
|
@@ -5,13 +5,13 @@ module Cucumber
|
|
5
5
|
module WireSupport
|
6
6
|
class Connection
|
7
7
|
class ConnectionError < StandardError; end
|
8
|
-
|
8
|
+
|
9
9
|
include WireProtocol
|
10
|
-
|
10
|
+
|
11
11
|
def initialize(config)
|
12
12
|
@config = config
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
def call_remote(request_handler, message, params)
|
16
16
|
packet = WirePacket.new(message, params)
|
17
17
|
|
@@ -24,27 +24,28 @@ module Cucumber
|
|
24
24
|
raise Timeout::Error, "Timed out calling wire server with message '#{message}'", backtrace
|
25
25
|
end
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
def exception(params)
|
29
29
|
WireException.new(params, @config.host, @config.port)
|
30
30
|
end
|
31
31
|
|
32
32
|
private
|
33
|
-
|
33
|
+
|
34
34
|
def send_data_to_socket(data)
|
35
|
-
Timeout.timeout(@config.timeout) { socket.puts(data) }
|
35
|
+
Timeout.timeout(@config.timeout('connect')) { socket.puts(data) }
|
36
36
|
end
|
37
37
|
|
38
38
|
def fetch_data_from_socket(timeout)
|
39
|
-
raw_response =
|
39
|
+
raw_response =
|
40
40
|
if timeout == :never
|
41
41
|
socket.gets
|
42
42
|
else
|
43
43
|
Timeout.timeout(timeout) { socket.gets }
|
44
44
|
end
|
45
|
+
raise exception({'message' => "Remote Socket with #{@config.host}:#{@config.port} closed."}) if raw_response.nil?
|
45
46
|
WirePacket.parse(raw_response)
|
46
47
|
end
|
47
|
-
|
48
|
+
|
48
49
|
def socket
|
49
50
|
@socket ||= TCPSocket.new(@config.host, @config.port)
|
50
51
|
rescue Errno::ECONNREFUSED => exception
|
@@ -52,4 +53,4 @@ module Cucumber
|
|
52
53
|
end
|
53
54
|
end
|
54
55
|
end
|
55
|
-
end
|
56
|
+
end
|
@@ -13,12 +13,12 @@ module Cucumber
|
|
13
13
|
def handle_fail(params)
|
14
14
|
raise @connection.exception(params)
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
def handle_success(params)
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
private
|
21
|
-
|
21
|
+
|
22
22
|
# Props to Rails
|
23
23
|
def underscore(camel_cased_word)
|
24
24
|
camel_cased_word.to_s.gsub(/::/, '/').
|
@@ -8,7 +8,7 @@ module Cucumber
|
|
8
8
|
@exception_name
|
9
9
|
end
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
def initialize(args, host, port)
|
13
13
|
super args['message']
|
14
14
|
if args['exception']
|
@@ -23,10 +23,10 @@ module Cucumber
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
def backtrace
|
28
28
|
@backtrace || super
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
32
|
-
end
|
32
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
|
+
require 'multi_json'
|
1
2
|
require 'socket'
|
2
|
-
require 'json'
|
3
3
|
require 'cucumber/wire_support/connection'
|
4
4
|
require 'cucumber/wire_support/configuration'
|
5
5
|
require 'cucumber/wire_support/wire_packet'
|
@@ -8,16 +8,16 @@ require 'cucumber/wire_support/wire_step_definition'
|
|
8
8
|
|
9
9
|
module Cucumber
|
10
10
|
module WireSupport
|
11
|
-
|
12
|
-
# The wire-protocol (lanugage independent) implementation of the programming
|
11
|
+
|
12
|
+
# The wire-protocol (lanugage independent) implementation of the programming
|
13
13
|
# language API.
|
14
14
|
class WireLanguage
|
15
15
|
include LanguageSupport::LanguageMethods
|
16
16
|
|
17
|
-
def initialize(
|
17
|
+
def initialize(runtime)
|
18
18
|
@connections = []
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
def alias_adverbs(adverbs)
|
22
22
|
end
|
23
23
|
|
@@ -25,25 +25,25 @@ module Cucumber
|
|
25
25
|
config = Configuration.new(wire_file)
|
26
26
|
@connections << Connection.new(config)
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
def snippet_text(code_keyword, step_name, multiline_arg_class)
|
30
|
-
snippets = @connections.map do |remote|
|
30
|
+
snippets = @connections.map do |remote|
|
31
31
|
remote.snippet_text(code_keyword, step_name, multiline_arg_class.to_s)
|
32
32
|
end
|
33
33
|
snippets.flatten.join("\n")
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
36
|
def step_matches(step_name, formatted_step_name)
|
37
37
|
@connections.map{ |c| c.step_matches(step_name, formatted_step_name)}.flatten
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
protected
|
41
|
-
|
41
|
+
|
42
42
|
def begin_scenario(scenario)
|
43
43
|
@connections.each { |c| c.begin_scenario(scenario) }
|
44
44
|
@current_scenario = scenario
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
def end_scenario
|
48
48
|
scenario = @current_scenario
|
49
49
|
@connections.each { |c| c.end_scenario(scenario) }
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'multi_json'
|
2
|
+
|
1
3
|
module Cucumber
|
2
4
|
module WireSupport
|
3
5
|
# Represents the packet of data sent over the wire as JSON data, containing
|
@@ -5,25 +7,25 @@ module Cucumber
|
|
5
7
|
class WirePacket
|
6
8
|
class << self
|
7
9
|
def parse(raw)
|
8
|
-
attributes =
|
10
|
+
attributes = MultiJson.load(raw.strip)
|
9
11
|
message = attributes[0]
|
10
12
|
params = attributes[1]
|
11
13
|
new(message, params)
|
12
14
|
end
|
13
15
|
end
|
14
|
-
|
16
|
+
|
15
17
|
attr_reader :message, :params
|
16
|
-
|
18
|
+
|
17
19
|
def initialize(message, params = nil)
|
18
20
|
@message, @params = message, params
|
19
21
|
end
|
20
|
-
|
22
|
+
|
21
23
|
def to_json
|
22
24
|
packet = [@message]
|
23
25
|
packet << @params if @params
|
24
26
|
packet.to_json
|
25
27
|
end
|
26
|
-
|
28
|
+
|
27
29
|
def handle_with(handler)
|
28
30
|
handler.send("handle_#{@message}", @params)
|
29
31
|
end
|
@@ -12,22 +12,22 @@ module Cucumber
|
|
12
12
|
handler = Requests::SnippetText.new(self)
|
13
13
|
handler.execute(step_keyword, step_name, multiline_arg_class_name)
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
def invoke(step_definition_id, args)
|
17
17
|
handler = Requests::Invoke.new(self)
|
18
18
|
handler.execute(step_definition_id, args)
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
def diff_failed
|
22
22
|
handler = Requests::DiffFailed.new(self)
|
23
23
|
handler.execute
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
def diff_ok
|
27
27
|
handler = Requests::DiffOk.new(self)
|
28
28
|
handler.execute
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
def begin_scenario(scenario)
|
32
32
|
handler = Requests::BeginScenario.new(self)
|
33
33
|
handler.execute(scenario)
|
@@ -37,7 +37,7 @@ module Cucumber
|
|
37
37
|
handler = Requests::EndScenario.new(self)
|
38
38
|
handler.execute(scenario)
|
39
39
|
end
|
40
|
-
|
40
|
+
|
41
41
|
end
|
42
42
|
end
|
43
|
-
end
|
43
|
+
end
|
@@ -19,11 +19,11 @@ module Cucumber
|
|
19
19
|
create_step_match(raw_step_match)
|
20
20
|
end
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
alias :handle_step_matches :handle_success
|
24
|
-
|
24
|
+
|
25
25
|
private
|
26
|
-
|
26
|
+
|
27
27
|
def create_step_match(raw_step_match)
|
28
28
|
step_definition = WireStepDefinition.new(@connection, raw_step_match)
|
29
29
|
step_args = raw_step_match['args'].map do |raw_arg|
|
@@ -31,7 +31,7 @@ module Cucumber
|
|
31
31
|
end
|
32
32
|
step_match(step_definition, step_args)
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
def step_match(step_definition, step_args)
|
36
36
|
StepMatch.new(step_definition, @name_to_match, @name_to_report, step_args)
|
37
37
|
end
|
@@ -39,25 +39,25 @@ module Cucumber
|
|
39
39
|
|
40
40
|
class SnippetText < RequestHandler
|
41
41
|
def execute(step_keyword, step_name, multiline_arg_class_name)
|
42
|
-
request_params = {
|
43
|
-
:step_keyword => step_keyword,
|
44
|
-
:step_name => step_name,
|
45
|
-
:multiline_arg_class => multiline_arg_class_name
|
42
|
+
request_params = {
|
43
|
+
:step_keyword => step_keyword,
|
44
|
+
:step_name => step_name,
|
45
|
+
:multiline_arg_class => multiline_arg_class_name
|
46
46
|
}
|
47
47
|
super(request_params)
|
48
48
|
end
|
49
|
-
|
49
|
+
|
50
50
|
def handle_success(snippet_text)
|
51
51
|
snippet_text
|
52
52
|
end
|
53
|
-
|
53
|
+
|
54
54
|
alias :handle_snippet_text :handle_success
|
55
55
|
end
|
56
56
|
|
57
57
|
class Invoke < RequestHandler
|
58
58
|
def execute(step_definition_id, args)
|
59
|
-
request_params = {
|
60
|
-
:id => step_definition_id,
|
59
|
+
request_params = {
|
60
|
+
:id => step_definition_id,
|
61
61
|
:args => args
|
62
62
|
}
|
63
63
|
super(request_params)
|
@@ -66,13 +66,13 @@ module Cucumber
|
|
66
66
|
def handle_pending(message)
|
67
67
|
raise Pending, message || "TODO"
|
68
68
|
end
|
69
|
-
|
69
|
+
|
70
70
|
def handle_diff!(tables)
|
71
71
|
table1 = Ast::Table.new(tables[0])
|
72
72
|
table2 = Ast::Table.new(tables[1])
|
73
73
|
table1.diff!(table2)
|
74
74
|
end
|
75
|
-
|
75
|
+
|
76
76
|
def handle_diff(tables)
|
77
77
|
begin
|
78
78
|
handle_diff!(tables)
|
@@ -81,29 +81,29 @@ module Cucumber
|
|
81
81
|
end
|
82
82
|
@connection.diff_ok
|
83
83
|
end
|
84
|
-
|
84
|
+
|
85
85
|
alias :handle_step_failed :handle_fail
|
86
86
|
end
|
87
87
|
|
88
88
|
class DiffFailed < RequestHandler
|
89
89
|
alias :handle_step_failed :handle_fail
|
90
90
|
end
|
91
|
-
|
91
|
+
|
92
92
|
class DiffOk < RequestHandler
|
93
93
|
alias :handle_step_failed :handle_fail
|
94
94
|
end
|
95
|
-
|
95
|
+
|
96
96
|
module Tags
|
97
97
|
def clean_tag_names(scenario)
|
98
98
|
scenario.source_tags.map { |tag| tag.name.gsub(/^@/, '') }.sort
|
99
99
|
end
|
100
|
-
|
100
|
+
|
101
101
|
def request_params(scenario)
|
102
102
|
return nil unless scenario.source_tags.any?
|
103
103
|
{ "tags" => clean_tag_names(scenario) }
|
104
104
|
end
|
105
105
|
end
|
106
|
-
|
106
|
+
|
107
107
|
class BeginScenario < RequestHandler
|
108
108
|
include Tags
|
109
109
|
|
@@ -122,4 +122,4 @@ module Cucumber
|
|
122
122
|
end
|
123
123
|
end
|
124
124
|
end
|
125
|
-
end
|
125
|
+
end
|