Sha256: 1e15a4ebb06cba90b46b5192e3e02f70a894218e7b7f0f31305371a72e9dfc51

Contents?: true

Size: 817 Bytes

Versions: 3

Compression:

Stored size: 817 Bytes

Contents

require 'rubygems'
require "lib/ass"
require "spec"
require 'rant/spec'
require 'thread'

require 'eventmachine'
EM.threadpool_size = 1

describe "RPC" do
  before do
    q = Queue.new
    @server = nil
    @thread = Thread.new {ASS.start(:logging => false) {
        q << :ready
      }}
    @thread.abort_on_exception = true
    q.pop.should == :ready
  end

  after do
    ASS.stop
    @thread.join
  end

  it "should make synchronized rpc call" do
    ASS.actor("spec") do
      def foo(i)
        i
      end
    end
    c = ASS.client
    c.call("spec",:foo,1).wait.should == 1
  end

  it "should do cast" do
    q = Queue.new
    ASS.actor("spec") do
      define_method(:foo) do |i|
        q << i
        i
      end
    end
    c = ASS.client
    c.cast("spec",:foo,1)
    q.pop.should == 1
  end
end

  

Version data entries

3 entries across 3 versions & 3 rubygems

Version Path
donkey-0.1.0 spec/client_spec.rb
ASS-0.1.0 spec/client_spec.rb
jamesgolick-ASS-0.1.0 spec/client_spec.rb