protobuf 2.3.0-java → 2.3.1-java

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.
@@ -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
@@ -2,7 +2,7 @@
2
2
  name: protobuf
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 2.3.0
5
+ version: 2.3.1
6
6
  platform: java
7
7
  authors:
8
8
  - BJ Neilsen