protobuf 3.0.5 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/protobuf/field/enum_field.rb +6 -0
- data/lib/protobuf/version.rb +1 -1
- data/spec/lib/protobuf/message_spec.rb +59 -0
- metadata +75 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ad445d76d68be198e63dfba389d2b5deaf314ee
|
4
|
+
data.tar.gz: 3d36e1ce0747a04e82419c2a1ea8670fff05ace9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9f9e6009fc897608088233604949cbde5353950a2984108185e7b167e00335f53156ba46e0c60b1945a2d13052ce96508932b43e6aaf2b22964378485ec9701
|
7
|
+
data.tar.gz: d1b13590c827e3208b8a41bc267faf40e98aa1371f08255cfe02e490e77fb73f9b2667ee3c94a0430db7c274dcda2c5889c6d2810d3a56b0f04b69436845267f
|
data/lib/protobuf/version.rb
CHANGED
@@ -8,6 +8,65 @@ describe Protobuf::Message do
|
|
8
8
|
it 'creates a new message object decoded from the given bytes' do
|
9
9
|
expect(::Test::Resource.decode(message.encode)).to eq message
|
10
10
|
end
|
11
|
+
|
12
|
+
context 'with a new enum value' do
|
13
|
+
let(:older_message) do
|
14
|
+
Class.new(Protobuf::Message) do
|
15
|
+
enum_class = Class.new(::Protobuf::Enum) do
|
16
|
+
define :YAY, 1
|
17
|
+
end
|
18
|
+
|
19
|
+
optional enum_class, :enum_field, 1
|
20
|
+
repeated enum_class, :enum_list, 2
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
let(:newer_message) do
|
25
|
+
Class.new(Protobuf::Message) do
|
26
|
+
enum_class = Class.new(::Protobuf::Enum) do
|
27
|
+
define :YAY, 1
|
28
|
+
define :HOORAY, 2
|
29
|
+
end
|
30
|
+
|
31
|
+
optional enum_class, :enum_field, 1
|
32
|
+
repeated enum_class, :enum_list, 2
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
context 'with a singular field' do
|
37
|
+
it 'treats the field as if it was unset when decoding' do
|
38
|
+
newer = newer_message.new(:enum_field => :HOORAY).serialize
|
39
|
+
|
40
|
+
expect(older_message.decode(newer).enum_field!).to be_nil
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'rejects an unknown value when using the constructor' do
|
44
|
+
expect { older_message.new(:enum_field => :HOORAY) }.to raise_error
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'rejects an unknown value when the setter' do
|
48
|
+
older = older_message.new
|
49
|
+
expect { older.enum_field = :HOORAY }.to raise_error
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
context 'with a repeated field' do
|
54
|
+
it 'treats the field as if it was unset when decoding' do
|
55
|
+
newer = newer_message.new(:enum_list => [ :HOORAY ]).serialize
|
56
|
+
|
57
|
+
expect(older_message.decode(newer).enum_list).to eq([])
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'rejects an unknown value when using the constructor' do
|
61
|
+
expect { older_message.new(:enum_list => [ :HOORAY ]) }.to raise_error
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'rejects an unknown value when the setter' do
|
65
|
+
older = older_message.new
|
66
|
+
expect { older.enum_field = [ :HOORAY ] }.to raise_error
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
11
70
|
end
|
12
71
|
|
13
72
|
describe 'defining a new field' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: protobuf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BJ Neilsen
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2014-07-
|
14
|
+
date: 2014-07-28 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|
@@ -393,5 +393,77 @@ rubygems_version: 2.2.2
|
|
393
393
|
signing_key:
|
394
394
|
specification_version: 4
|
395
395
|
summary: Google Protocol Buffers serialization and RPC implementation for Ruby.
|
396
|
-
test_files:
|
396
|
+
test_files:
|
397
|
+
- spec/benchmark/tasks.rb
|
398
|
+
- spec/bin/protoc-gen-ruby_spec.rb
|
399
|
+
- spec/data/data.bin
|
400
|
+
- spec/data/types.bin
|
401
|
+
- spec/encoding/all_types_spec.rb
|
402
|
+
- spec/encoding/extreme_values_spec.rb
|
403
|
+
- spec/functional/socket_server_spec.rb
|
404
|
+
- spec/functional/zmq_server_spec.rb
|
405
|
+
- spec/lib/protobuf/cli_spec.rb
|
406
|
+
- spec/lib/protobuf/code_generator_spec.rb
|
407
|
+
- spec/lib/protobuf/enum_spec.rb
|
408
|
+
- spec/lib/protobuf/field/float_field_spec.rb
|
409
|
+
- spec/lib/protobuf/field/int32_field_spec.rb
|
410
|
+
- spec/lib/protobuf/field/string_field_spec.rb
|
411
|
+
- spec/lib/protobuf/field_spec.rb
|
412
|
+
- spec/lib/protobuf/generators/base_spec.rb
|
413
|
+
- spec/lib/protobuf/generators/enum_generator_spec.rb
|
414
|
+
- spec/lib/protobuf/generators/extension_generator_spec.rb
|
415
|
+
- spec/lib/protobuf/generators/field_generator_spec.rb
|
416
|
+
- spec/lib/protobuf/generators/file_generator_spec.rb
|
417
|
+
- spec/lib/protobuf/generators/message_generator_spec.rb
|
418
|
+
- spec/lib/protobuf/generators/service_generator_spec.rb
|
419
|
+
- spec/lib/protobuf/lifecycle_spec.rb
|
420
|
+
- spec/lib/protobuf/logger_spec.rb
|
421
|
+
- spec/lib/protobuf/message_spec.rb
|
422
|
+
- spec/lib/protobuf/optionable_spec.rb
|
423
|
+
- spec/lib/protobuf/rpc/client_spec.rb
|
424
|
+
- spec/lib/protobuf/rpc/connector_spec.rb
|
425
|
+
- spec/lib/protobuf/rpc/connectors/base_spec.rb
|
426
|
+
- spec/lib/protobuf/rpc/connectors/common_spec.rb
|
427
|
+
- spec/lib/protobuf/rpc/connectors/socket_spec.rb
|
428
|
+
- spec/lib/protobuf/rpc/connectors/zmq_spec.rb
|
429
|
+
- spec/lib/protobuf/rpc/middleware/exception_handler_spec.rb
|
430
|
+
- spec/lib/protobuf/rpc/middleware/logger_spec.rb
|
431
|
+
- spec/lib/protobuf/rpc/middleware/request_decoder_spec.rb
|
432
|
+
- spec/lib/protobuf/rpc/middleware/response_encoder_spec.rb
|
433
|
+
- spec/lib/protobuf/rpc/servers/socket_server_spec.rb
|
434
|
+
- spec/lib/protobuf/rpc/servers/zmq/server_spec.rb
|
435
|
+
- spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
|
436
|
+
- spec/lib/protobuf/rpc/servers/zmq/worker_spec.rb
|
437
|
+
- spec/lib/protobuf/rpc/service_directory_spec.rb
|
438
|
+
- spec/lib/protobuf/rpc/service_dispatcher_spec.rb
|
439
|
+
- spec/lib/protobuf/rpc/service_filters_spec.rb
|
440
|
+
- spec/lib/protobuf/rpc/service_spec.rb
|
441
|
+
- spec/lib/protobuf/rpc/stat_spec.rb
|
442
|
+
- spec/lib/protobuf_spec.rb
|
443
|
+
- spec/spec_helper.rb
|
444
|
+
- spec/support/all.rb
|
445
|
+
- spec/support/packed_field.rb
|
446
|
+
- spec/support/server.rb
|
447
|
+
- spec/support/test/all_types.data.bin
|
448
|
+
- spec/support/test/all_types.data.txt
|
449
|
+
- spec/support/test/defaults.pb.rb
|
450
|
+
- spec/support/test/defaults.proto
|
451
|
+
- spec/support/test/enum.pb.rb
|
452
|
+
- spec/support/test/enum.proto
|
453
|
+
- spec/support/test/extended.pb.rb
|
454
|
+
- spec/support/test/extended.proto
|
455
|
+
- spec/support/test/extreme_values.data.bin
|
456
|
+
- spec/support/test/google_unittest.pb.rb
|
457
|
+
- spec/support/test/google_unittest.proto
|
458
|
+
- spec/support/test/google_unittest_import.pb.rb
|
459
|
+
- spec/support/test/google_unittest_import.proto
|
460
|
+
- spec/support/test/google_unittest_import_public.pb.rb
|
461
|
+
- spec/support/test/google_unittest_import_public.proto
|
462
|
+
- spec/support/test/multi_field_extensions.pb.rb
|
463
|
+
- spec/support/test/multi_field_extensions.proto
|
464
|
+
- spec/support/test/resource.pb.rb
|
465
|
+
- spec/support/test/resource.proto
|
466
|
+
- spec/support/test/resource_service.rb
|
467
|
+
- spec/support/test_app_file.rb
|
468
|
+
- spec/support/tolerance_matcher.rb
|
397
469
|
has_rdoc:
|