Sha256: 21aa43eb884b6b022cb8b8ac2fe78bdd1a061825161a81ae0e5f3bf26c194e83

Contents?: true

Size: 924 Bytes

Versions: 11

Compression:

Stored size: 924 Bytes

Contents

require 'spec_helper'

require 'protobuf/generators/file_generator'

describe ::Protobuf::Generators::FileGenerator do

  let(:base_descriptor_fields) { { :name => 'test/foo.proto' } }
  let(:descriptor_fields) { base_descriptor_fields }
  let(:file_descriptor) { ::Google::Protobuf::FileDescriptorProto.new(descriptor_fields) }

  subject { described_class.new(file_descriptor) }
  specify { expect(subject.file_name).to eq('test/foo.pb.rb') }

  describe '#print_import_requires' do
    let(:descriptor_fields) do
      base_descriptor_fields.merge!({ :dependency => [ 'test/bar.proto',
                                                       'test/baz.proto' ] })
    end

    it 'prints a ruby require for each dependency' do
      expect(subject).to receive(:print_require).with('test/bar.pb')
      expect(subject).to receive(:print_require).with('test/baz.pb')
      subject.print_import_requires
    end

  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
protobuf-3.3.6 spec/lib/protobuf/generators/file_generator_spec.rb
protobuf-3.3.5 spec/lib/protobuf/generators/file_generator_spec.rb
protobuf-3.3.4 spec/lib/protobuf/generators/file_generator_spec.rb
protobuf-3.3.3 spec/lib/protobuf/generators/file_generator_spec.rb
protobuf-3.3.2 spec/lib/protobuf/generators/file_generator_spec.rb
protobuf-3.3.1 spec/lib/protobuf/generators/file_generator_spec.rb
protobuf-3.3.0 spec/lib/protobuf/generators/file_generator_spec.rb
protobuf-3.2.1 spec/lib/protobuf/generators/file_generator_spec.rb
protobuf-3.2.0 spec/lib/protobuf/generators/file_generator_spec.rb
protobuf-3.1.0 spec/lib/protobuf/generators/file_generator_spec.rb
protobuf-3.0.5 spec/lib/protobuf/generators/file_generator_spec.rb