Sha256: f4230c924118097fd40feedfb428290570e5997188e39e43e81971cef89b0916
Contents?: true
Size: 1.39 KB
Versions: 23
Compression:
Stored size: 1.39 KB
Contents
# encoding: utf-8 require 'spec_helper' RSpec.describe ::Protobuf::Field::StringField do describe '#encode' do context 'when a repeated string field contains frozen strings' do it 'does not raise an encoding error' do expect do frozen_strings = ["foo".freeze, "bar".freeze, "baz".freeze] ::Test::ResourceFindRequest.encode(:name => 'resource', :widgets => frozen_strings) end.not_to raise_error end end context 'when a repeated bytes field contains frozen strings' do it 'does not raise an encoding error' do expect do frozen_strings = ["foo".freeze, "bar".freeze, "baz".freeze] ::Test::ResourceFindRequest.encode(:name => 'resource', :widget_bytes => frozen_strings) end.not_to raise_error end end it 'does not alter string values after encoding multiple times' do source_string = "foo" proto = ::Test::Resource.new(:name => source_string) proto.encode expect(proto.name).to eq source_string proto.encode expect(proto.name).to eq source_string end it 'does not alter unicode string values after encoding multiple times' do source_string = "ยข" proto = ::Test::Resource.new(:name => source_string) proto.encode expect(proto.name).to eq source_string proto.encode expect(proto.name).to eq source_string end end end
Version data entries
23 entries across 23 versions & 3 rubygems
Version | Path |
---|---|
protobuf-3.4.2 | spec/lib/protobuf/field/string_field_spec.rb |
protobuf-3.4.1 | spec/lib/protobuf/field/string_field_spec.rb |
protobuf-3.4.0 | spec/lib/protobuf/field/string_field_spec.rb |