leshill/resque_spec — Issue #33: Using with resque-lock
Author: dwilkie
Created: 2011-11-15 04:55:18+00:00
State: open

Using resque-spec with resque-lock (https://github.com/defunkt/resque-lock) doesn't work as expected. For example:

class EmailFetcher
extend Resque::Plugins::Lock

@queue = :email_fetcher_queue

def self.perform(email_id)
Email.fetch_body(email_id)
end
end

describe "Emails" do
it "should enqueue only once"
5.times do
Resque.enqueue(EmailFetcher, 1)
end

EmailFetcher.should have_queue_size_of(1)
end

Failure/Error: EmailFetcher.should have_queue_size_of(1)
expected that EmailFetcher would have 1 entries queued, but got 5 instead

Redis is also not mocked. If you try to perform a job, you'll get:
Errno::ECONNREFUSED:
Connection refused - Unable to connect to Redis on 127.0.0.1:6379