Sha256: aa336d2e7191d0c65f4b9e233d8a0c9936df222847d8827f287310ada59d3927

Contents?: true

Size: 739 Bytes

Versions: 2

Compression:

Stored size: 739 Bytes

Contents

require 'bluth'
require 'bluth/test_helpers'

#Familia.debug = true

ExampleHandler.enqueue :item => :val1
ExampleHandler.enqueue :item => :val2
ExampleHandler.enqueue :item => :val3


## Critical queue should have 3 items
Bluth::Queue.critical.size
#=> 3

## Can set queuetimeout
Bluth.queuetimeout = 2
#=> 2

## Bluth.shift returns first value
@job1 = Bluth.shift
@job1.data['item']
#=> 'val1'

## Bluth.pop returns last value
@job2 = Bluth.pop
@job2.data['item']
#=> 'val3'

## Bluth.pop returns remaining value
@job3 = Bluth.pop
@job3.data['item']
#=> 'val2'

## Bluth.pop returns nil after waiting for queuetimeout
Bluth.pop
#=> nil


Bluth::Queue.critical.clear
@job1.destroy! if @job1
@job2.destroy! if @job2
@job3.destroy! if @job3

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bluth-0.7.2 try/19_bluth_try.rb
bluth-0.7.0 try/19_bluth_try.rb