cucumber-messages 9.0.3 → 10.0.1
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.pb.rb +13 -5
- data/lib/cucumber/messages/protobuf_ndjson.rb +2 -21
- data/lib/cucumber/messages/time_conversion.rb +2 -2
- data/spec/cucumber/messages/ndjson_serialization_spec.rb +33 -1
- data/spec/cucumber/messages/time_conversion_spec.rb +8 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3548d581ea0cbe4a0e13073a6e0886b98bea566f76414b1d7cb0c94a87e91321
|
4
|
+
data.tar.gz: 6eea11ad3537fc9cf1c89fb2721fa1df4426939ba08c84563d3853c556be6fc8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12fbf050c3ed3f149bf495432d3b886635dd5d63ec9e30b114c92b4c3437784601907ee5b2e14514c873f812cb88916bdfd7793b6c5a3c363bc979e441c2a731
|
7
|
+
data.tar.gz: 82d61564a8a814a36b68c3ec025e721f4ba9098a948258f29c55484c270fdb616905c3efb897e05837de699ae311c1ca43f57a99b07c738192cd4de187c8e2e0
|
data/lib/cucumber/messages.pb.rb
CHANGED
@@ -108,7 +108,7 @@ module Cucumber
|
|
108
108
|
class TestCaseFinished < ::Protobuf::Message; end
|
109
109
|
class TestStepStarted < ::Protobuf::Message; end
|
110
110
|
class TestStepFinished < ::Protobuf::Message; end
|
111
|
-
class
|
111
|
+
class TestStepResult < ::Protobuf::Message
|
112
112
|
class Status < ::Protobuf::Enum
|
113
113
|
define :UNKNOWN, 0
|
114
114
|
define :PASSED, 1
|
@@ -133,6 +133,7 @@ module Cucumber
|
|
133
133
|
class StepDefinition < ::Protobuf::Message; end
|
134
134
|
class StepDefinitionPattern < ::Protobuf::Message; end
|
135
135
|
class ParameterType < ::Protobuf::Message; end
|
136
|
+
class UndefinedParameterType < ::Protobuf::Message; end
|
136
137
|
class CommandActionComplete < ::Protobuf::Message; end
|
137
138
|
class CommandRunBeforeTestRunHooks < ::Protobuf::Message; end
|
138
139
|
class CommandRunAfterTestRunHooks < ::Protobuf::Message; end
|
@@ -196,6 +197,7 @@ module Cucumber
|
|
196
197
|
optional ::Cucumber::Messages::StepDefinition, :step_definition, 25
|
197
198
|
optional ::Cucumber::Messages::Hook, :hook, 26
|
198
199
|
optional ::Cucumber::Messages::ParameterType, :parameter_type, 27
|
200
|
+
optional ::Cucumber::Messages::UndefinedParameterType, :undefined_parameter_type, 28
|
199
201
|
end
|
200
202
|
|
201
203
|
class Location
|
@@ -441,14 +443,14 @@ module Cucumber
|
|
441
443
|
end
|
442
444
|
|
443
445
|
class TestStepFinished
|
444
|
-
optional ::Cucumber::Messages::
|
446
|
+
optional ::Cucumber::Messages::TestStepResult, :test_step_result, 1
|
445
447
|
optional ::Cucumber::Messages::Timestamp, :timestamp, 2
|
446
448
|
optional :string, :test_step_id, 3
|
447
449
|
optional :string, :test_case_started_id, 4
|
448
450
|
end
|
449
451
|
|
450
|
-
class
|
451
|
-
optional ::Cucumber::Messages::
|
452
|
+
class TestStepResult
|
453
|
+
optional ::Cucumber::Messages::TestStepResult::Status, :status, 1
|
452
454
|
optional :string, :message, 2
|
453
455
|
optional ::Cucumber::Messages::Duration, :duration, 3
|
454
456
|
optional :bool, :will_be_retried, 4
|
@@ -457,6 +459,7 @@ module Cucumber
|
|
457
459
|
class TestRunFinished
|
458
460
|
optional :bool, :success, 1
|
459
461
|
optional ::Cucumber::Messages::Timestamp, :timestamp, 2
|
462
|
+
optional :string, :message, 3
|
460
463
|
end
|
461
464
|
|
462
465
|
class CommandStart
|
@@ -527,9 +530,14 @@ module Cucumber
|
|
527
530
|
optional :bool, :use_for_snippets, 4
|
528
531
|
end
|
529
532
|
|
533
|
+
class UndefinedParameterType
|
534
|
+
optional :string, :name, 1
|
535
|
+
optional :string, :expression, 2
|
536
|
+
end
|
537
|
+
|
530
538
|
class CommandActionComplete
|
531
539
|
optional :string, :completed_id, 1
|
532
|
-
optional ::Cucumber::Messages::
|
540
|
+
optional ::Cucumber::Messages::TestStepResult, :test_step_result, 2
|
533
541
|
optional :string, :snippet, 3
|
534
542
|
end
|
535
543
|
|
@@ -4,27 +4,8 @@ module Cucumber
|
|
4
4
|
module Messages
|
5
5
|
module WriteNdjson
|
6
6
|
def write_ndjson_to(io)
|
7
|
-
|
8
|
-
|
9
|
-
ob = JSON.parse(json)
|
10
|
-
remove_empties(ob)
|
11
|
-
io.puts(JSON.generate(ob))
|
12
|
-
end
|
13
|
-
|
14
|
-
def remove_empties(ob)
|
15
|
-
if Hash === ob
|
16
|
-
ob.each do |key, value|
|
17
|
-
if value == [] || value == '' || value == 0
|
18
|
-
ob.delete(key)
|
19
|
-
else
|
20
|
-
remove_empties(value)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
elsif Array === ob
|
24
|
-
ob.each do |value|
|
25
|
-
remove_empties(value)
|
26
|
-
end
|
27
|
-
end
|
7
|
+
io.write(self.to_json(proto3: true))
|
8
|
+
io.write("\n")
|
28
9
|
end
|
29
10
|
end
|
30
11
|
end
|
@@ -14,13 +14,13 @@ module Cucumber
|
|
14
14
|
|
15
15
|
def seconds_to_duration(seconds_float)
|
16
16
|
seconds, second_modulus = seconds_float.divmod(1)
|
17
|
-
nanos = second_modulus
|
17
|
+
nanos = second_modulus * NANOSECONDS_PER_SECOND
|
18
18
|
Duration.new(seconds: seconds, nanos: nanos)
|
19
19
|
end
|
20
20
|
|
21
21
|
def duration_to_seconds(duration)
|
22
22
|
seconds_part = duration.seconds
|
23
|
-
nanos_part = duration.nanos / NANOSECONDS_PER_SECOND
|
23
|
+
nanos_part = duration.nanos.to_f / NANOSECONDS_PER_SECOND
|
24
24
|
seconds_part + nanos_part
|
25
25
|
end
|
26
26
|
end
|
@@ -7,7 +7,7 @@ module Cucumber
|
|
7
7
|
it "json-roundtrips messages with bytes fields" do
|
8
8
|
a1 = Attachment.new(binary: [1,2,3,4].pack('C*'))
|
9
9
|
expect(a1.binary.length).to eq(4)
|
10
|
-
a2 = Attachment.new(JSON.parse(a1.to_json))
|
10
|
+
a2 = Attachment.new(JSON.parse(a1.to_json(proto3: true)))
|
11
11
|
expect(a2).to(eq(a1))
|
12
12
|
end
|
13
13
|
|
@@ -22,6 +22,38 @@ module Cucumber
|
|
22
22
|
expect(json).to eq("{\"source\":{}}\n")
|
23
23
|
end
|
24
24
|
|
25
|
+
it "omits empty number fields in output" do
|
26
|
+
io = StringIO.new
|
27
|
+
message = Envelope.new(
|
28
|
+
test_case_started: TestCaseStarted.new(
|
29
|
+
timestamp: Timestamp.new(
|
30
|
+
seconds: 0
|
31
|
+
)
|
32
|
+
)
|
33
|
+
)
|
34
|
+
message.write_ndjson_to(io)
|
35
|
+
|
36
|
+
io.rewind
|
37
|
+
json = io.read
|
38
|
+
|
39
|
+
expect(json).to eq('{"testCaseStarted":{"timestamp":{}}}' + "\n")
|
40
|
+
end
|
41
|
+
|
42
|
+
it "omits empty repeated fields in output" do
|
43
|
+
io = StringIO.new
|
44
|
+
message = Envelope.new(
|
45
|
+
parameter_type: ParameterType.new(
|
46
|
+
regular_expressions: []
|
47
|
+
)
|
48
|
+
)
|
49
|
+
message.write_ndjson_to(io)
|
50
|
+
|
51
|
+
io.rewind
|
52
|
+
json = io.read
|
53
|
+
|
54
|
+
expect(json).to eq('{"parameterType":{}}' + "\n")
|
55
|
+
end
|
56
|
+
|
25
57
|
it "can be serialised over an ndjson stream" do
|
26
58
|
outgoing_messages = [
|
27
59
|
Envelope.new(source: Source.new(data: 'Feature: Hello')),
|
@@ -13,7 +13,6 @@ module Cucumber
|
|
13
13
|
expect(time_again).to eq(time)
|
14
14
|
end
|
15
15
|
|
16
|
-
|
17
16
|
it 'converts to and from seconds duration' do
|
18
17
|
duration_in_seconds = 1234
|
19
18
|
duration = seconds_to_duration(duration_in_seconds)
|
@@ -21,6 +20,14 @@ module Cucumber
|
|
21
20
|
|
22
21
|
expect(duration_in_seconds_again).to eq(duration_in_seconds)
|
23
22
|
end
|
23
|
+
|
24
|
+
it 'converts to and from seconds duration (with decimal places)' do
|
25
|
+
duration_in_seconds = 3.000161
|
26
|
+
duration = seconds_to_duration(duration_in_seconds)
|
27
|
+
duration_in_seconds_again = duration_to_seconds(duration)
|
28
|
+
|
29
|
+
expect(duration_in_seconds_again).to be_within(0.000000001).of(duration_in_seconds)
|
30
|
+
end
|
24
31
|
end
|
25
32
|
end
|
26
33
|
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: 10.0.1
|
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: 2020-
|
11
|
+
date: 2020-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: protobuf-cucumber
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '3.10'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 3.10.
|
22
|
+
version: 3.10.8
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '3.10'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 3.10.
|
32
|
+
version: 3.10.8
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: json
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -162,7 +162,7 @@ rubyforge_project:
|
|
162
162
|
rubygems_version: 2.7.6.2
|
163
163
|
signing_key:
|
164
164
|
specification_version: 4
|
165
|
-
summary: cucumber-messages-
|
165
|
+
summary: cucumber-messages-10.0.1
|
166
166
|
test_files:
|
167
167
|
- spec/cucumber/messages/time_conversion_spec.rb
|
168
168
|
- spec/cucumber/messages/ndjson_serialization_spec.rb
|