Sha256: 855070a68eee396bbb69620551b96bd4e784b04b3dd8b912cf322d41c2fcee1e

Contents?: true

Size: 800 Bytes

Versions: 61

Compression:

Stored size: 800 Bytes

Contents

require 'spec_helper'

require 'protobuf/code_generator'

RSpec.describe 'protoc-gen-ruby' do
  let(:binpath) { ::File.expand_path('../../../bin/protoc-gen-ruby', __FILE__) }
  let(:package) { 'test' }
  let(:request_bytes) do
    ::Google::Protobuf::Compiler::CodeGeneratorRequest.encode(
      :proto_file => [{ :package => package }],
    )
  end

  it 'reads the serialized request bytes and outputs serialized response bytes' do
    ::IO.popen(binpath, 'w+') do |pipe|
      pipe.write(request_bytes)
      pipe.close_write # needed so we can implicitly read until EOF
      response_bytes = pipe.read
      response = ::Google::Protobuf::Compiler::CodeGeneratorResponse.decode(response_bytes)
      expect(response.file.first.content).to include("module #{package.titleize}")
    end
  end
end

Version data entries

61 entries across 61 versions & 4 rubygems

Version Path
protobuf-3.4.0 spec/bin/protoc-gen-ruby_spec.rb