Re: [resque] How to use Resque.inline with Rails3 app for testing?
- From:
- Evgeniy Dolzhenko
- Date:
- 2011-04-07 @ 06:47
Here is what we put in our config/initializers/resque.rb:
if ENV["REDISTOGO_URL"].present?
# Connect to Redis
Resque.redis = Redis.connect(:url => ENV["REDISTOGO_URL"])
else
# Don't connect to Redis and perform the action immediately
Resque.inline = true
end
I.e. if REDISTOGO_URL environment variable pointing to Redis instance
isn't set any action will be performed immediately.
You also can use Resque.inline? to find out if Resque is running in
inline mode.
On 4/7/2011 10:44 AM, Sachin Rai wrote:
> In the recent version of Resque, there is a new Resque.inline method
> introduced for testing.
> But I couldn't find any help on where to put that line.
> Can anyone plz help me out on where to put that line while testing with
> RSpec2 and Rails 3?