protobuf 2.3.0 → 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,11 +10,11 @@ module Protobuf
10
10
  end
11
11
 
12
12
  def acceptable?(val)
13
- if val.is_a?(::Protobuf::Message) || val.instance_of?(String)
13
+ if val.nil? || val.is_a?(::Protobuf::Message) || val.instance_of?(String)
14
14
  return true
15
15
  end
16
16
 
17
- raise TypeError
17
+ raise TypeError, "Cannot set field : #{name} to value : #{val}"
18
18
  end
19
19
 
20
20
  def decode(bytes)
@@ -1,4 +1,4 @@
1
1
  module Protobuf
2
- VERSION = '2.3.0'
2
+ VERSION = '2.3.1'
3
3
  PROTOC_VERSION = '2.4.1'
4
4
  end
@@ -169,6 +169,17 @@ describe Protobuf::Message do
169
169
  end
170
170
  end
171
171
 
172
+ describe "#define_setter" do
173
+ subject { ::Test::Resource.new }
174
+ it "allows string fields to be set to nil" do
175
+ expect { subject.name = nil }.to_not raise_error
176
+ end
177
+
178
+ it "does not allow string fields to be set to Numeric" do
179
+ expect { subject.name = 1}.to raise_error(/name/)
180
+ end
181
+ end
182
+
172
183
  describe '#get_ext_field_by_name' do
173
184
  pending 'Need to get a proto compiled with extensions first'
174
185
  end
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: 2.3.0
4
+ version: 2.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -501,7 +501,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
501
501
  version: '0'
502
502
  segments:
503
503
  - 0
504
- hash: 3916811368868276687
504
+ hash: -2545175995844077930
505
505
  required_rubygems_version: !ruby/object:Gem::Requirement
506
506
  none: false
507
507
  requirements:
@@ -510,7 +510,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
510
510
  version: '0'
511
511
  segments:
512
512
  - 0
513
- hash: 3916811368868276687
513
+ hash: -2545175995844077930
514
514
  requirements: []
515
515
  rubyforge_project:
516
516
  rubygems_version: 1.8.24