Sha256: a9ba48af0b084216016e06b121fed7eb74e2a9ba0c8f5d2303fa75634452502a
Contents?: true
Size: 1.56 KB
Versions: 4
Compression:
Stored size: 1.56 KB
Contents
require 'spec_helper' require 'beanstalk-client-rspec' describe Beanstalk::MockPool do before do @beanstalk = Beanstalk::MockPool.new ['127.0.0.1:11301'] end it 'should accept objects on the default' do @beanstalk.put 'cow' job = @beanstalk.reserve job.body.should == 'cow' job.release job = @beanstalk.reserve job.body.should == 'cow' job.delete end it 'should accept objects on a named tube' do @beanstalk.use 'moo' @beanstalk.put 'cow' @beanstalk.watch 'moo' @beanstalk.ignore 'default' job = @beanstalk.reserve job.body.should == 'cow' end it 'should deal with on_tube' do @beanstalk.on_tube 'foo' do |c| c.put 'cow' end @beanstalk.watch 'foo' @beanstalk.ignore 'default' job = @beanstalk.reserve job.body.should == 'cow' end describe 'reset!' do it 'should empty tubes' do @beanstalk.put 'cow' @beanstalk.should have_tube_size_of(1).for('default') @beanstalk.reset! @beanstalk.should have_tube_size_of(0).for('default') end it 'should not be watching anything' do @beanstalk.list_tubes_watched.values.flatten.should == ['default'] @beanstalk.watch 'foo' @beanstalk.list_tubes_watched.values.flatten.should == ['default', 'foo'] @beanstalk.reset! @beanstalk.list_tubes_watched.values.flatten.should == ['default'] end end describe 'beanstalk workflow' do it 'can reserve an empty tube' do expect { @beanstalk.reserve }.to raise_error Beanstalk::TimedOut end end end
Version data entries
4 entries across 4 versions & 1 rubygems