Sha256: 346b12592fa70ff612ee1b33324d4057a61c5bf9e4a16f97e7fcbc5217c61570

Contents?: true

Size: 1.15 KB

Versions: 2

Compression:

Stored size: 1.15 KB

Contents

RSpec.describe Celluloid::Call::Sync, actor_system: :global do
  # TODO: these should be Call::Sync unit tests (without working on actual actors)

  let(:actor) { CallExampleActor.new }
  let(:logger) { Specs::FakeLogger.current }

  context "when obj does not respond to a method" do
    it "raises a NoMethodError" do
      allow(logger).to receive(:crash).with("Actor crashed!", NoMethodError)

      expect do
        actor.the_method_that_was_not_there
      end.to raise_exception(NoMethodError)
    end

    context "when obj raises during inspect" do
      it "should emulate obj.inspect" do
        allow(logger).to receive(:crash).with("Actor crashed!", NoMethodError)
      end
    end
  end

  it "aborts with ArgumentError when a method is called with too many arguments" do
    allow(logger).to receive(:crash).with("Actor crashed!", ArgumentError)

    expect do
      actor.actual_method("with too many arguments")
    end.to raise_exception(ArgumentError)
  end

  it "preserves call chains across synchronous calls" do
    actor2 = CallExampleActor.new(actor)

    uuid, next_actor_uuid = actor2.chained_call_ids
    expect(uuid).to eq next_actor_uuid
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
celluloid-0.18.0 spec/celluloid/calls_spec.rb
celluloid-0.18.0.pre2 spec/celluloid/calls_spec.rb