Sha256: d98bd7cd48d75e4bc6dd351db6e60d7644e9a56c181463b014b5cb5ef07aab55

Contents?: true

Size: 876 Bytes

Versions: 3

Compression:

Stored size: 876 Bytes

Contents

require "spec_helper"

describe ProtobufDescriptor::FieldDescriptor do
  describe "#type_name" do
    it "is sane" do
      with_descriptor("single_file_test") do |descriptor|
        message_descriptor = descriptor[:single_file].messages[:FieldOptions]
        field_descriptor = message_descriptor.fields[:ctype]

        expect(field_descriptor.field_type).to eq(Google::Protobuf::FieldDescriptorProto::Type::TYPE_ENUM)
        expect(field_descriptor.type_name).to eq(".porkbuns.FieldOptions.CType")
      end
    end
  end

  it "#resolve_type resolves a field's type name" do
    with_descriptor("single_file_test") do |descriptor|
      message_descriptor = descriptor[:single_file].messages[:FieldOptions]
      field_descriptor = message_descriptor.fields[:ctype]

      expect(field_descriptor.resolve_type).to eq(message_descriptor.enums[:CType])
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
protobuf_descriptor-1.1.2 spec/field_descriptor_spec.rb
protobuf_descriptor-1.1.1 spec/field_descriptor_spec.rb
protobuf_descriptor-1.1.0 spec/field_descriptor_spec.rb