Sha256: 037bf7eb19da0748c4c296ecd7de6db6e70f8365452ce92990192aa550177128

Contents?: true

Size: 626 Bytes

Versions: 13

Compression:

Stored size: 626 Bytes

Contents

# -*- encoding: utf-8 -*-
require 'spec_helper'

module OnStomp::OpenURI
  describe MessageQueue do
    let(:queue) {
      MessageQueue.new
    }
    
    describe "adding and removing items" do
      it "should put something onto the queue" do
        queue.push 'one'
        queue << 'two'
        queue.shift.should == 'one'
        queue.shift.should == 'two'
      end
    end
    
    describe ".shift" do
      it "should block until something is pushed" do
        Thread.new do
          sleep 0.1
          queue << 'hello world'
        end
        queue.shift.should == 'hello world'
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
onstomp-1.0.12 spec/onstomp/open-uri/message_queue_spec.rb
onstomp-1.0.11 spec/onstomp/open-uri/message_queue_spec.rb
onstomp-1.0.10 spec/onstomp/open-uri/message_queue_spec.rb
onstomp-1.0.9 spec/onstomp/open-uri/message_queue_spec.rb
onstomp-1.0.8 spec/onstomp/open-uri/message_queue_spec.rb
onstomp-1.0.7 spec/onstomp/open-uri/message_queue_spec.rb
onstomp-1.0.6 spec/onstomp/open-uri/message_queue_spec.rb
onstomp-1.0.5 spec/onstomp/open-uri/message_queue_spec.rb
onstomp-1.0.4 spec/onstomp/open-uri/message_queue_spec.rb
onstomp-1.0.3 spec/onstomp/open-uri/message_queue_spec.rb
onstomp-1.0.2 spec/onstomp/open-uri/message_queue_spec.rb
onstomp-1.0.1 spec/onstomp/open-uri/message_queue_spec.rb
onstomp-1.0.0 spec/onstomp/open-uri/message_queue_spec.rb