Sha256: 7474c088a832219ba01b6373cf8fe1e5444a30caf4602a0615080167f0a2b13e

Contents?: true

Size: 880 Bytes

Versions: 73

Compression:

Stored size: 880 Bytes

Contents

require "spec_helper"

if defined?(JRUBY_VERSION)
  require "bunny/concurrent/linked_continuation_queue"

  describe Bunny::Concurrent::LinkedContinuationQueue do
    describe "#poll with a timeout that is never reached" do
      it "blocks until the value is available, then returns it" do
        # force subject evaluation
        cq = subject
        t = Thread.new do
          cq.push(10)
        end
        t.abort_on_exception = true

        v = subject.poll(500)
        v.should == 10
      end
    end

    describe "#poll with a timeout that is reached" do
      it "raises an exception" do
        # force subject evaluation
        cq = subject
        t = Thread.new do
          sleep 1.5
          cq.push(10)
        end
        t.abort_on_exception = true

        lambda { subject.poll(500) }.should raise_error(::Timeout::Error)
      end
    end
  end
end

Version data entries

73 entries across 73 versions & 1 rubygems

Version Path
bunny-1.7.1 spec/unit/concurrent/linked_continuation_queue_spec.rb
bunny-1.7.0 spec/unit/concurrent/linked_continuation_queue_spec.rb
bunny-1.6.3 spec/unit/concurrent/linked_continuation_queue_spec.rb
bunny-1.6.2 spec/unit/concurrent/linked_continuation_queue_spec.rb
bunny-1.6.1 spec/unit/concurrent/linked_continuation_queue_spec.rb
bunny-1.6.0 spec/unit/concurrent/linked_continuation_queue_spec.rb
bunny-1.5.1 spec/unit/concurrent/linked_continuation_queue_spec.rb
bunny-1.6.0.rc2 spec/unit/concurrent/linked_continuation_queue_spec.rb
bunny-1.6.0.rc1 spec/unit/concurrent/linked_continuation_queue_spec.rb
bunny-1.6.0.pre1 spec/unit/concurrent/linked_continuation_queue_spec.rb
bunny-1.5.0 spec/unit/concurrent/linked_continuation_queue_spec.rb
bunny-1.5.0.pre2 spec/unit/concurrent/linked_continuation_queue_spec.rb
bunny-1.5.0.pre1 spec/unit/concurrent/linked_continuation_queue_spec.rb
bunny-1.4.1 spec/unit/concurrent/linked_continuation_queue_spec.rb
bunny-1.4.0 spec/unit/concurrent/linked_continuation_queue_spec.rb
bunny-1.3.1 spec/unit/concurrent/linked_continuation_queue_spec.rb
bunny-1.3.0 spec/unit/concurrent/linked_continuation_queue_spec.rb
bunny-1.2.2 spec/unit/concurrent/linked_continuation_queue_spec.rb
bunny-1.2.1 spec/unit/concurrent/linked_continuation_queue_spec.rb
bunny-1.2.0 spec/unit/concurrent/linked_continuation_queue_spec.rb