Sha256: 593820735aefa3bdefb0b7011760966ed0a9115b14f29cba9d4d66282dbefb22

Contents?: true

Size: 903 Bytes

Versions: 1

Compression:

Stored size: 903 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe MarilynRPC::Server do
  before(:each) do
    class ConnectionStub
      include MarilynRPC::Server
      attr_accessor :data

      def initialize()
        @data = ""
      end

      def send_data(data)
        @data += data
      end
    end

    @server = ConnectionStub.new
  end
  
  it "should be possible to send multiple letters to the server" do
    @server.post_init
    @server.receive_data(MarilynRPC::Envelope.new("Test1").encode)
    envelope = MarilynRPC::Envelope.new
    envelope.parse!(@server.data)
    mail = MarilynRPC::ExceptionMail.new
    mail.decode(envelope.content)
    mail.exception.message.should == "The passed envelope is broken!"
    @server.receive_data(MarilynRPC::Envelope.new("Test2").encode)
    @server.receive_data(MarilynRPC::Envelope.new("Test3").encode)
    @server.unbind
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
marilyn-rpc-0.0.3 spec/server_spec.rb