cucumber-messages 7.0.0 → 8.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cucumber/messages.rb +6 -1
- data/lib/cucumber/messages/{protobuf_io_enumerator.rb → binary_to_message_enumerator.rb} +4 -4
- data/lib/cucumber/messages/id_generator.rb +24 -0
- data/lib/cucumber/messages/ndjson_to_message_enumerator.rb +15 -0
- data/lib/cucumber/messages/protobuf_ndjson.rb +30 -0
- data/lib/cucumber/messages/time_conversion.rb +28 -0
- data/lib/cucumber/messages_pb.rb +98 -96
- data/spec/cucumber/messages/id_generator_spec.rb +29 -0
- data/spec/cucumber/messages/ndjson_serialization_spec.rb +29 -0
- data/spec/cucumber/messages/{message_serialization_spec.rb → protobuf_serialization_spec.rb} +7 -11
- data/spec/cucumber/messages/time_conversion_spec.rb +26 -0
- metadata +36 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a30233674057da24fc9163c1cf3b5fb01d4b419b1f51a2f8b40355a3f48e604
|
4
|
+
data.tar.gz: da293cb418e9faa3749e2818488588fad8f389816b84cbb20670cf5ff4ebcf9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78f1607fbe53e322ca22f055b63751927ee212950e2e6e421afd17bd92254d1ff03fba139668a59bd27e452c0fa6136a00790a33a247fd3d8acc5c35433f87c2
|
7
|
+
data.tar.gz: b8008401ca5cd17a07ea5646e008bb999823f4cddf536824afd60892979ec6ef53197fac499d2cde3d055a14515fb8ecc5679f198ad5784a52e9930b3e1d34c4
|
data/lib/cucumber/messages.rb
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
require 'cucumber/messages_pb'
|
2
|
-
require 'cucumber/messages/
|
2
|
+
require 'cucumber/messages/binary_to_message_enumerator'
|
3
|
+
require 'cucumber/messages/ndjson_to_message_enumerator'
|
3
4
|
require 'cucumber/messages/protobuf_delimited'
|
5
|
+
require 'cucumber/messages/protobuf_ndjson'
|
6
|
+
require 'cucumber/messages/time_conversion'
|
7
|
+
require 'cucumber/messages/id_generator'
|
4
8
|
|
9
|
+
Cucumber::Messages::Envelope.include(Cucumber::Messages::WriteNdjson)
|
5
10
|
Cucumber::Messages::Envelope.include(Cucumber::Messages::WriteDelimited)
|
6
11
|
Cucumber::Messages::Envelope.extend(Cucumber::Messages::ParseDelimited)
|
@@ -2,9 +2,9 @@ require 'cucumber/messages/varint'
|
|
2
2
|
|
3
3
|
module Cucumber
|
4
4
|
module Messages
|
5
|
-
|
6
|
-
def
|
7
|
-
|
5
|
+
class BinaryToMessageEnumerator < Enumerator
|
6
|
+
def initialize(io)
|
7
|
+
super() do |yielder|
|
8
8
|
while !io.eof?
|
9
9
|
yielder.yield(Cucumber::Messages::Envelope.parse_delimited_from(io))
|
10
10
|
end
|
@@ -12,4 +12,4 @@ module Cucumber
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
15
|
-
end
|
15
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'securerandom'
|
2
|
+
|
3
|
+
module Cucumber
|
4
|
+
module Messages
|
5
|
+
module IdGenerator
|
6
|
+
class Incrementing
|
7
|
+
def initialize
|
8
|
+
@index = -1
|
9
|
+
end
|
10
|
+
|
11
|
+
def new_id
|
12
|
+
@index += 1
|
13
|
+
@index.to_s
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class UUID
|
18
|
+
def new_id
|
19
|
+
SecureRandom.uuid
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'cucumber/messages/varint'
|
2
|
+
|
3
|
+
module Cucumber
|
4
|
+
module Messages
|
5
|
+
class NdjsonToMessageEnumerator < Enumerator
|
6
|
+
def initialize(io)
|
7
|
+
super() do |yielder|
|
8
|
+
io.each_line do |json|
|
9
|
+
yielder.yield(Cucumber::Messages::Envelope.decode_json(json))
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module Cucumber
|
4
|
+
module Messages
|
5
|
+
module WriteNdjson
|
6
|
+
def write_ndjson_to(io)
|
7
|
+
json = self.class.encode_json(self)
|
8
|
+
ob = JSON.parse(json)
|
9
|
+
remove_empties(ob)
|
10
|
+
io.puts(JSON.generate(ob))
|
11
|
+
end
|
12
|
+
|
13
|
+
def remove_empties(ob)
|
14
|
+
if Hash === ob
|
15
|
+
ob.each do |key, value|
|
16
|
+
if value == []
|
17
|
+
ob.delete(key)
|
18
|
+
else
|
19
|
+
remove_empties(value)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
elsif Array === ob
|
23
|
+
ob.each do |value|
|
24
|
+
remove_empties(value)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Cucumber
|
2
|
+
module Messages
|
3
|
+
module TimeConversion
|
4
|
+
NANOSECONDS_PER_SECOND = 1000000000
|
5
|
+
|
6
|
+
def time_to_timestamp(time)
|
7
|
+
rational = time.to_r
|
8
|
+
Timestamp.new(seconds: rational.numerator, nanos: rational.denominator)
|
9
|
+
end
|
10
|
+
|
11
|
+
def timestamp_to_time(timestamp)
|
12
|
+
Time.at(Rational(timestamp.seconds, timestamp.nanos))
|
13
|
+
end
|
14
|
+
|
15
|
+
def seconds_to_duration(seconds_float)
|
16
|
+
seconds, second_modulus = seconds_float.divmod(1)
|
17
|
+
nanos = second_modulus / NANOSECONDS_PER_SECOND
|
18
|
+
Duration.new(seconds: seconds, nanos: nanos)
|
19
|
+
end
|
20
|
+
|
21
|
+
def duration_to_seconds(duration)
|
22
|
+
seconds_part = duration.seconds
|
23
|
+
nanos_part = duration.nanos / NANOSECONDS_PER_SECOND
|
24
|
+
seconds_part + nanos_part
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/cucumber/messages_pb.rb
CHANGED
@@ -15,31 +15,31 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
15
15
|
add_message "io.cucumber.messages.Envelope" do
|
16
16
|
oneof :message do
|
17
17
|
optional :source, :message, 1, "io.cucumber.messages.Source"
|
18
|
-
optional :
|
18
|
+
optional :gherkin_document, :message, 2, "io.cucumber.messages.GherkinDocument"
|
19
19
|
optional :pickle, :message, 3, "io.cucumber.messages.Pickle"
|
20
20
|
optional :attachment, :message, 4, "io.cucumber.messages.Attachment"
|
21
|
-
optional :
|
22
|
-
optional :
|
23
|
-
optional :
|
24
|
-
optional :
|
25
|
-
optional :
|
26
|
-
optional :
|
27
|
-
optional :
|
28
|
-
optional :
|
29
|
-
optional :
|
30
|
-
optional :
|
31
|
-
optional :
|
32
|
-
optional :
|
33
|
-
optional :
|
34
|
-
optional :
|
35
|
-
optional :
|
36
|
-
optional :
|
37
|
-
optional :
|
38
|
-
optional :
|
39
|
-
optional :
|
40
|
-
optional :
|
41
|
-
optional :
|
42
|
-
optional :
|
21
|
+
optional :test_case_started, :message, 5, "io.cucumber.messages.TestCaseStarted"
|
22
|
+
optional :test_step_started, :message, 6, "io.cucumber.messages.TestStepStarted"
|
23
|
+
optional :test_step_finished, :message, 7, "io.cucumber.messages.TestStepFinished"
|
24
|
+
optional :test_case_finished, :message, 8, "io.cucumber.messages.TestCaseFinished"
|
25
|
+
optional :pickle_accepted, :message, 9, "io.cucumber.messages.PickleAccepted"
|
26
|
+
optional :pickle_rejected, :message, 10, "io.cucumber.messages.PickleRejected"
|
27
|
+
optional :test_case_prepared, :message, 11, "io.cucumber.messages.TestCasePrepared"
|
28
|
+
optional :test_run_started, :message, 12, "io.cucumber.messages.TestRunStarted"
|
29
|
+
optional :test_run_finished, :message, 13, "io.cucumber.messages.TestRunFinished"
|
30
|
+
optional :command_start, :message, 14, "io.cucumber.messages.CommandStart"
|
31
|
+
optional :command_action_complete, :message, 15, "io.cucumber.messages.CommandActionComplete"
|
32
|
+
optional :command_run_before_test_run_hooks, :message, 16, "io.cucumber.messages.CommandRunBeforeTestRunHooks"
|
33
|
+
optional :command_initialize_test_case, :message, 17, "io.cucumber.messages.CommandInitializeTestCase"
|
34
|
+
optional :command_run_before_test_case_hook, :message, 18, "io.cucumber.messages.CommandRunBeforeTestCaseHook"
|
35
|
+
optional :command_run_test_step, :message, 19, "io.cucumber.messages.CommandRunTestStep"
|
36
|
+
optional :command_run_after_test_case_hook, :message, 20, "io.cucumber.messages.CommandRunAfterTestCaseHook"
|
37
|
+
optional :command_run_after_test_run_hooks, :message, 21, "io.cucumber.messages.CommandRunAfterTestRunHooks"
|
38
|
+
optional :command_generate_snippet, :message, 22, "io.cucumber.messages.CommandGenerateSnippet"
|
39
|
+
optional :command_error, :string, 23
|
40
|
+
optional :test_case, :message, 24, "io.cucumber.messages.TestCase"
|
41
|
+
optional :step_definition, :message, 25, "io.cucumber.messages.StepDefinition"
|
42
|
+
optional :hook, :message, 26, "io.cucumber.messages.Hook"
|
43
43
|
end
|
44
44
|
end
|
45
45
|
add_message "io.cucumber.messages.Location" do
|
@@ -165,6 +165,8 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
165
165
|
optional :source, :message, 1, "io.cucumber.messages.SourceReference"
|
166
166
|
optional :data, :string, 2
|
167
167
|
optional :media, :message, 3, "io.cucumber.messages.Media"
|
168
|
+
optional :test_step_id, :string, 4
|
169
|
+
optional :test_case_started_id, :string, 5
|
168
170
|
end
|
169
171
|
add_message "io.cucumber.messages.Pickle" do
|
170
172
|
optional :id, :string, 1
|
@@ -173,17 +175,17 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
173
175
|
optional :language, :string, 4
|
174
176
|
repeated :steps, :message, 5, "io.cucumber.messages.Pickle.PickleStep"
|
175
177
|
repeated :tags, :message, 6, "io.cucumber.messages.Pickle.PickleTag"
|
176
|
-
repeated :
|
178
|
+
repeated :ast_node_ids, :string, 7
|
177
179
|
end
|
178
180
|
add_message "io.cucumber.messages.Pickle.PickleTag" do
|
179
181
|
optional :name, :string, 1
|
180
|
-
optional :
|
182
|
+
optional :ast_node_id, :string, 2
|
181
183
|
end
|
182
184
|
add_message "io.cucumber.messages.Pickle.PickleStep" do
|
183
185
|
optional :text, :string, 1
|
184
186
|
optional :argument, :message, 2, "io.cucumber.messages.PickleStepArgument"
|
185
187
|
optional :id, :string, 3
|
186
|
-
repeated :
|
188
|
+
repeated :ast_node_ids, :string, 4
|
187
189
|
end
|
188
190
|
add_message "io.cucumber.messages.PickleStepArgument" do
|
189
191
|
oneof :message do
|
@@ -192,7 +194,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
192
194
|
end
|
193
195
|
end
|
194
196
|
add_message "io.cucumber.messages.PickleStepArgument.PickleDocString" do
|
195
|
-
optional :
|
197
|
+
optional :content_type, :string, 1
|
196
198
|
optional :content, :string, 2
|
197
199
|
end
|
198
200
|
add_message "io.cucumber.messages.PickleStepArgument.PickleTable" do
|
@@ -206,38 +208,38 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
206
208
|
end
|
207
209
|
add_message "io.cucumber.messages.TestCase" do
|
208
210
|
optional :id, :string, 1
|
209
|
-
optional :
|
210
|
-
repeated :
|
211
|
+
optional :pickle_id, :string, 2
|
212
|
+
repeated :test_steps, :message, 3, "io.cucumber.messages.TestCase.TestStep"
|
211
213
|
end
|
212
214
|
add_message "io.cucumber.messages.TestCase.TestStep" do
|
213
215
|
optional :id, :string, 1
|
214
|
-
optional :
|
215
|
-
repeated :
|
216
|
-
repeated :
|
216
|
+
optional :pickle_step_id, :string, 2
|
217
|
+
repeated :step_definition_ids, :string, 3
|
218
|
+
repeated :step_match_arguments, :message, 4, "io.cucumber.messages.StepMatchArgument"
|
217
219
|
optional :hookId, :string, 5
|
218
220
|
end
|
219
221
|
add_message "io.cucumber.messages.PickleAccepted" do
|
220
|
-
optional :
|
222
|
+
optional :pickle_id, :string, 1
|
221
223
|
end
|
222
224
|
add_message "io.cucumber.messages.PickleRejected" do
|
223
|
-
optional :
|
225
|
+
optional :pickle_id, :string, 2
|
224
226
|
end
|
225
227
|
add_message "io.cucumber.messages.TestRunStarted" do
|
226
228
|
optional :timestamp, :message, 1, "io.cucumber.messages.Timestamp"
|
227
229
|
end
|
228
230
|
add_message "io.cucumber.messages.TestCasePreparedStep" do
|
229
|
-
optional :
|
230
|
-
optional :
|
231
|
+
optional :source_location, :message, 1, "io.cucumber.messages.SourceReference"
|
232
|
+
optional :action_location, :message, 2, "io.cucumber.messages.SourceReference"
|
231
233
|
end
|
232
234
|
add_message "io.cucumber.messages.TestCasePrepared" do
|
233
|
-
optional :
|
235
|
+
optional :pickle_id, :string, 1
|
234
236
|
repeated :steps, :message, 2, "io.cucumber.messages.TestCasePreparedStep"
|
235
237
|
end
|
236
238
|
add_message "io.cucumber.messages.TestCaseStarted" do
|
237
239
|
optional :timestamp, :message, 1, "io.cucumber.messages.Timestamp"
|
238
240
|
optional :platform, :message, 2, "io.cucumber.messages.TestCaseStarted.Platform"
|
239
241
|
optional :attempt, :uint32, 3
|
240
|
-
optional :
|
242
|
+
optional :test_case_id, :string, 4
|
241
243
|
optional :id, :string, 5
|
242
244
|
end
|
243
245
|
add_message "io.cucumber.messages.TestCaseStarted.Platform" do
|
@@ -248,25 +250,25 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
248
250
|
end
|
249
251
|
add_message "io.cucumber.messages.TestCaseFinished" do
|
250
252
|
optional :timestamp, :message, 1, "io.cucumber.messages.Timestamp"
|
251
|
-
optional :
|
252
|
-
optional :
|
253
|
+
optional :test_result, :message, 2, "io.cucumber.messages.TestResult"
|
254
|
+
optional :test_case_started_id, :string, 3
|
253
255
|
end
|
254
256
|
add_message "io.cucumber.messages.TestStepStarted" do
|
255
257
|
optional :timestamp, :message, 1, "io.cucumber.messages.Timestamp"
|
256
|
-
optional :
|
257
|
-
optional :
|
258
|
+
optional :test_step_id, :string, 2
|
259
|
+
optional :test_case_started_id, :string, 3
|
258
260
|
end
|
259
261
|
add_message "io.cucumber.messages.TestStepFinished" do
|
260
|
-
optional :
|
262
|
+
optional :test_result, :message, 1, "io.cucumber.messages.TestResult"
|
261
263
|
optional :timestamp, :message, 2, "io.cucumber.messages.Timestamp"
|
262
|
-
optional :
|
263
|
-
optional :
|
264
|
+
optional :test_step_id, :string, 3
|
265
|
+
optional :test_case_started_id, :string, 4
|
264
266
|
end
|
265
267
|
add_message "io.cucumber.messages.TestResult" do
|
266
268
|
optional :status, :enum, 1, "io.cucumber.messages.TestResult.Status"
|
267
269
|
optional :message, :string, 2
|
268
270
|
optional :duration, :message, 3, "io.cucumber.messages.Duration"
|
269
|
-
optional :
|
271
|
+
optional :will_be_retried, :bool, 4
|
270
272
|
end
|
271
273
|
add_enum "io.cucumber.messages.TestResult.Status" do
|
272
274
|
value :UNKNOWN, 0
|
@@ -282,24 +284,24 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
282
284
|
optional :timestamp, :message, 2, "io.cucumber.messages.Timestamp"
|
283
285
|
end
|
284
286
|
add_message "io.cucumber.messages.CommandStart" do
|
285
|
-
optional :
|
286
|
-
optional :
|
287
|
-
optional :
|
288
|
-
optional :
|
287
|
+
optional :base_directory, :string, 2
|
288
|
+
optional :sources_config, :message, 3, "io.cucumber.messages.SourcesConfig"
|
289
|
+
optional :runtime_config, :message, 4, "io.cucumber.messages.RuntimeConfig"
|
290
|
+
optional :support_code_config, :message, 5, "io.cucumber.messages.SupportCodeConfig"
|
289
291
|
end
|
290
292
|
add_message "io.cucumber.messages.SourcesConfig" do
|
291
|
-
repeated :
|
293
|
+
repeated :absolute_paths, :string, 1
|
292
294
|
optional :language, :string, 2
|
293
295
|
optional :filters, :message, 3, "io.cucumber.messages.SourcesFilterConfig"
|
294
296
|
optional :order, :message, 4, "io.cucumber.messages.SourcesOrder"
|
295
297
|
end
|
296
298
|
add_message "io.cucumber.messages.SourcesFilterConfig" do
|
297
|
-
optional :
|
298
|
-
repeated :
|
299
|
-
repeated :
|
299
|
+
optional :tag_expression, :string, 1
|
300
|
+
repeated :name_regular_expressions, :string, 2
|
301
|
+
repeated :uri_to_lines_mapping, :message, 3, "io.cucumber.messages.UriToLinesMapping"
|
300
302
|
end
|
301
303
|
add_message "io.cucumber.messages.UriToLinesMapping" do
|
302
|
-
optional :
|
304
|
+
optional :absolute_path, :string, 1
|
303
305
|
repeated :lines, :uint64, 2
|
304
306
|
end
|
305
307
|
add_message "io.cucumber.messages.SourcesOrder" do
|
@@ -307,73 +309,73 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
307
309
|
optional :seed, :uint64, 2
|
308
310
|
end
|
309
311
|
add_message "io.cucumber.messages.RuntimeConfig" do
|
310
|
-
optional :
|
311
|
-
optional :
|
312
|
-
optional :
|
313
|
-
optional :
|
312
|
+
optional :is_fail_fast, :bool, 1
|
313
|
+
optional :is_dry_run, :bool, 2
|
314
|
+
optional :is_strict, :bool, 3
|
315
|
+
optional :max_parallel, :uint64, 4
|
314
316
|
end
|
315
317
|
add_message "io.cucumber.messages.SupportCodeConfig" do
|
316
|
-
repeated :
|
317
|
-
repeated :
|
318
|
-
repeated :
|
319
|
-
repeated :
|
318
|
+
repeated :before_test_case_hooks, :message, 1, "io.cucumber.messages.Hook"
|
319
|
+
repeated :after_test_case_hooks, :message, 2, "io.cucumber.messages.Hook"
|
320
|
+
repeated :step_definitions, :message, 3, "io.cucumber.messages.StepDefinition"
|
321
|
+
repeated :parameter_types, :message, 4, "io.cucumber.messages.ParameterType"
|
320
322
|
end
|
321
|
-
add_message "io.cucumber.messages.
|
323
|
+
add_message "io.cucumber.messages.Hook" do
|
322
324
|
optional :id, :string, 1
|
323
|
-
optional :
|
324
|
-
optional :
|
325
|
+
optional :tag_expression, :string, 2
|
326
|
+
optional :source_reference, :message, 3, "io.cucumber.messages.SourceReference"
|
325
327
|
end
|
326
|
-
add_message "io.cucumber.messages.
|
328
|
+
add_message "io.cucumber.messages.StepDefinition" do
|
327
329
|
optional :id, :string, 1
|
328
330
|
optional :pattern, :message, 2, "io.cucumber.messages.StepDefinitionPattern"
|
329
|
-
optional :
|
331
|
+
optional :source_reference, :message, 3, "io.cucumber.messages.SourceReference"
|
330
332
|
end
|
331
333
|
add_message "io.cucumber.messages.StepDefinitionPattern" do
|
332
334
|
optional :source, :string, 1
|
333
335
|
optional :type, :enum, 2, "io.cucumber.messages.StepDefinitionPatternType"
|
334
336
|
end
|
335
|
-
add_message "io.cucumber.messages.
|
337
|
+
add_message "io.cucumber.messages.ParameterType" do
|
336
338
|
optional :name, :string, 1
|
337
|
-
repeated :
|
338
|
-
optional :
|
339
|
-
optional :
|
339
|
+
repeated :regular_expressions, :string, 2
|
340
|
+
optional :prefer_for_regular_expression_match, :bool, 3
|
341
|
+
optional :use_for_snippets, :bool, 4
|
340
342
|
end
|
341
343
|
add_message "io.cucumber.messages.CommandActionComplete" do
|
342
|
-
optional :
|
344
|
+
optional :completed_id, :string, 1
|
343
345
|
oneof :result do
|
344
|
-
optional :
|
346
|
+
optional :test_result, :message, 2, "io.cucumber.messages.TestResult"
|
345
347
|
optional :snippet, :string, 3
|
346
348
|
end
|
347
349
|
end
|
348
350
|
add_message "io.cucumber.messages.CommandRunBeforeTestRunHooks" do
|
349
|
-
optional :
|
351
|
+
optional :action_id, :string, 1
|
350
352
|
end
|
351
353
|
add_message "io.cucumber.messages.CommandRunAfterTestRunHooks" do
|
352
|
-
optional :
|
354
|
+
optional :action_id, :string, 1
|
353
355
|
end
|
354
356
|
add_message "io.cucumber.messages.CommandInitializeTestCase" do
|
355
|
-
optional :
|
357
|
+
optional :action_id, :string, 1
|
356
358
|
optional :pickle, :message, 2, "io.cucumber.messages.Pickle"
|
357
359
|
end
|
358
360
|
add_message "io.cucumber.messages.CommandRunBeforeTestCaseHook" do
|
359
|
-
optional :
|
360
|
-
optional :
|
361
|
-
optional :
|
361
|
+
optional :action_id, :string, 1
|
362
|
+
optional :hook_id, :string, 2
|
363
|
+
optional :test_case_id, :string, 3
|
362
364
|
end
|
363
365
|
add_message "io.cucumber.messages.CommandRunAfterTestCaseHook" do
|
364
|
-
optional :
|
365
|
-
optional :
|
366
|
-
optional :
|
366
|
+
optional :action_id, :string, 1
|
367
|
+
optional :hook_id, :string, 2
|
368
|
+
optional :test_case_id, :string, 3
|
367
369
|
end
|
368
370
|
add_message "io.cucumber.messages.CommandRunTestStep" do
|
369
|
-
optional :
|
370
|
-
optional :
|
371
|
-
repeated :
|
372
|
-
optional :
|
373
|
-
optional :
|
371
|
+
optional :action_id, :string, 1
|
372
|
+
optional :step_definition_id, :string, 2
|
373
|
+
repeated :step_match_arguments, :message, 3, "io.cucumber.messages.StepMatchArgument"
|
374
|
+
optional :pickle_step_argument, :message, 4, "io.cucumber.messages.PickleStepArgument"
|
375
|
+
optional :test_case_id, :string, 5
|
374
376
|
end
|
375
377
|
add_message "io.cucumber.messages.StepMatchArgument" do
|
376
|
-
optional :
|
378
|
+
optional :parameter_type_name, :string, 1
|
377
379
|
optional :group, :message, 2, "io.cucumber.messages.StepMatchArgument.Group"
|
378
380
|
end
|
379
381
|
add_message "io.cucumber.messages.StepMatchArgument.Group" do
|
@@ -382,13 +384,13 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
382
384
|
repeated :children, :message, 3, "io.cucumber.messages.StepMatchArgument.Group"
|
383
385
|
end
|
384
386
|
add_message "io.cucumber.messages.CommandGenerateSnippet" do
|
385
|
-
optional :
|
386
|
-
repeated :
|
387
|
-
optional :
|
387
|
+
optional :action_id, :string, 1
|
388
|
+
repeated :generated_expressions, :message, 2, "io.cucumber.messages.GeneratedExpression"
|
389
|
+
optional :pickle_step_argument, :message, 3, "io.cucumber.messages.PickleStepArgument"
|
388
390
|
end
|
389
391
|
add_message "io.cucumber.messages.GeneratedExpression" do
|
390
392
|
optional :text, :string, 1
|
391
|
-
repeated :
|
393
|
+
repeated :parameter_type_names, :string, 2
|
392
394
|
end
|
393
395
|
add_enum "io.cucumber.messages.SourcesOrderType" do
|
394
396
|
value :ORDER_OF_DEFINITION, 0
|
@@ -456,10 +458,10 @@ module Cucumber
|
|
456
458
|
SourcesOrder = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.SourcesOrder").msgclass
|
457
459
|
RuntimeConfig = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.RuntimeConfig").msgclass
|
458
460
|
SupportCodeConfig = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.SupportCodeConfig").msgclass
|
459
|
-
|
460
|
-
|
461
|
+
Hook = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.Hook").msgclass
|
462
|
+
StepDefinition = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.StepDefinition").msgclass
|
461
463
|
StepDefinitionPattern = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.StepDefinitionPattern").msgclass
|
462
|
-
|
464
|
+
ParameterType = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.ParameterType").msgclass
|
463
465
|
CommandActionComplete = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.CommandActionComplete").msgclass
|
464
466
|
CommandRunBeforeTestRunHooks = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.CommandRunBeforeTestRunHooks").msgclass
|
465
467
|
CommandRunAfterTestRunHooks = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.CommandRunAfterTestRunHooks").msgclass
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'cucumber/messages'
|
3
|
+
|
4
|
+
describe Cucumber::Messages::IdGenerator::Incrementing do
|
5
|
+
subject { Cucumber::Messages::IdGenerator::Incrementing.new }
|
6
|
+
|
7
|
+
context '#new_id' do
|
8
|
+
it 'returns 0 the first time' do
|
9
|
+
expect(subject.new_id).to eq("0")
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'increments on every call' do
|
13
|
+
expect(subject.new_id).to eq("0")
|
14
|
+
expect(subject.new_id).to eq("1")
|
15
|
+
expect(subject.new_id).to eq("2")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe Cucumber::Messages::IdGenerator::UUID do
|
21
|
+
subject { Cucumber::Messages::IdGenerator::UUID.new }
|
22
|
+
|
23
|
+
context '#new_id' do
|
24
|
+
it 'generates a UUID' do
|
25
|
+
allowed_characters = "[0-9a-fA-F]"
|
26
|
+
expect(subject.new_id).to match(/#{allowed_characters}{8}\-#{allowed_characters}{4}\-#{allowed_characters}{4}\-#{allowed_characters}{4}\-#{allowed_characters}{12}/)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'cucumber/messages'
|
2
|
+
|
3
|
+
module Cucumber
|
4
|
+
module Messages
|
5
|
+
describe Messages do
|
6
|
+
|
7
|
+
it "can be serialised over an ndjson stream" do
|
8
|
+
outgoing_messages = [
|
9
|
+
Envelope.new(source: Source.new(data: 'Feature: Hello')),
|
10
|
+
Envelope.new(attachment: Attachment.new(data: 'some stack trace'))
|
11
|
+
]
|
12
|
+
|
13
|
+
io = StringIO.new
|
14
|
+
write_outgoing_messages(outgoing_messages, io)
|
15
|
+
|
16
|
+
io.rewind
|
17
|
+
incoming_messages = NdjsonToMessageEnumerator.new(io)
|
18
|
+
|
19
|
+
expect(incoming_messages.to_a).to(eq(outgoing_messages))
|
20
|
+
end
|
21
|
+
|
22
|
+
def write_outgoing_messages(messages, out)
|
23
|
+
messages.each do |message|
|
24
|
+
message.write_ndjson_to(out)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/spec/cucumber/messages/{message_serialization_spec.rb → protobuf_serialization_spec.rb}
RENAMED
@@ -4,25 +4,21 @@ module Cucumber
|
|
4
4
|
module Messages
|
5
5
|
describe Messages do
|
6
6
|
|
7
|
-
it "can be serialised over a stream" do
|
8
|
-
outgoing_messages =
|
7
|
+
it "can be serialised over a binary stream" do
|
8
|
+
outgoing_messages = [
|
9
|
+
Envelope.new(source: Source.new(data: 'Feature: Hello')),
|
10
|
+
Envelope.new(attachment: Attachment.new(data: 'some stack trace'))
|
11
|
+
]
|
9
12
|
|
10
13
|
io = StringIO.new
|
11
14
|
write_outgoing_messages(outgoing_messages, io)
|
12
15
|
|
13
16
|
io.rewind
|
14
|
-
incoming_messages =
|
17
|
+
incoming_messages = BinaryToMessageEnumerator.new(io)
|
15
18
|
|
16
19
|
expect(incoming_messages.to_a).to(eq(outgoing_messages))
|
17
20
|
end
|
18
21
|
|
19
|
-
def create_outgoing_messages
|
20
|
-
return [
|
21
|
-
Envelope.new(source: Source.new(data: 'Feature: Hello')),
|
22
|
-
Envelope.new(attachment: Attachment.new(data: 'some stack trace'))
|
23
|
-
]
|
24
|
-
end
|
25
|
-
|
26
22
|
def write_outgoing_messages(messages, out)
|
27
23
|
messages.each do |message|
|
28
24
|
message.write_delimited_to(out)
|
@@ -30,4 +26,4 @@ module Cucumber
|
|
30
26
|
end
|
31
27
|
end
|
32
28
|
end
|
33
|
-
end
|
29
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'cucumber/messages'
|
2
|
+
|
3
|
+
module Cucumber
|
4
|
+
module Messages
|
5
|
+
describe TimeConversion do
|
6
|
+
include TimeConversion
|
7
|
+
|
8
|
+
it 'converts to and from milliseconds since epoch' do
|
9
|
+
time = Time.now
|
10
|
+
timestamp = time_to_timestamp(time)
|
11
|
+
time_again = timestamp_to_time(timestamp)
|
12
|
+
|
13
|
+
expect(time_again).to eq(time)
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
it 'converts to and from seconds duration' do
|
18
|
+
duration_in_seconds = 1234
|
19
|
+
duration = seconds_to_duration(duration_in_seconds)
|
20
|
+
duration_in_seconds_again = duration_to_seconds(duration)
|
21
|
+
|
22
|
+
expect(duration_in_seconds_again).to eq(duration_in_seconds)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber-messages
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 8.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aslak Hellesøy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-protobuf
|
@@ -30,6 +30,26 @@ dependencies:
|
|
30
30
|
- - "<="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '3.8'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: json
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '2.2'
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 2.2.0
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '2.2'
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 2.2.0
|
33
53
|
- !ruby/object:Gem::Dependency
|
34
54
|
name: rake
|
35
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -99,13 +119,20 @@ files:
|
|
99
119
|
- LICENSE
|
100
120
|
- README.md
|
101
121
|
- lib/cucumber/messages.rb
|
122
|
+
- lib/cucumber/messages/binary_to_message_enumerator.rb
|
123
|
+
- lib/cucumber/messages/id_generator.rb
|
124
|
+
- lib/cucumber/messages/ndjson_to_message_enumerator.rb
|
102
125
|
- lib/cucumber/messages/protobuf_delimited.rb
|
103
|
-
- lib/cucumber/messages/
|
126
|
+
- lib/cucumber/messages/protobuf_ndjson.rb
|
127
|
+
- lib/cucumber/messages/time_conversion.rb
|
104
128
|
- lib/cucumber/messages/varint.rb
|
105
129
|
- lib/cucumber/messages_pb.rb
|
106
130
|
- spec/capture_warnings.rb
|
107
131
|
- spec/coverage.rb
|
108
|
-
- spec/cucumber/messages/
|
132
|
+
- spec/cucumber/messages/id_generator_spec.rb
|
133
|
+
- spec/cucumber/messages/ndjson_serialization_spec.rb
|
134
|
+
- spec/cucumber/messages/protobuf_serialization_spec.rb
|
135
|
+
- spec/cucumber/messages/time_conversion_spec.rb
|
109
136
|
homepage: https://github.com/cucumber/cucumber-messages-ruby#readme
|
110
137
|
licenses:
|
111
138
|
- MIT
|
@@ -135,8 +162,11 @@ rubyforge_project:
|
|
135
162
|
rubygems_version: 2.7.6.2
|
136
163
|
signing_key:
|
137
164
|
specification_version: 4
|
138
|
-
summary: cucumber-messages-
|
165
|
+
summary: cucumber-messages-8.0.0
|
139
166
|
test_files:
|
140
|
-
- spec/cucumber/messages/
|
167
|
+
- spec/cucumber/messages/time_conversion_spec.rb
|
168
|
+
- spec/cucumber/messages/ndjson_serialization_spec.rb
|
169
|
+
- spec/cucumber/messages/protobuf_serialization_spec.rb
|
170
|
+
- spec/cucumber/messages/id_generator_spec.rb
|
141
171
|
- spec/capture_warnings.rb
|
142
172
|
- spec/coverage.rb
|