diff options
author | Gabor Nagy <mail@aigeruth.hu> | 2014-06-22 22:45:06 +0200 |
---|---|---|
committer | Gabor Nagy <mail@aigeruth.hu> | 2014-06-23 20:52:45 +0200 |
commit | 32f1893298bc0108df89de0e543193af20bb0e7c (patch) | |
tree | 2fcff9cc992f4560be894f41938573ef3e6bb15e /spec/gitlab_config_spec.rb | |
parent | ca425566d0266a1786019153757e283d7d246450 (diff) | |
download | gitlab-shell-32f1893298bc0108df89de0e543193af20bb0e7c.tar.gz |
Improve coverage.
Diffstat (limited to 'spec/gitlab_config_spec.rb')
-rw-r--r-- | spec/gitlab_config_spec.rb | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/spec/gitlab_config_spec.rb b/spec/gitlab_config_spec.rb new file mode 100644 index 0000000..6c87224 --- /dev/null +++ b/spec/gitlab_config_spec.rb @@ -0,0 +1,65 @@ +require_relative 'spec_helper' +require_relative '../lib/gitlab_config' + +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('namespace') } + end + + describe :redis_namespace do + subject { config.redis_namespace } + + it { should eq('resque:gitlab') } + end + + describe :gitlab_url do + subject { config.gitlab_url } + + it { should_not be_empty } + it { should eq('http://localhost/') } + end + + describe :audit_usernames do + subject { config.audit_usernames } + + it("returns false by default") { should eq(false) } + end + + 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) { {} } + end + + it { should be_an(Array) } + it { should include('redis-cli') } + end + + context "with redis socket" do + let(:socket) { '/tmp/redis.socket' } + before do + config.stub(:redis) { {'bin' => '', 'socket' => socket } } + end + + it { should be_an(Array) } + it { should include(socket) } + it { should_not include('-p') } + it { should_not include('-h') } + end + end +end |