Sha256: c9b71f4156b2396ff03f3340f28b47dcdeff16849ead150144580d5bd0ec8384
Contents?: true
Size: 666 Bytes
Versions: 35
Compression:
Stored size: 666 Bytes
Contents
require 'spec_helper' RSpec.describe Protobuf::Field::EnumField do let(:message) do Class.new(::Protobuf::Message) do enum_class = Class.new(::Protobuf::Enum) do define :POSITIVE, 22 define :NEGATIVE, -33 end optional enum_class, :enum, 1 end end describe '.{encode, decode}' do it 'handles positive enum constants' do instance = message.new(:enum => :POSITIVE) expect(message.decode(instance.encode).enum).to eq(22) end it 'handles negative enum constants' do instance = message.new(:enum => :NEGATIVE) expect(message.decode(instance.encode).enum).to eq(-33) end end end
Version data entries
35 entries across 35 versions & 2 rubygems