cucumber-messages 22.0.0 → 24.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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: 22.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-04-06 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
@@ -16,20 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '11.0'
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: 11.0.0
19
+ version: '12.0'
23
20
  type: :development
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
24
  - - "~>"
28
25
  - !ruby/object:Gem::Version
29
- version: '11.0'
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: 11.0.0
26
+ version: '12.0'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: rake
35
29
  requirement: !ruby/object:Gem::Requirement
@@ -56,27 +50,48 @@ dependencies:
56
50
  requirements:
57
51
  - - "~>"
58
52
  - !ruby/object:Gem::Version
59
- version: '3.11'
60
- - - ">="
53
+ version: '3.12'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '3.12'
61
+ - !ruby/object:Gem::Dependency
62
+ name: rubocop
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
61
66
  - !ruby/object:Gem::Version
62
- version: 3.11.0
67
+ version: 1.28.0
63
68
  type: :development
64
69
  prerelease: false
65
70
  version_requirements: !ruby/object:Gem::Requirement
66
71
  requirements:
67
72
  - - "~>"
68
73
  - !ruby/object:Gem::Version
69
- version: '3.11'
70
- - - ">="
74
+ version: 1.28.0
75
+ - !ruby/object:Gem::Dependency
76
+ name: rubocop-rspec
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: 2.5.0
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
71
87
  - !ruby/object:Gem::Version
72
- version: 3.11.0
88
+ version: 2.5.0
73
89
  description: Protocol Buffer messages for Cucumber's inter-process communication
74
90
  email: cukes@googlegroups.com
75
91
  executables: []
76
92
  extensions: []
77
93
  extra_rdoc_files: []
78
94
  files:
79
- - LICENSE
80
95
  - README.md
81
96
  - VERSION
82
97
  - lib/cucumber/messages.deserializers.rb
@@ -89,16 +104,6 @@ files:
89
104
  - lib/cucumber/messages/message/utils.rb
90
105
  - lib/cucumber/messages/ndjson_to_message_enumerator.rb
91
106
  - lib/cucumber/messages/time_conversion.rb
92
- - spec/capture_warnings.rb
93
- - spec/cucumber/messages/acceptance_spec.rb
94
- - spec/cucumber/messages/id_generator_spec.rb
95
- - spec/cucumber/messages/message/deserialization_spec.rb
96
- - spec/cucumber/messages/message/dummy_messages.rb
97
- - spec/cucumber/messages/message/serialization_spec.rb
98
- - spec/cucumber/messages/message/utils_spec.rb
99
- - spec/cucumber/messages/ndjson_serialization_spec.rb
100
- - spec/cucumber/messages/time_conversion_spec.rb
101
- - spec/cucumber/messages/version_spec.rb
102
107
  homepage: https://github.com/cucumber/messages-ruby#readme
103
108
  licenses:
104
109
  - MIT
@@ -117,25 +122,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
117
122
  requirements:
118
123
  - - ">="
119
124
  - !ruby/object:Gem::Version
120
- version: '2.3'
125
+ version: '2.5'
121
126
  required_rubygems_version: !ruby/object:Gem::Requirement
122
127
  requirements:
123
128
  - - ">="
124
129
  - !ruby/object:Gem::Version
125
- version: '0'
130
+ version: 3.0.0
126
131
  requirements: []
127
- rubygems_version: 3.2.22
132
+ rubygems_version: 3.4.10
128
133
  signing_key:
129
134
  specification_version: 4
130
- summary: cucumber-messages-22.0.0
131
- test_files:
132
- - spec/capture_warnings.rb
133
- - spec/cucumber/messages/acceptance_spec.rb
134
- - spec/cucumber/messages/id_generator_spec.rb
135
- - spec/cucumber/messages/message/deserialization_spec.rb
136
- - spec/cucumber/messages/message/dummy_messages.rb
137
- - spec/cucumber/messages/message/serialization_spec.rb
138
- - spec/cucumber/messages/message/utils_spec.rb
139
- - spec/cucumber/messages/ndjson_serialization_spec.rb
140
- - spec/cucumber/messages/time_conversion_spec.rb
141
- - 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,74 +0,0 @@
1
- # frozen_string_literal: true
2
- # With thanks to @myronmarston
3
- # https://github.com/vcr/vcr/blob/master/spec/capture_warnings.rb
4
-
5
- module CaptureWarnings
6
- def report_warnings(&block)
7
- current_dir = Dir.pwd
8
- warnings, errors = capture_error(&block).partition { |line| line.include?('warning') }
9
- project_warnings, other_warnings = warnings.uniq.partition { |line| line.include?(current_dir) }
10
-
11
- if errors.any?
12
- puts errors.join("\n")
13
- end
14
-
15
- if other_warnings.any?
16
- puts "#{ other_warnings.count } warnings detected, set VIEW_OTHER_WARNINGS=true to see them."
17
- print_warnings('other', other_warnings) if ENV['VIEW_OTHER_WARNINGS']
18
- end
19
-
20
- # Until they fix https://bugs.ruby-lang.org/issues/10661
21
- if RUBY_VERSION == "2.2.0"
22
- project_warnings = project_warnings.reject { |w| w =~ /warning: possible reference to past scope/ }
23
- end
24
-
25
- if project_warnings.any?
26
- puts "#{ project_warnings.count } warnings detected"
27
- print_warnings('cucumber-expressions', project_warnings)
28
- fail "Please remove all cucumber-expressions warnings."
29
- end
30
-
31
- ensure_system_exit_if_required
32
- end
33
-
34
- def capture_error(&block)
35
- old_stderr = STDERR.clone
36
- pipe_r, pipe_w = IO.pipe
37
- pipe_r.sync = true
38
- error = String.new
39
- reader = Thread.new do
40
- begin
41
- loop do
42
- error << pipe_r.readpartial(1024)
43
- end
44
- rescue EOFError
45
- end
46
- end
47
- STDERR.reopen(pipe_w)
48
- block.call
49
- ensure
50
- capture_system_exit
51
- STDERR.reopen(old_stderr)
52
- pipe_w.close
53
- reader.join
54
- return error.split("\n")
55
- end
56
-
57
- def print_warnings(type, warnings)
58
- puts
59
- puts "-" * 30 + " #{type} warnings: " + "-" * 30
60
- puts
61
- puts warnings.join("\n")
62
- puts
63
- puts "-" * 75
64
- puts
65
- end
66
-
67
- def ensure_system_exit_if_required
68
- raise @system_exit if @system_exit
69
- end
70
-
71
- def capture_system_exit
72
- @system_exit = $!
73
- end
74
- end
@@ -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