Sha256: 065ed5daaa49798fe4500b89500522baab1a4861c3a688cfe0e39d61a7844cdc

Contents?: true

Size: 1.23 KB

Versions: 1

Compression:

Stored size: 1.23 KB

Contents

require_relative 'spec_helper'


module Mikka
  class TestActor < Mikka::Actor
    def receive(msg)
      sender << msg
    end
  end

  describe 'actor creation' do
    before do
      @system = Mikka.create_actor_system('testsystem')
    end

    after do
      @system.shutdown
    end

    it 'creates an actor from a class' do
      actor_props = Props[TestActor]
      actor = @system.actor_of(actor_props, 'some_actor')
      actor.should be_a(ActorRef)
    end

    it 'creates an actor from a factory proc' do
      actor_props = Props[:creator => proc { TestActor.new }]
      actor = @system.actor_of(actor_props, 'some_actor')
      actor.should be_a(ActorRef)
    end

    it 'creates an actor from a factory block' do
      actor_props = Props.create { TestActor.new }
      actor = @system.actor_of(actor_props, 'some_actor')
      actor.should be_a(ActorRef)
    end

    it 'creates an actor from a factory block passed to the Props function' do
      actor_props = Useful.Props { TestActor.new }
      actor = @system.actor_of(actor_props, 'some_actor')
      actor.should be_a(ActorRef)
    end

    # future = actor.ask(:hi, 1000)
    # reply = Mikka.await_result(future, :timeout => '1000ms')
    # reply.should == :hi
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mikka-2.0.0.pre0-java spec/mikka_spec.rb