Sha256: f8cafff97175f88fe2db4936c7e6c7954782c17f0db564c1b1cf9967bb473ddf

Contents?: true

Size: 898 Bytes

Versions: 4

Compression:

Stored size: 898 Bytes

Contents

RSpec.describe Celluloid::Mailbox::Evented do
  subject { TestEventedMailbox.new }
  it_behaves_like "a Celluloid Mailbox"

  # NOTE: this example seems too exotic to "have to" succeed on RBX, though I
  # don't know why it hangs on subject.receive and the timeout never occurs
  #
  # Other than
  #
  # Links:
  #   https://github.com/celluloid/celluloid-io/pull/98
  #   https://github.com/celluloid/celluloid-io/issues/56
  #
  unless RUBY_ENGINE == "rbx"
    it "recovers from timeout exceeded to process mailbox message" do
      timeout_interval = CelluloidSpecs::TIMER_QUANTUM + 0.1
      started_at = Time.now
      expect do
        Kernel.send(:timeout, timeout_interval) do
          subject.receive { false }
        end
      end.to raise_exception(Timeout::Error)

      expect(Time.now - started_at).to be_within(CelluloidSpecs::TIMER_QUANTUM).of timeout_interval
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
celluloid-0.17.1.2 spec/celluloid/mailbox/evented_spec.rb
celluloid-0.17.1.1 spec/celluloid/mailbox/evented_spec.rb
celluloid-0.17.1 spec/celluloid/mailbox/evented_spec.rb
celluloid-0.17.0 spec/celluloid/mailbox/evented_spec.rb