cucumber-messages 23.0.0 → 24.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f3e34f0e901f03d378d86cfde3105013175abb51fae73ae3e8f35ee7289a2630
4
- data.tar.gz: 2c6aa8f4cc28c3efe0de69adc5968327a3018042150b57a37b07acec4f798877
3
+ metadata.gz: 7b085c369dea71ce0fb539c4ee81dac76b95104259f831b61488b07c3cd85f97
4
+ data.tar.gz: 4c79d872aabd5da1fb5bd32865f0f7366d63ceebcfdf050b4102a2b3095d62fd
5
5
  SHA512:
6
- metadata.gz: 93211c9531aa658053848dd09d2f444b008c20b7d3ca8fd50b12e326739d50e9d695df81659c34fe5bb7bbb5848a5de7d2f36cde2133bef3a9b5343a9a58b467
7
- data.tar.gz: 6134322a493e06050b0080abf3236d8a49665e34d83eda3a9ed8ca40ef0001339e5f34811d6f57a1dec70906a29bc39f0cefd0cba7a0ebd002788dd6593d2450
6
+ metadata.gz: 0777da94145cac9e323e2977f8d673e3ec96560d9c9ceb58eec4dc3b420fee1c18d534dce2b7ae66ed58201f144c00187e2e46273c1708f45c889fa166c923d7
7
+ data.tar.gz: 2c1f0e69b5a66a6ce338d301a58350d11170777e27b94fd1ee22f9c77db68300f887f65dace19e7c4b4e55010978398faea442ffa1eaaef18ea3c7659f4d3d8d
data/VERSION CHANGED
@@ -1 +1 @@
1
- 23.0.0
1
+ 24.0.0
@@ -104,6 +104,7 @@ module Cucumber
104
104
  self.new(
105
105
  type: hash[:type],
106
106
  message: hash[:message],
107
+ stack_trace: hash[:stackTrace],
107
108
  )
108
109
  end
109
110
  end
@@ -229,12 +229,19 @@ module Cucumber
229
229
  ##
230
230
  attr_reader :message
231
231
 
232
+ ##
233
+ # The stringified stack trace of the exception that caused this result
234
+ ##
235
+ attr_reader :stack_trace
236
+
232
237
  def initialize(
233
238
  type: '',
234
- message: nil
239
+ message: nil,
240
+ stack_trace: nil
235
241
  )
236
242
  @type = type
237
243
  @message = message
244
+ @stack_trace = stack_trace
238
245
  end
239
246
  end
240
247
 
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: 23.0.0
4
+ version: 24.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: 2023-11-01 00:00:00.000000000 Z
11
+ date: 2023-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber-compatibility-kit
@@ -92,7 +92,6 @@ executables: []
92
92
  extensions: []
93
93
  extra_rdoc_files: []
94
94
  files:
95
- - LICENSE
96
95
  - README.md
97
96
  - VERSION
98
97
  - lib/cucumber/messages.deserializers.rb
@@ -105,15 +104,6 @@ files:
105
104
  - lib/cucumber/messages/message/utils.rb
106
105
  - lib/cucumber/messages/ndjson_to_message_enumerator.rb
107
106
  - lib/cucumber/messages/time_conversion.rb
108
- - spec/cucumber/messages/acceptance_spec.rb
109
- - spec/cucumber/messages/id_generator_spec.rb
110
- - spec/cucumber/messages/message/deserialization_spec.rb
111
- - spec/cucumber/messages/message/dummy_messages.rb
112
- - spec/cucumber/messages/message/serialization_spec.rb
113
- - spec/cucumber/messages/message/utils_spec.rb
114
- - spec/cucumber/messages/ndjson_serialization_spec.rb
115
- - spec/cucumber/messages/time_conversion_spec.rb
116
- - spec/cucumber/messages/version_spec.rb
117
107
  homepage: https://github.com/cucumber/messages-ruby#readme
118
108
  licenses:
119
109
  - MIT
@@ -142,14 +132,5 @@ requirements: []
142
132
  rubygems_version: 3.4.10
143
133
  signing_key:
144
134
  specification_version: 4
145
- summary: cucumber-messages-23.0.0
146
- test_files:
147
- - spec/cucumber/messages/acceptance_spec.rb
148
- - spec/cucumber/messages/id_generator_spec.rb
149
- - spec/cucumber/messages/message/deserialization_spec.rb
150
- - spec/cucumber/messages/message/dummy_messages.rb
151
- - spec/cucumber/messages/message/serialization_spec.rb
152
- - spec/cucumber/messages/message/utils_spec.rb
153
- - spec/cucumber/messages/ndjson_serialization_spec.rb
154
- - spec/cucumber/messages/time_conversion_spec.rb
155
- - spec/cucumber/messages/version_spec.rb
135
+ summary: cucumber-messages-24.0.0
136
+ test_files: []
data/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) Cucumber Ltd
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,33 +0,0 @@
1
- require 'json'
2
- require 'cucumber/messages'
3
- require 'cucumber-compatibility-kit'
4
-
5
- module Cucumber
6
- module Messages
7
- describe 'messages acdeptance tests' do
8
- ndjson_files = Dir["#{Cucumber::CompatibilityKit::examples_path}/**/*.ndjson"]
9
-
10
- it 'must have ndjson_files as reference messages' do
11
- expect(ndjson_files).not_to be_empty
12
- end
13
-
14
- ndjson_files.each do |ndjson_file|
15
- it "deserialises and serialises messages in #{ndjson_file}" do
16
- File.open(ndjson_file, 'r:utf-8') do |io|
17
- io.each_line do |json|
18
- check(json)
19
- end
20
- end
21
- end
22
- end
23
-
24
- def check(json)
25
- hash = JSON.parse(json)
26
- envelope = Envelope.from_json(json)
27
- new_json = envelope.to_json
28
- new_hash = JSON.parse(new_json)
29
- expect(new_hash).to eq(hash)
30
- end
31
- end
32
- end
33
- end
@@ -1,29 +0,0 @@
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
@@ -1,30 +0,0 @@
1
- require 'rspec'
2
- require 'cucumber/messages/message/dummy_messages'
3
-
4
- describe Cucumber::Messages::Message::Deserialization do
5
- describe '#from_json' do
6
- subject { Cucumber::Messages::Message.from_json(json_document) }
7
-
8
- let(:json_document) { '' }
9
-
10
- context 'with a valid JSON document' do
11
- let(:json_document) { '{"simpleMessage":{"isString":"answer"}}' }
12
-
13
- it 'deserialize the message using #from_h' do
14
- allow(Cucumber::Messages::Message).to receive(:from_h)
15
-
16
- subject
17
-
18
- expect(Cucumber::Messages::Message)
19
- .to have_received(:from_h)
20
- .with({ simpleMessage: { isString: "answer" } })
21
- end
22
- end
23
-
24
- context 'with an invalid JSON document' do
25
- let(:json_document) { '{foo: bar}' }
26
-
27
- it { expect { subject }.to raise_error(JSON::ParserError) }
28
- end
29
- end
30
- end
@@ -1,38 +0,0 @@
1
- require 'cucumber/messages/message'
2
-
3
- module Cucumber::Messages
4
- class SimpleMessage < Message
5
- attr_reader :is_nil, :is_string, :is_array, :is_number
6
-
7
- def initialize(is_nil: nil, is_string: '', is_array: [], is_number: 0)
8
- @is_nil = is_nil
9
- @is_string = is_string
10
- @is_array = is_array
11
- @is_number = is_number
12
- end
13
- end
14
-
15
- class EnumMessage
16
- ENUM = 'an enum'
17
- end
18
-
19
- class ComprehensiveMessage < Message
20
- attr_reader :simple_message, :message_array, :is_enum
21
-
22
- def initialize(
23
- simple_message: SimpleMessage.new,
24
- message_array: [SimpleMessage.new, SimpleMessage.new],
25
- is_enum: EnumMessage::ENUM
26
- )
27
- @simple_message = simple_message
28
- @message_array = message_array
29
- @is_enum = is_enum
30
- end
31
-
32
- private
33
-
34
- def self.message_array_from_h(hash)
35
- SimpleMessage.from_h(hash)
36
- end
37
- end
38
- end
@@ -1,89 +0,0 @@
1
- require 'rspec'
2
- require 'cucumber/messages/message/dummy_messages'
3
-
4
- describe Cucumber::Messages::Message::Serialization do
5
- context 'with a simple message' do
6
- describe '#to_h' do
7
- subject { Cucumber::Messages::SimpleMessage.new.to_h }
8
-
9
- it 'returns a Hash with all the attributes of the Message' do
10
- expect(subject).to eq({ is_nil: nil, is_string: '', is_array: [], is_number: 0 })
11
- end
12
-
13
- context 'whith camelize: true' do
14
- subject { Cucumber::Messages::SimpleMessage.new.to_h(camelize: true) }
15
-
16
- it 'camelize the keys of the resulting hash' do
17
- expect(subject).to eq({ isNil: nil, isString: '', isArray: [], isNumber: 0 })
18
- end
19
- end
20
-
21
- context 'with reject_nil_values: true' do
22
- subject { Cucumber::Messages::SimpleMessage.new.to_h(reject_nil_values: true) }
23
-
24
- it 'rejects nil values from the resulting hash' do
25
- expect(subject).to eq({ is_string: '', is_array: [], is_number: 0 })
26
- end
27
- end
28
- end
29
-
30
- describe '#to_json' do
31
- subject { Cucumber::Messages::SimpleMessage.new.to_json }
32
-
33
- it 'returns a JSON document with all the attributes of the Message except nil values' do
34
- expect(subject).to eq({ isString: '', isArray: [], isNumber: 0 }.to_json)
35
- end
36
- end
37
- end
38
-
39
- context 'with a message which embeds other messages' do
40
- describe '#to_h' do
41
- subject { Cucumber::Messages::ComprehensiveMessage.new.to_h }
42
-
43
- it 'includes hash representation of embedded messages' do
44
- expect(subject[:simple_message]).to eq({ is_nil: nil, is_string: '', is_array: [], is_number: 0 })
45
- expect(subject[:is_enum]).to eq 'an enum'
46
- end
47
-
48
- it 'includes hash representation of messages arrays' do
49
- expect(subject[:message_array]).to eq([
50
- { is_nil: nil, is_string: '', is_array: [], is_number: 0 },
51
- { is_nil: nil, is_string: '', is_array: [], is_number: 0 }
52
- ])
53
- end
54
-
55
- context 'whith camelize: true' do
56
- subject { Cucumber::Messages::ComprehensiveMessage.new.to_h(camelize: true) }
57
-
58
- it 'camelize the keys of the embedded messages resulting hashes' do
59
- expect(subject[:simpleMessage]).to eq({ isNil: nil, isString: '', isArray: [], isNumber: 0 })
60
- end
61
-
62
- it 'camelize the keys of hashes for messages arrays' do
63
- expect(subject[:messageArray]).to eq([
64
- { isNil: nil, isString: '', isArray: [], isNumber: 0 },
65
- { isNil: nil, isString: '', isArray: [], isNumber: 0 }
66
- ])
67
- end
68
- end
69
- end
70
-
71
- describe '#to_json' do
72
- subject { Cucumber::Messages::ComprehensiveMessage.new.to_json }
73
-
74
- it 'returns a JSON document with embedded messages' do
75
- expect(subject).to include({ isString: '', isArray: [], isNumber: 0}.to_json)
76
- expect(subject).to include('"isEnum":"an enum"')
77
- end
78
-
79
- it 'returns a JSON document with messages arrays' do
80
- expect(subject).to include(
81
- [
82
- { isString: '', isArray: [], isNumber: 0},
83
- { isString: '', isArray: [], isNumber: 0}
84
- ].to_json
85
- )
86
- end
87
- end
88
- end
89
- end
@@ -1,30 +0,0 @@
1
- require 'rspec'
2
- require 'cucumber/messages/message/utils'
3
-
4
- class DummyTestClass
5
- include Cucumber::Messages::Message::Utils
6
- end
7
-
8
- describe Cucumber::Messages::Message::Utils do
9
- subject { DummyTestClass }
10
-
11
- describe '#underscore' do
12
- it { expect(subject.underscore('test')).to eq 'test' }
13
- it { expect(subject.underscore('testTest')).to eq 'test_test' }
14
- it { expect(subject.underscore('')).to eq '' }
15
- it { expect(subject.underscore('T')).to eq 't' }
16
- it { expect(subject.underscore('test123test456Test')).to eq 'test123test456_test' }
17
- it { expect(subject.underscore('test-test')).to eq 'test_test' }
18
- it { expect(subject.underscore('TEST_Test')).to eq 'test_test' }
19
- it { expect(subject.underscore('test-Test')).to eq 'test_test' }
20
- end
21
-
22
- describe '#camelize' do
23
- it { expect(subject.camelize('test')).to eq 'test' }
24
- it { expect(subject.camelize('test_test')).to eq 'testTest' }
25
- it { expect(subject.camelize('Test_TeSt')).to eq 'TestTest' }
26
- it { expect(subject.camelize('')).to eq '' }
27
- it { expect(subject.camelize('test123test4_5_6_test')).to eq 'test123test456Test' }
28
- it { expect(subject.camelize('test-test')).to eq 'test-test' }
29
- end
30
- end
@@ -1,56 +0,0 @@
1
- require 'cucumber/messages'
2
-
3
- module Cucumber
4
- module Messages
5
- describe 'messages' do
6
- let(:outgoing_messages) do
7
- [
8
- Envelope.new(
9
- source: Source.new(data: 'Feature: Hello')
10
- ),
11
- Envelope.new(
12
- attachment: Attachment.new(body: 'Hello', content_encoding: AttachmentContentEncoding::IDENTITY)
13
- )
14
- ]
15
- end
16
-
17
- it "can be serialised over an ndjson stream" do
18
- io = StringIO.new
19
- write_outgoing_messages(outgoing_messages, io)
20
-
21
- io.rewind
22
- incoming_messages = NdjsonToMessageEnumerator.new(io)
23
-
24
- expect(incoming_messages.to_a.map(&:to_h)).to(eq(outgoing_messages.map(&:to_h)))
25
- end
26
-
27
- it "ignores empty lines" do
28
- io = StringIO.new
29
- write_outgoing_messages(outgoing_messages, io)
30
- io.write("\n\n")
31
-
32
- io.rewind
33
- incoming_messages = NdjsonToMessageEnumerator.new(io)
34
-
35
- expect(incoming_messages.to_a.map(&:to_h)).to(eq(outgoing_messages.map(&:to_h)))
36
- end
37
-
38
- it "includes offending line in error message" do
39
- io = StringIO.new
40
- io.puts('BLA BLA')
41
-
42
- io.rewind
43
- incoming_messages = NdjsonToMessageEnumerator.new(io)
44
-
45
- expect { incoming_messages.to_a }.to(raise_error('Not JSON: BLA BLA'))
46
- end
47
-
48
- def write_outgoing_messages(messages, out)
49
- messages.each do |message|
50
- out.write(message.to_json)
51
- out.write("\n")
52
- end
53
- end
54
- end
55
- end
56
- end
@@ -1,41 +0,0 @@
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).to be_within(0.000001).of(time_again)
14
- end
15
-
16
- it 'converts to and from seconds duration' do
17
- duration_in_seconds = 1234
18
- duration = seconds_to_duration(duration_in_seconds)
19
- duration_in_seconds_again = duration_to_seconds(duration)
20
-
21
- expect(duration_in_seconds_again).to eq(duration_in_seconds)
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
31
-
32
- it 'converts to a hash where seconds and nanos are integers' do
33
- duration_in_seconds = 3.000161
34
- duration = seconds_to_duration(duration_in_seconds)
35
-
36
- expect(duration['seconds']).to be_integer
37
- expect(duration['nanos']).to be_integer
38
- end
39
- end
40
- end
41
- end
@@ -1,11 +0,0 @@
1
- require 'cucumber/messages'
2
-
3
- module Cucumber
4
- module Messages
5
- describe VERSION do
6
- it 'should be defined' do
7
- expect(subject).to match(/\d+\.\d+\.\d+/)
8
- end
9
- end
10
- end
11
- end