Sha256: 49c83bc09a7a569b3a5b9a79719cf308ac559bed75800fdff1485ea9d66c7d96

Contents?: true

Size: 805 Bytes

Versions: 10

Compression:

Stored size: 805 Bytes

Contents

require File.dirname(__FILE__) + '/spec_helper'

describe JobQueue::TestAdapter do
  before :all do
    JobQueue.adapter = JobQueue::TestAdapter.new
  end
  
  it "should write onto queue and fetch stuff back off" do
    JobQueue.put("hello")
    
    JobQueue.subscribe do |job|
      @job = job
      throw :stop
    end
    
    @job.should == "hello"
  end
  
  it "should pull items off in the order the were added" do
    JobQueue.put("foo")
    JobQueue.put("bar")
    
    retrieved_jobs = []
    
    begin
      Timeout::timeout(0.5) do
        JobQueue.subscribe do |job|
          retrieved_jobs << job
        end
      end
    rescue Timeout::Error
      
    end
    
    retrieved_jobs[0].should == "foo"
    retrieved_jobs[1].should == "bar"
    retrieved_jobs[2].should == nil
  end
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
mloughran-job_queue-0.0.3 spec/test_adapter_spec.rb
mloughran-job_queue-0.0.4 spec/test_adapter_spec.rb
mloughran-job_queue-0.0.5 spec/test_adapter_spec.rb
mloughran-job_queue-0.0.6 spec/test_adapter_spec.rb
mloughran-job_queue-0.0.7 spec/test_adapter_spec.rb
newbamboo-job_queue-0.0.5 spec/test_adapter_spec.rb
newbamboo-job_queue-0.0.6 spec/test_adapter_spec.rb
newbamboo-job_queue-0.0.7 spec/test_adapter_spec.rb
newbamboo-job_queue-0.0.8 spec/test_adapter_spec.rb
strobemonkey-job_queue-0.0.5 spec/test_adapter_spec.rb