Merge branch 'hotfix/redis_url' into develop
This commit is contained in:
commit
8674f5aea2
2 changed files with 53 additions and 3 deletions
|
|
@ -183,9 +183,9 @@ HELP
|
||||||
redis_options = { :url => ENV['REDIS_URL'] }
|
redis_options = { :url => ENV['REDIS_URL'] }
|
||||||
elsif ENV['RAILS_ENV']== 'integration2'
|
elsif ENV['RAILS_ENV']== 'integration2'
|
||||||
redis_options = { :host => 'localhost', :port => 6380 }
|
redis_options = { :host => 'localhost', :port => 6380 }
|
||||||
elsif AppConfig[:redis_url].present?
|
elsif self[:redis_url].present?
|
||||||
puts "WARNING: You're redis_url doesn't start with redis://" unless AppConfig[:redis_url].start_with?("redis://")
|
puts "WARNING: You're redis_url doesn't start with redis://" unless self[:redis_url].start_with?("redis://")
|
||||||
redis_options = { :url => AppConfig[:redis_url] }
|
redis_options = { :url => self[:redis_url] }
|
||||||
end
|
end
|
||||||
|
|
||||||
Redis.new(redis_options.merge(:thread_safe => true))
|
Redis.new(redis_options.merge(:thread_safe => true))
|
||||||
|
|
|
||||||
|
|
@ -178,6 +178,56 @@ describe AppConfig do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe ".get_redis_instance" do
|
||||||
|
context "with REDISTOGO_URL set" do
|
||||||
|
before do
|
||||||
|
ENV["REDISTOGO_URL"] = "redis://myserver"
|
||||||
|
end
|
||||||
|
|
||||||
|
after do
|
||||||
|
ENV["REDISTOGO_URL"] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
it "uses that" do
|
||||||
|
AppConfig.get_redis_instance.client.host.should == "myserver"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "with REDIS_URL set" do
|
||||||
|
before do
|
||||||
|
ENV["REDIS_URL"] = "redis://yourserver"
|
||||||
|
end
|
||||||
|
|
||||||
|
after do
|
||||||
|
ENV["REDIS_URL"] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
it "uses that" do
|
||||||
|
AppConfig.get_redis_instance.client.host.should == "yourserver"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "with redis_url set" do
|
||||||
|
before do
|
||||||
|
AppConfig[:redis_url] = "redis://ourserver"
|
||||||
|
end
|
||||||
|
|
||||||
|
after do
|
||||||
|
AppConfig[:redis_url] = ""
|
||||||
|
end
|
||||||
|
|
||||||
|
it "uses that" do
|
||||||
|
AppConfig.get_redis_instance.client.host.should == "ourserver"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "with nothing set" do
|
||||||
|
it "uses localhost" do
|
||||||
|
AppConfig.get_redis_instance.client.host.should == "127.0.0.1"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe ".[]=" do
|
describe ".[]=" do
|
||||||
describe "when setting pod_url" do
|
describe "when setting pod_url" do
|
||||||
context "with a symbol" do
|
context "with a symbol" do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue