Sha256: f574c0a8982eff60559168c720187df2be566f520b51b912972b44eca7892d9b
Contents?: true
Size: 1.38 KB
Versions: 11
Compression:
Stored size: 1.38 KB
Contents
# encoding: utf-8 require 'spec_helper' 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 { frozen_strings = [ "foo".freeze, "bar".freeze, "baz".freeze ] ::Test::ResourceFindRequest.encode(:name => 'resource', :widgets => frozen_strings) }.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 { frozen_strings = [ "foo".freeze, "bar".freeze, "baz".freeze ] ::Test::ResourceFindRequest.encode(:name => 'resource', :widget_bytes => frozen_strings) }.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
11 entries across 11 versions & 1 rubygems