cucumber-messages 24.0.1 → 25.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/cucumber/messages/attachment.rb +126 -0
- data/lib/cucumber/messages/attachment_content_encoding.rb +11 -0
- data/lib/cucumber/messages/background.rb +64 -0
- data/lib/cucumber/messages/ci.rb +62 -0
- data/lib/cucumber/messages/comment.rb +50 -0
- data/lib/cucumber/messages/data_table.rb +41 -0
- data/lib/cucumber/messages/doc_string.rb +51 -0
- data/lib/cucumber/messages/duration.rb +50 -0
- data/lib/cucumber/messages/envelope.rb +124 -0
- data/lib/cucumber/messages/examples.rb +74 -0
- data/lib/cucumber/messages/exception.rb +57 -0
- data/lib/cucumber/messages/feature.rb +87 -0
- data/lib/cucumber/messages/feature_child.rb +49 -0
- data/lib/cucumber/messages/gherkin_document.rb +62 -0
- data/lib/cucumber/messages/git.rb +54 -0
- data/lib/cucumber/messages/group.rb +46 -0
- data/lib/cucumber/messages/helpers/id_generator/incrementing.rb +20 -0
- data/lib/cucumber/messages/helpers/id_generator/uuid.rb +17 -0
- data/lib/cucumber/messages/helpers/id_generator.rb +4 -0
- data/lib/cucumber/messages/helpers/ndjson_to_message_enumerator.rb +30 -0
- data/lib/cucumber/messages/helpers/time_conversion.rb +31 -0
- data/lib/cucumber/messages/hook.rb +51 -0
- data/lib/cucumber/messages/java_method.rb +46 -0
- data/lib/cucumber/messages/java_stack_trace_element.rb +46 -0
- data/lib/cucumber/messages/location.rb +44 -0
- data/lib/cucumber/messages/message.rb +92 -4
- data/lib/cucumber/messages/meta.rb +81 -0
- data/lib/cucumber/messages/parameter_type.rb +64 -0
- data/lib/cucumber/messages/parse_error.rb +41 -0
- data/lib/cucumber/messages/pickle.rb +107 -0
- data/lib/cucumber/messages/pickle_doc_string.rb +41 -0
- data/lib/cucumber/messages/pickle_step.rb +71 -0
- data/lib/cucumber/messages/pickle_step_argument.rb +43 -0
- data/lib/cucumber/messages/pickle_step_type.rb +13 -0
- data/lib/cucumber/messages/pickle_table.rb +36 -0
- data/lib/cucumber/messages/pickle_table_cell.rb +36 -0
- data/lib/cucumber/messages/pickle_table_row.rb +36 -0
- data/lib/cucumber/messages/pickle_tag.rb +47 -0
- data/lib/cucumber/messages/product.rb +49 -0
- data/lib/cucumber/messages/rule.rb +72 -0
- data/lib/cucumber/messages/rule_child.rb +44 -0
- data/lib/cucumber/messages/scenario.rb +74 -0
- data/lib/cucumber/messages/source.rb +63 -0
- data/lib/cucumber/messages/source_media_type.rb +11 -0
- data/lib/cucumber/messages/source_reference.rb +55 -0
- data/lib/cucumber/messages/step.rb +80 -0
- data/lib/cucumber/messages/step_definition.rb +46 -0
- data/lib/cucumber/messages/step_definition_pattern.rb +41 -0
- data/lib/cucumber/messages/step_definition_pattern_type.rb +11 -0
- data/lib/cucumber/messages/step_keyword_type.rb +14 -0
- data/lib/cucumber/messages/step_match_argument.rb +54 -0
- data/lib/cucumber/messages/step_match_arguments_list.rb +36 -0
- data/lib/cucumber/messages/table_cell.rb +49 -0
- data/lib/cucumber/messages/table_row.rb +54 -0
- data/lib/cucumber/messages/tag.rb +58 -0
- data/lib/cucumber/messages/test_case.rb +54 -0
- data/lib/cucumber/messages/test_case_finished.rb +46 -0
- data/lib/cucumber/messages/test_case_started.rb +69 -0
- data/lib/cucumber/messages/test_run_finished.rb +63 -0
- data/lib/cucumber/messages/test_run_started.rb +36 -0
- data/lib/cucumber/messages/test_step.rb +74 -0
- data/lib/cucumber/messages/test_step_finished.rb +51 -0
- data/lib/cucumber/messages/test_step_result.rb +57 -0
- data/lib/cucumber/messages/test_step_result_status.rb +16 -0
- data/lib/cucumber/messages/test_step_started.rb +46 -0
- data/lib/cucumber/messages/timestamp.rb +52 -0
- data/lib/cucumber/messages/undefined_parameter_type.rb +41 -0
- data/lib/cucumber/messages.rb +9 -5
- metadata +110 -30
- data/lib/cucumber/messages/id_generator.rb +0 -24
- data/lib/cucumber/messages/message/deserialization.rb +0 -37
- data/lib/cucumber/messages/message/serialization.rb +0 -70
- data/lib/cucumber/messages/message/utils.rb +0 -45
- data/lib/cucumber/messages/ndjson_to_message_enumerator.rb +0 -21
- data/lib/cucumber/messages/time_conversion.rb +0 -33
- data/lib/cucumber/messages.deserializers.rb +0 -1208
- data/lib/cucumber/messages.dtos.rb +0 -1782
@@ -1,11 +1,99 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'json'
|
3
4
|
|
4
5
|
module Cucumber
|
5
6
|
module Messages
|
6
7
|
class Message
|
7
|
-
|
8
|
-
|
8
|
+
def self.camelize(term)
|
9
|
+
camelized = term.to_s
|
10
|
+
camelized.gsub(/(?:_|(\/))([a-z\d]*)/i) { "#{Regexp.last_match(1)}#{Regexp.last_match(2).capitalize}" }
|
11
|
+
end
|
12
|
+
|
13
|
+
##
|
14
|
+
# Returns a new Message - or messages into an array - deserialized from the given json document.
|
15
|
+
# CamelCased keys are properly converted to snake_cased attributes in the process
|
16
|
+
#
|
17
|
+
# Cucumber::Messages::Duration.from_json('{"seconds":1,"nanos":42}')
|
18
|
+
# # => #<Cucumber::Messages::Duration:0x00007efda134c290 @seconds=1, @nanos=42>
|
19
|
+
# Cucumber::Messages::PickleTag.from_json('{"name":"foo","astNodeId":"abc-def"}')
|
20
|
+
# # => #<Cucumber::Messages::PickleTag:0x00007efda138cdb8 @name="foo", @ast_node_id="abc-def">
|
21
|
+
#
|
22
|
+
# It is recursive so embedded messages are also processed.
|
23
|
+
#
|
24
|
+
# json_string = { location: { line: 2 }, text: "comment" }.to_json
|
25
|
+
# Cucumber::Messages::Comment.from_json(json_string)
|
26
|
+
# # => #<Cucumber::Messages::Comment:0x00007efda6abf888 @location=#<Cucumber::Messages::Location:0x00007efda6abf978 @line=2, @column=nil>, @text="comment">
|
27
|
+
#
|
28
|
+
# json_string = { uri: 'file:///...', comments: [{text: 'text comment'}, {text: 'another comment'}]}.to_json
|
29
|
+
# Cucumber::Messages::GherkinDocument.from_json(json_string)
|
30
|
+
# # => #<Cucumber::Messages::GherkinDocument:0x00007efda11e6a90 ... @comments=[#<Cucumber::Messages::Comment:0x00007efda11e6e50 ...]>
|
31
|
+
##
|
32
|
+
def self.from_json(json_string)
|
33
|
+
from_h(JSON.parse(json_string, { symbolize_names: true }))
|
34
|
+
end
|
35
|
+
|
36
|
+
##
|
37
|
+
# Returns a new Hash formed from the message attributes
|
38
|
+
# If +camelize:+ keyword parameter is set to true, then keys will be camelized
|
39
|
+
# If +reject_nil_values:+ keyword parameter is set to true, resulting hash won't include nil values
|
40
|
+
#
|
41
|
+
# Cucumber::Messages::Duration.new(seconds: 1, nanos: 42).to_h
|
42
|
+
# # => { seconds: 1, nanos: 42 }
|
43
|
+
# Cucumber::Messages::PickleTag.new(name: 'foo', ast_node_id: 'abc-def').to_h(camelize: true)
|
44
|
+
# # => { name: 'foo', astNodeId: 'abc-def' }
|
45
|
+
# Cucumber::Messages::PickleTag.new(name: 'foo', ast_node_id: nil).to_h(reject_nil_values: true)
|
46
|
+
# # => { name: 'foo' }
|
47
|
+
#
|
48
|
+
# It is recursive so embedded messages are also processed
|
49
|
+
#
|
50
|
+
# location = Cucumber::Messages::Location.new(line: 2)
|
51
|
+
# Cucumber::Messages::Comment.new(location: location, text: 'comment').to_h
|
52
|
+
# # => { location: { line: 2, :column: nil }, text: "comment" }
|
53
|
+
##
|
54
|
+
def to_h(camelize: false, reject_nil_values: false)
|
55
|
+
resulting_hash = instance_variables.to_h do |variable_name|
|
56
|
+
h_key = variable_name[1..]
|
57
|
+
h_key = Cucumber::Messages::Message.camelize(h_key) if camelize
|
58
|
+
h_value = prepare_value(instance_variable_get(variable_name), camelize: camelize, reject_nil_values: reject_nil_values)
|
59
|
+
[h_key.to_sym, h_value]
|
60
|
+
end
|
61
|
+
|
62
|
+
resulting_hash.tap { |hash| hash.compact! if reject_nil_values }
|
63
|
+
end
|
64
|
+
|
65
|
+
##
|
66
|
+
# Generates a JSON document from the message.
|
67
|
+
# Keys are camelized during the process. Null values are not part of the json document.
|
68
|
+
#
|
69
|
+
# Cucumber::Messages::Duration.new(seconds: 1, nanos: 42).to_json
|
70
|
+
# # => '{"seconds":1,"nanos":42}'
|
71
|
+
# Cucumber::Messages::PickleTag.new(name: 'foo', ast_node_id: 'abc-def').to_json
|
72
|
+
# # => '{"name":"foo","astNodeId":"abc-def"}'
|
73
|
+
# Cucumber::Messages::PickleTag.new(name: 'foo', ast_node_id: nil).to_json
|
74
|
+
# # => '{"name":"foo"}'
|
75
|
+
#
|
76
|
+
# As with #to_h, the method is recursive
|
77
|
+
#
|
78
|
+
# location = Cucumber::Messages::Location.new(line: 2)
|
79
|
+
# Cucumber::Messages::Comment.new(location: location, text: 'comment').to_json
|
80
|
+
# # => '{"location":{"line":2,"column":null},"text":"comment"}'
|
81
|
+
##
|
82
|
+
def to_json(*_args)
|
83
|
+
to_h(camelize: true, reject_nil_values: true).to_json
|
84
|
+
end
|
85
|
+
|
86
|
+
private
|
87
|
+
|
88
|
+
def prepare_value(value, camelize:, reject_nil_values:)
|
89
|
+
if value.is_a?(Cucumber::Messages::Message)
|
90
|
+
value.to_h(camelize: camelize, reject_nil_values: reject_nil_values)
|
91
|
+
elsif value.is_a?(Array)
|
92
|
+
value.map { |element| prepare_value(element, camelize: camelize, reject_nil_values: reject_nil_values) }
|
93
|
+
else
|
94
|
+
value
|
95
|
+
end
|
96
|
+
end
|
9
97
|
end
|
10
98
|
end
|
11
99
|
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
|
4
|
+
module Cucumber
|
5
|
+
module Messages
|
6
|
+
##
|
7
|
+
# Represents the Meta message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
8
|
+
##
|
9
|
+
#
|
10
|
+
# *
|
11
|
+
# This message contains meta information about the environment. Consumers can use
|
12
|
+
# this for various purposes.
|
13
|
+
##
|
14
|
+
class Meta < Message
|
15
|
+
##
|
16
|
+
# *
|
17
|
+
# The [SEMVER](https://semver.org/) version number of the protocol
|
18
|
+
##
|
19
|
+
attr_reader :protocol_version
|
20
|
+
|
21
|
+
##
|
22
|
+
# SpecFlow, Cucumber-JVM, Cucumber.js, Cucumber-Ruby, Behat etc.
|
23
|
+
##
|
24
|
+
attr_reader :implementation
|
25
|
+
|
26
|
+
##
|
27
|
+
# Java, Ruby, Node.js etc
|
28
|
+
##
|
29
|
+
attr_reader :runtime
|
30
|
+
|
31
|
+
##
|
32
|
+
# Windows, Linux, MacOS etc
|
33
|
+
##
|
34
|
+
attr_reader :os
|
35
|
+
|
36
|
+
##
|
37
|
+
# 386, arm, amd64 etc
|
38
|
+
##
|
39
|
+
attr_reader :cpu
|
40
|
+
|
41
|
+
attr_reader :ci
|
42
|
+
|
43
|
+
def initialize(
|
44
|
+
protocol_version: '',
|
45
|
+
implementation: Product.new,
|
46
|
+
runtime: Product.new,
|
47
|
+
os: Product.new,
|
48
|
+
cpu: Product.new,
|
49
|
+
ci: nil
|
50
|
+
)
|
51
|
+
@protocol_version = protocol_version
|
52
|
+
@implementation = implementation
|
53
|
+
@runtime = runtime
|
54
|
+
@os = os
|
55
|
+
@cpu = cpu
|
56
|
+
@ci = ci
|
57
|
+
super()
|
58
|
+
end
|
59
|
+
|
60
|
+
##
|
61
|
+
# Returns a new Meta from the given hash.
|
62
|
+
# If the hash keys are camelCased, they are properly assigned to the
|
63
|
+
# corresponding snake_cased attributes.
|
64
|
+
#
|
65
|
+
# Cucumber::Messages::Meta.from_h(some_hash) # => #<Cucumber::Messages::Meta:0x... ...>
|
66
|
+
##
|
67
|
+
def self.from_h(hash)
|
68
|
+
return nil if hash.nil?
|
69
|
+
|
70
|
+
new(
|
71
|
+
protocol_version: hash[:protocolVersion],
|
72
|
+
implementation: Product.from_h(hash[:implementation]),
|
73
|
+
runtime: Product.from_h(hash[:runtime]),
|
74
|
+
os: Product.from_h(hash[:os]),
|
75
|
+
cpu: Product.from_h(hash[:cpu]),
|
76
|
+
ci: Ci.from_h(hash[:ci])
|
77
|
+
)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
|
4
|
+
module Cucumber
|
5
|
+
module Messages
|
6
|
+
##
|
7
|
+
# Represents the ParameterType message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
8
|
+
##
|
9
|
+
##
|
10
|
+
class ParameterType < Message
|
11
|
+
##
|
12
|
+
# The name is unique, so we don't need an id.
|
13
|
+
##
|
14
|
+
attr_reader :name
|
15
|
+
|
16
|
+
attr_reader :regular_expressions
|
17
|
+
|
18
|
+
attr_reader :prefer_for_regular_expression_match
|
19
|
+
|
20
|
+
attr_reader :use_for_snippets
|
21
|
+
|
22
|
+
attr_reader :id
|
23
|
+
|
24
|
+
attr_reader :source_reference
|
25
|
+
|
26
|
+
def initialize(
|
27
|
+
name: '',
|
28
|
+
regular_expressions: [],
|
29
|
+
prefer_for_regular_expression_match: false,
|
30
|
+
use_for_snippets: false,
|
31
|
+
id: '',
|
32
|
+
source_reference: nil
|
33
|
+
)
|
34
|
+
@name = name
|
35
|
+
@regular_expressions = regular_expressions
|
36
|
+
@prefer_for_regular_expression_match = prefer_for_regular_expression_match
|
37
|
+
@use_for_snippets = use_for_snippets
|
38
|
+
@id = id
|
39
|
+
@source_reference = source_reference
|
40
|
+
super()
|
41
|
+
end
|
42
|
+
|
43
|
+
##
|
44
|
+
# Returns a new ParameterType from the given hash.
|
45
|
+
# If the hash keys are camelCased, they are properly assigned to the
|
46
|
+
# corresponding snake_cased attributes.
|
47
|
+
#
|
48
|
+
# Cucumber::Messages::ParameterType.from_h(some_hash) # => #<Cucumber::Messages::ParameterType:0x... ...>
|
49
|
+
##
|
50
|
+
def self.from_h(hash)
|
51
|
+
return nil if hash.nil?
|
52
|
+
|
53
|
+
new(
|
54
|
+
name: hash[:name],
|
55
|
+
regular_expressions: hash[:regularExpressions],
|
56
|
+
prefer_for_regular_expression_match: hash[:preferForRegularExpressionMatch],
|
57
|
+
use_for_snippets: hash[:useForSnippets],
|
58
|
+
id: hash[:id],
|
59
|
+
source_reference: SourceReference.from_h(hash[:sourceReference])
|
60
|
+
)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
|
4
|
+
module Cucumber
|
5
|
+
module Messages
|
6
|
+
##
|
7
|
+
# Represents the ParseError message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
8
|
+
##
|
9
|
+
##
|
10
|
+
class ParseError < Message
|
11
|
+
attr_reader :source
|
12
|
+
|
13
|
+
attr_reader :message
|
14
|
+
|
15
|
+
def initialize(
|
16
|
+
source: SourceReference.new,
|
17
|
+
message: ''
|
18
|
+
)
|
19
|
+
@source = source
|
20
|
+
@message = message
|
21
|
+
super()
|
22
|
+
end
|
23
|
+
|
24
|
+
##
|
25
|
+
# Returns a new ParseError from the given hash.
|
26
|
+
# If the hash keys are camelCased, they are properly assigned to the
|
27
|
+
# corresponding snake_cased attributes.
|
28
|
+
#
|
29
|
+
# Cucumber::Messages::ParseError.from_h(some_hash) # => #<Cucumber::Messages::ParseError:0x... ...>
|
30
|
+
##
|
31
|
+
def self.from_h(hash)
|
32
|
+
return nil if hash.nil?
|
33
|
+
|
34
|
+
new(
|
35
|
+
source: SourceReference.from_h(hash[:source]),
|
36
|
+
message: hash[:message]
|
37
|
+
)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,107 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
|
4
|
+
module Cucumber
|
5
|
+
module Messages
|
6
|
+
##
|
7
|
+
# Represents the Pickle message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
8
|
+
##
|
9
|
+
#
|
10
|
+
# //// Pickles
|
11
|
+
#
|
12
|
+
# *
|
13
|
+
# A `Pickle` represents a template for a `TestCase`. It is typically derived
|
14
|
+
# from another format, such as [GherkinDocument](#io.cucumber.messages.GherkinDocument).
|
15
|
+
# In the future a `Pickle` may be derived from other formats such as Markdown or
|
16
|
+
# Excel files.
|
17
|
+
#
|
18
|
+
# By making `Pickle` the main data structure Cucumber uses for execution, the
|
19
|
+
# implementation of Cucumber itself becomes simpler, as it doesn't have to deal
|
20
|
+
# with the complex structure of a [GherkinDocument](#io.cucumber.messages.GherkinDocument).
|
21
|
+
#
|
22
|
+
# Each `PickleStep` of a `Pickle` is matched with a `StepDefinition` to create a `TestCase`
|
23
|
+
##
|
24
|
+
class Pickle < Message
|
25
|
+
##
|
26
|
+
# *
|
27
|
+
# A unique id for the pickle
|
28
|
+
##
|
29
|
+
attr_reader :id
|
30
|
+
|
31
|
+
##
|
32
|
+
# The uri of the source file
|
33
|
+
##
|
34
|
+
attr_reader :uri
|
35
|
+
|
36
|
+
##
|
37
|
+
# The name of the pickle
|
38
|
+
##
|
39
|
+
attr_reader :name
|
40
|
+
|
41
|
+
##
|
42
|
+
# The language of the pickle
|
43
|
+
##
|
44
|
+
attr_reader :language
|
45
|
+
|
46
|
+
##
|
47
|
+
# One or more steps
|
48
|
+
##
|
49
|
+
attr_reader :steps
|
50
|
+
|
51
|
+
##
|
52
|
+
# *
|
53
|
+
# One or more tags. If this pickle is constructed from a Gherkin document,
|
54
|
+
# It includes inherited tags from the `Feature` as well.
|
55
|
+
##
|
56
|
+
attr_reader :tags
|
57
|
+
|
58
|
+
##
|
59
|
+
# *
|
60
|
+
# Points to the AST node locations of the pickle. The last one represents the unique
|
61
|
+
# id of the pickle. A pickle constructed from `Examples` will have the first
|
62
|
+
# id originating from the `Scenario` AST node, and the second from the `TableRow` AST node.
|
63
|
+
##
|
64
|
+
attr_reader :ast_node_ids
|
65
|
+
|
66
|
+
def initialize(
|
67
|
+
id: '',
|
68
|
+
uri: '',
|
69
|
+
name: '',
|
70
|
+
language: '',
|
71
|
+
steps: [],
|
72
|
+
tags: [],
|
73
|
+
ast_node_ids: []
|
74
|
+
)
|
75
|
+
@id = id
|
76
|
+
@uri = uri
|
77
|
+
@name = name
|
78
|
+
@language = language
|
79
|
+
@steps = steps
|
80
|
+
@tags = tags
|
81
|
+
@ast_node_ids = ast_node_ids
|
82
|
+
super()
|
83
|
+
end
|
84
|
+
|
85
|
+
##
|
86
|
+
# Returns a new Pickle from the given hash.
|
87
|
+
# If the hash keys are camelCased, they are properly assigned to the
|
88
|
+
# corresponding snake_cased attributes.
|
89
|
+
#
|
90
|
+
# Cucumber::Messages::Pickle.from_h(some_hash) # => #<Cucumber::Messages::Pickle:0x... ...>
|
91
|
+
##
|
92
|
+
def self.from_h(hash)
|
93
|
+
return nil if hash.nil?
|
94
|
+
|
95
|
+
new(
|
96
|
+
id: hash[:id],
|
97
|
+
uri: hash[:uri],
|
98
|
+
name: hash[:name],
|
99
|
+
language: hash[:language],
|
100
|
+
steps: hash[:steps]&.map { |item| PickleStep.from_h(item) },
|
101
|
+
tags: hash[:tags]&.map { |item| PickleTag.from_h(item) },
|
102
|
+
ast_node_ids: hash[:astNodeIds]
|
103
|
+
)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
|
4
|
+
module Cucumber
|
5
|
+
module Messages
|
6
|
+
##
|
7
|
+
# Represents the PickleDocString message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
8
|
+
##
|
9
|
+
##
|
10
|
+
class PickleDocString < Message
|
11
|
+
attr_reader :media_type
|
12
|
+
|
13
|
+
attr_reader :content
|
14
|
+
|
15
|
+
def initialize(
|
16
|
+
media_type: nil,
|
17
|
+
content: ''
|
18
|
+
)
|
19
|
+
@media_type = media_type
|
20
|
+
@content = content
|
21
|
+
super()
|
22
|
+
end
|
23
|
+
|
24
|
+
##
|
25
|
+
# Returns a new PickleDocString from the given hash.
|
26
|
+
# If the hash keys are camelCased, they are properly assigned to the
|
27
|
+
# corresponding snake_cased attributes.
|
28
|
+
#
|
29
|
+
# Cucumber::Messages::PickleDocString.from_h(some_hash) # => #<Cucumber::Messages::PickleDocString:0x... ...>
|
30
|
+
##
|
31
|
+
def self.from_h(hash)
|
32
|
+
return nil if hash.nil?
|
33
|
+
|
34
|
+
new(
|
35
|
+
media_type: hash[:mediaType],
|
36
|
+
content: hash[:content]
|
37
|
+
)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
|
4
|
+
module Cucumber
|
5
|
+
module Messages
|
6
|
+
##
|
7
|
+
# Represents the PickleStep message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
8
|
+
##
|
9
|
+
#
|
10
|
+
# *
|
11
|
+
# An executable step
|
12
|
+
##
|
13
|
+
class PickleStep < Message
|
14
|
+
attr_reader :argument
|
15
|
+
|
16
|
+
##
|
17
|
+
# References the IDs of the source of the step. For Gherkin, this can be
|
18
|
+
# the ID of a Step, and possibly also the ID of a TableRow
|
19
|
+
##
|
20
|
+
attr_reader :ast_node_ids
|
21
|
+
|
22
|
+
##
|
23
|
+
# A unique ID for the PickleStep
|
24
|
+
##
|
25
|
+
attr_reader :id
|
26
|
+
|
27
|
+
##
|
28
|
+
# The context in which the step was specified: context (Given), action (When) or outcome (Then).
|
29
|
+
#
|
30
|
+
# Note that the keywords `But` and `And` inherit their meaning from prior steps and the `*` 'keyword' doesn't have specific meaning (hence Unknown)
|
31
|
+
##
|
32
|
+
attr_reader :type
|
33
|
+
|
34
|
+
attr_reader :text
|
35
|
+
|
36
|
+
def initialize(
|
37
|
+
argument: nil,
|
38
|
+
ast_node_ids: [],
|
39
|
+
id: '',
|
40
|
+
type: nil,
|
41
|
+
text: ''
|
42
|
+
)
|
43
|
+
@argument = argument
|
44
|
+
@ast_node_ids = ast_node_ids
|
45
|
+
@id = id
|
46
|
+
@type = type
|
47
|
+
@text = text
|
48
|
+
super()
|
49
|
+
end
|
50
|
+
|
51
|
+
##
|
52
|
+
# Returns a new PickleStep from the given hash.
|
53
|
+
# If the hash keys are camelCased, they are properly assigned to the
|
54
|
+
# corresponding snake_cased attributes.
|
55
|
+
#
|
56
|
+
# Cucumber::Messages::PickleStep.from_h(some_hash) # => #<Cucumber::Messages::PickleStep:0x... ...>
|
57
|
+
##
|
58
|
+
def self.from_h(hash)
|
59
|
+
return nil if hash.nil?
|
60
|
+
|
61
|
+
new(
|
62
|
+
argument: PickleStepArgument.from_h(hash[:argument]),
|
63
|
+
ast_node_ids: hash[:astNodeIds],
|
64
|
+
id: hash[:id],
|
65
|
+
type: hash[:type],
|
66
|
+
text: hash[:text]
|
67
|
+
)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
|
4
|
+
module Cucumber
|
5
|
+
module Messages
|
6
|
+
##
|
7
|
+
# Represents the PickleStepArgument message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
8
|
+
##
|
9
|
+
#
|
10
|
+
# An optional argument
|
11
|
+
##
|
12
|
+
class PickleStepArgument < Message
|
13
|
+
attr_reader :doc_string
|
14
|
+
|
15
|
+
attr_reader :data_table
|
16
|
+
|
17
|
+
def initialize(
|
18
|
+
doc_string: nil,
|
19
|
+
data_table: nil
|
20
|
+
)
|
21
|
+
@doc_string = doc_string
|
22
|
+
@data_table = data_table
|
23
|
+
super()
|
24
|
+
end
|
25
|
+
|
26
|
+
##
|
27
|
+
# Returns a new PickleStepArgument from the given hash.
|
28
|
+
# If the hash keys are camelCased, they are properly assigned to the
|
29
|
+
# corresponding snake_cased attributes.
|
30
|
+
#
|
31
|
+
# Cucumber::Messages::PickleStepArgument.from_h(some_hash) # => #<Cucumber::Messages::PickleStepArgument:0x... ...>
|
32
|
+
##
|
33
|
+
def self.from_h(hash)
|
34
|
+
return nil if hash.nil?
|
35
|
+
|
36
|
+
new(
|
37
|
+
doc_string: PickleDocString.from_h(hash[:docString]),
|
38
|
+
data_table: PickleTable.from_h(hash[:dataTable])
|
39
|
+
)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
|
4
|
+
module Cucumber
|
5
|
+
module Messages
|
6
|
+
class PickleStepType
|
7
|
+
UNKNOWN = 'Unknown'
|
8
|
+
CONTEXT = 'Context'
|
9
|
+
ACTION = 'Action'
|
10
|
+
OUTCOME = 'Outcome'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
|
4
|
+
module Cucumber
|
5
|
+
module Messages
|
6
|
+
##
|
7
|
+
# Represents the PickleTable message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
8
|
+
##
|
9
|
+
##
|
10
|
+
class PickleTable < Message
|
11
|
+
attr_reader :rows
|
12
|
+
|
13
|
+
def initialize(
|
14
|
+
rows: []
|
15
|
+
)
|
16
|
+
@rows = rows
|
17
|
+
super()
|
18
|
+
end
|
19
|
+
|
20
|
+
##
|
21
|
+
# Returns a new PickleTable from the given hash.
|
22
|
+
# If the hash keys are camelCased, they are properly assigned to the
|
23
|
+
# corresponding snake_cased attributes.
|
24
|
+
#
|
25
|
+
# Cucumber::Messages::PickleTable.from_h(some_hash) # => #<Cucumber::Messages::PickleTable:0x... ...>
|
26
|
+
##
|
27
|
+
def self.from_h(hash)
|
28
|
+
return nil if hash.nil?
|
29
|
+
|
30
|
+
new(
|
31
|
+
rows: hash[:rows]&.map { |item| PickleTableRow.from_h(item) }
|
32
|
+
)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
|
4
|
+
module Cucumber
|
5
|
+
module Messages
|
6
|
+
##
|
7
|
+
# Represents the PickleTableCell message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
8
|
+
##
|
9
|
+
##
|
10
|
+
class PickleTableCell < Message
|
11
|
+
attr_reader :value
|
12
|
+
|
13
|
+
def initialize(
|
14
|
+
value: ''
|
15
|
+
)
|
16
|
+
@value = value
|
17
|
+
super()
|
18
|
+
end
|
19
|
+
|
20
|
+
##
|
21
|
+
# Returns a new PickleTableCell from the given hash.
|
22
|
+
# If the hash keys are camelCased, they are properly assigned to the
|
23
|
+
# corresponding snake_cased attributes.
|
24
|
+
#
|
25
|
+
# Cucumber::Messages::PickleTableCell.from_h(some_hash) # => #<Cucumber::Messages::PickleTableCell:0x... ...>
|
26
|
+
##
|
27
|
+
def self.from_h(hash)
|
28
|
+
return nil if hash.nil?
|
29
|
+
|
30
|
+
new(
|
31
|
+
value: hash[:value]
|
32
|
+
)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
|
4
|
+
module Cucumber
|
5
|
+
module Messages
|
6
|
+
##
|
7
|
+
# Represents the PickleTableRow message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
|
8
|
+
##
|
9
|
+
##
|
10
|
+
class PickleTableRow < Message
|
11
|
+
attr_reader :cells
|
12
|
+
|
13
|
+
def initialize(
|
14
|
+
cells: []
|
15
|
+
)
|
16
|
+
@cells = cells
|
17
|
+
super()
|
18
|
+
end
|
19
|
+
|
20
|
+
##
|
21
|
+
# Returns a new PickleTableRow from the given hash.
|
22
|
+
# If the hash keys are camelCased, they are properly assigned to the
|
23
|
+
# corresponding snake_cased attributes.
|
24
|
+
#
|
25
|
+
# Cucumber::Messages::PickleTableRow.from_h(some_hash) # => #<Cucumber::Messages::PickleTableRow:0x... ...>
|
26
|
+
##
|
27
|
+
def self.from_h(hash)
|
28
|
+
return nil if hash.nil?
|
29
|
+
|
30
|
+
new(
|
31
|
+
cells: hash[:cells]&.map { |item| PickleTableCell.from_h(item) }
|
32
|
+
)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|