summaryrefslogtreecommitdiff
path: root/spec/gitlab_config_spec.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-09-16 07:39:48 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-09-16 07:39:48 +0000
commit27fe2ea53530709b9d51915d9cd95912c9be0a06 (patch)
tree2890a3d3ea06b6b6f708a96df4380fb0874b5528 /spec/gitlab_config_spec.rb
parent4f3f3beebad2d3c1a1ee6b657d40d7c93d5bc1b6 (diff)
parent17dab64aa8bd7a6fc4ce9e2a389fb6f5968b5ba5 (diff)
downloadgitlab-shell-27fe2ea53530709b9d51915d9cd95912c9be0a06.tar.gz
Merge branch 'redis-sockets' into 'master'
Connect to Redis via sockets by default See merge request !41
Diffstat (limited to 'spec/gitlab_config_spec.rb')
-rw-r--r--spec/gitlab_config_spec.rb49
1 files changed, 31 insertions, 18 deletions
diff --git a/spec/gitlab_config_spec.rb b/spec/gitlab_config_spec.rb
index d2b4776..52fb182 100644
--- a/spec/gitlab_config_spec.rb
+++ b/spec/gitlab_config_spec.rb
@@ -5,20 +5,27 @@ describe GitlabConfig do
let(:config) { GitlabConfig.new }
describe :redis do
- subject { config.redis }
-
- it { should be_a(Hash) }
- it { should have_key('bin') }
- it { should have_key('host') }
- it { should have_key('port') }
- it { should have_key('database') }
- it { should have_key('namespace') }
- end
-
- describe :redis_namespace do
- subject { config.redis_namespace }
+ before do
+ config.instance_variable_set(:@config, YAML.load(<<eos
+redis:
+ bin: /usr/bin/redis-cli
+ host: 127.0.1.1
+ port: 6378
+ pass: secure
+ database: 1
+ socket: /var/run/redis/redis.sock
+ namespace: my:gitlab
+eos
+ ))
+ end
- it { should eq('resque:gitlab') }
+ it { config.redis['bin'].should eq('/usr/bin/redis-cli') }
+ it { config.redis['host'].should eq('127.0.1.1') }
+ it { config.redis['port'].should eq(6378) }
+ it { config.redis['database'].should eq(1) }
+ it { config.redis['namespace'].should eq('my:gitlab') }
+ it { config.redis['socket'].should eq('/var/run/redis/redis.sock') }
+ it { config.redis['pass'].should eq('secure') }
end
describe :gitlab_url do
@@ -39,11 +46,6 @@ describe GitlabConfig do
describe :redis_command do
subject { config.redis_command }
- it { should be_an(Array) }
- it { should include(config.redis['host']) }
- it { should include(config.redis['bin']) }
- it { should include(config.redis['port'].to_s) }
-
context "with empty redis config" do
before do
config.stub(:redis) { {} }
@@ -53,6 +55,17 @@ describe GitlabConfig do
it { should include('redis-cli') }
end
+ context "with host and port" do
+ before do
+ config.stub(:redis) { {'host' => 'localhost', 'port' => 1123, 'bin' => '/usr/bin/redis-cli'} }
+ end
+
+ it { should be_an(Array) }
+ it { should include(config.redis['host']) }
+ it { should include(config.redis['bin']) }
+ it { should include(config.redis['port'].to_s) }
+ end
+
context "with redis socket" do
let(:socket) { '/tmp/redis.socket' }
before do