From 5a0a677ba9a2ff22a6fc9825277e2a5f9f938869 Mon Sep 17 00:00:00 2001 From: Dennis Reimann Date: Thu, 2 May 2013 09:47:56 +0200 Subject: [PATCH] Configurable redis url in tests This allows for a custom redis url (i.e. when having redis run on a non-default port) in tests. To use this, run the tests with `REDIS_URL=redis://localhost:16379/15 rake` --- test/helper.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/helper.rb b/test/helper.rb index 433b9862..4d1f0d17 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -25,4 +25,9 @@ require 'sidekiq/util' Sidekiq.logger.level = Logger::ERROR require 'sidekiq/redis_connection' -REDIS = Sidekiq::RedisConnection.create(:url => "redis://localhost/15", :namespace => 'testy') +redis_url = ENV['REDIS_URL'] || 'redis://localhost/15' +REDIS = Sidekiq::RedisConnection.create(:url => redis_url, :namespace => 'testy') + +Sidekiq.configure_client do |config| + config.redis = { :url => redis_url, :namespace => 'testy' } +end