Sha256: 477730cd38a8ad9e88e0f8a84d428c4633f502ef55d41ee714717fed89a85363

Contents?: true

Size: 1.33 KB

Versions: 2

Compression:

Stored size: 1.33 KB

Contents

require 'spec_helper'
require 'spec/proto/test_service_impl'
require 'protobuf/rpc/servers/socket_runner'
require 'protobuf/evented'
require 'protobuf/socket'

describe Protobuf::Rpc::Socket::Server do
  before(:each) do 
    load 'protobuf/socket.rb' 
    ::Protobuf::Rpc::Connector.connector_for_client(true)
  end

  before(:all) do
    load 'protobuf/socket.rb' 
    ::Protobuf::Rpc::Connector.connector_for_client(true)
    Thread.abort_on_exception = true
    server = OpenStruct.new(:server => "127.0.0.1", :port => 9399, :backlog => 100, :threshold => 100)
    @server_thread = Thread.new(server) { |s| Protobuf::Rpc::SocketRunner.run(s) }
    Thread.pass until Protobuf::Rpc::Socket::Server.running?
  end

  after(:all) do
    Protobuf::Rpc::SocketRunner.stop
    @server_thread.join
  end

  it "Runner provides a stop method" do
    runner_class = described_class.to_s.gsub(/Evented::Server/, "EventedRunner").constantize
    runner_class.respond_to?(:stop).should be_true
  end

  it "provides a stop method" do
    described_class.respond_to?(:stop).should be_true
  end

  it "provides a Runner class" do
    runner_class = described_class.to_s.gsub(/Evented::Server/, "EventedRunner")
    expect { runner_class.constantize }.to_not raise_error
  end

  it "signals the Server is running" do
    described_class.running?.should be_true
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
protobuf-2.0.0.rc2 spec/lib/protobuf/rpc/servers/socket_server_spec.rb
protobuf-2.0.0.rc1 spec/lib/protobuf/rpc/servers/socket_server_spec.rb