Sha256: a3e336f580120922c9c64e59e3a625b04c3e0bbb42f11b214e204c44b084c96c

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'

describe EMJack::Job do
  let (:conn ) { mock(:conn) }

  it 'converts jobid to an integer' do
    j = EMJack::Job.new(nil, "1", "body")
    j.jobid.class.should == Fixnum
    j.jobid.should == 1
  end

  it 'sends a delete command to the connection' do
    j = EMJack::Job.new(conn, 1, "body")
    conn.should_receive(:delete).with(j)

    j.delete
  end

  it 'sends a stats command to the connection' do
    j = EMJack::Job.new(conn, 2, 'body')
    conn.should_receive(:stats).with(:job, j)

    j.stats
  end

  it 'sends a release command to the connection' do
    blk = Proc.new { x = 1 }

    j = EMJack::Job.new(conn, 2, 'body')
    conn.should_receive(:release).with(j, {:foo => :bar}, &blk)

    j.release({:foo => :bar}, &blk)
  end

  it 'sends a touch command to the connection' do
    j = EMJack::Job.new(conn, 2, 'body')
    conn.should_receive(:touch).with(j)

    j.touch
  end

  it 'sends a bury command to the connection' do
    j = EMJack::Job.new(conn, 2, 'body')
    conn.should_receive(:bury).with(j, 1234)

    j.bury(1234)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
em-jack-0.1.5 spec/em-jack/job_spec.rb
em-jack-0.1.4 spec/em-jack/job_spec.rb