-
Notifications
You must be signed in to change notification settings - Fork 76
/
Copy pathgitlab_config_database_spec.rb
58 lines (53 loc) · 2.62 KB
/
gitlab_config_database_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
require 'spec_helper'
describe 'gitlab::config::database', :type => :define do
let(:title) { 'gitlab' }
context 'mysql' do
let (:params) {
{
:database => 'gitlab_db',
:group => 'git',
:host => 'localhost',
:owner => 'git',
:password => 'changeme',
:path => '/home/git/gitlab/config/database.yml',
:port => '3306',
:type => 'mysql',
:username => 'gitlab_user'
}
}
it { is_expected.to contain_file('/home/git/gitlab/config/database.yml').with(
:ensure => 'file',
:owner => 'git',
:group => 'git'
)}
it { is_expected.to contain_file('/home/git/gitlab/config/database.yml').with_content(/^\s*adapter: mysql2$/)}
it { is_expected.to contain_file('/home/git/gitlab/config/database.yml').with_content(/^\s*encoding: utf8$/)}
it { is_expected.to contain_file('/home/git/gitlab/config/database.yml').with_content(/^\s*database: gitlab_db$/)}
it { is_expected.to contain_file('/home/git/gitlab/config/database.yml').with_content(/^\s*username: gitlab_user$/)}
it { is_expected.to contain_file('/home/git/gitlab/config/database.yml').with_content(/^\s*password: 'changeme'$/)}
it { is_expected.to contain_file('/home/git/gitlab/config/database.yml').with_content(/^\s*host: localhost$/)}
it { is_expected.to contain_file('/home/git/gitlab/config/database.yml').with_content(/^\s*port: 3306$/)}
end
context 'postgresql' do
let (:params) {
{
:database => 'gitlab_db',
:group => 'git',
:host => 'localhost',
:owner => 'git',
:password => 'changeme',
:path => '/home/git/gitlab/config/database.yml',
:port => '5432',
:type => 'pgsql',
:username => 'gitlab_user'
}
}
it { is_expected.to contain_file('/home/git/gitlab/config/database.yml').with_content(/^\s*adapter: postgresql$/)}
it { is_expected.to contain_file('/home/git/gitlab/config/database.yml').with_content(/^\s*encoding: unicode$/)}
it { is_expected.to contain_file('/home/git/gitlab/config/database.yml').with_content(/^\s*database: gitlab_db$/)}
it { is_expected.to contain_file('/home/git/gitlab/config/database.yml').with_content(/^\s*username: gitlab_user$/)}
it { is_expected.to contain_file('/home/git/gitlab/config/database.yml').with_content(/^\s*password: 'changeme'$/)}
it { is_expected.to contain_file('/home/git/gitlab/config/database.yml').with_content(/^\s*host: localhost$/)}
it { is_expected.to contain_file('/home/git/gitlab/config/database.yml').with_content(/^\s*port: 5432$/)}
end
end