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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0081c6fc0146c8bd5d61a987d0f5b374a950d13b
4
- data.tar.gz: cccc8f0d7acb314e3725816fe3e7081d06e1e346
3
+ metadata.gz: 8ad445d76d68be198e63dfba389d2b5deaf314ee
4
+ data.tar.gz: 3d36e1ce0747a04e82419c2a1ea8670fff05ace9
5
5
  SHA512:
6
- metadata.gz: 19e94efb5c58ed704afac0ff0a2023589dbd9ec2aef35bd376cbba7dc4ec3c6feb7fb01363b123ee01913d3ecdfead89d4e3a79526536d4a78859450a67595b5
7
- data.tar.gz: f9fc9d6001dae54bb777a4112db945abb04a34ceb80e63a500d1f13bb1583a62481d366c293c7a7d0bde334e71b7d5b683001b88501141db878de38b83a466c3
6
+ metadata.gz: a9f9e6009fc897608088233604949cbde5353950a2984108185e7b167e00335f53156ba46e0c60b1945a2d13052ce96508932b43e6aaf2b22964378485ec9701
7
+ data.tar.gz: d1b13590c827e3208b8a41bc267faf40e98aa1371f08255cfe02e490e77fb73f9b2667ee3c94a0430db7c274dcda2c5889c6d2810d3a56b0f04b69436845267f
@@ -16,6 +16,12 @@ module Protobuf
16
16
  super(value.to_i)
17
17
  end
18
18
 
19
+ def decode(value)
20
+ if acceptable?(value)
21
+ value
22
+ end
23
+ end
24
+
19
25
  def enum?
20
26
  true
21
27
  end
@@ -1,3 +1,3 @@
1
1
  module Protobuf
2
- VERSION = '3.0.5'
2
+ VERSION = '3.1.0'
3
3
  end
@@ -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.5
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-08 00:00:00.000000000 Z
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: