Sha256: 53687a100829cb7ae3709017e490123c23097ce81b7bf9f02d292c54e321911b
Contents?: true
Size: 1.16 KB
Versions: 11
Compression:
Stored size: 1.16 KB
Contents
require 'spec_helper' require 'protobuf/code_generator' require 'protobuf/generators/extension_generator' describe ::Protobuf::Generators::ExtensionGenerator do let(:field_descriptors) { [ double('field descriptor 1', :to_s => " field 1\n"), double('field descriptor 2', :to_s => " field 2\n"), double('field descriptor 3', :to_s => " field 3\n") ] } let(:message_type) { 'FooBar' } before do expect(::Protobuf::Generators::FieldGenerator).to receive(:new).with(field_descriptors[0], 1).and_return(field_descriptors[0]) expect(::Protobuf::Generators::FieldGenerator).to receive(:new).with(field_descriptors[1], 1).and_return(field_descriptors[1]) expect(::Protobuf::Generators::FieldGenerator).to receive(:new).with(field_descriptors[2], 1).and_return(field_descriptors[2]) end subject { described_class.new(message_type, field_descriptors, 0) } describe '#compile' do let(:compiled) { %q{class FooBar < ::Protobuf::Message field 1 field 2 field 3 end } } it 'compiles the a class with the extension fields' do subject.compile expect(subject.to_s).to eq(compiled) end end end
Version data entries
11 entries across 11 versions & 1 rubygems