Skip to content

Commit

Permalink
fix #22
Browse files Browse the repository at this point in the history
  • Loading branch information
rauchrob committed Nov 30, 2015
2 parents 520067c + 4a6c816 commit 78405a6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 33 deletions.

This file was deleted.

4 changes: 2 additions & 2 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
require kallithea::config::initialize

if $config_hash {
$ini_settings = kallithea_config_hash_to_inifile_resources($config_hash)
create_resources(kallithea::ini_setting, $ini_settings)
$config_ini_defaults = { path => $config_file }
create_ini_settings($config_hash, $config_ini_defaults)
}

if $port {
Expand Down
14 changes: 8 additions & 6 deletions spec/classes/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,21 @@
:app_user => 'myuser',
}

config_file = '/app/root/kallithea.ini'

context 'with default params' do
let(:params) { default_params }

it { should contain_class('kallithea::config::initialize').that_comes_before('kallithea::config') }
it { should contain_exec('initialize kallithea config').with_user('myuser') }
it { should_not contain_file('/app/root/kallithea.ini') }
it { should_not contain_file(config_file) }
end

context 'with config = "foo" set' do
let(:params) { default_params.merge({ :config => 'foo' }) }

it { should contain_file('/app/root/kallithea.ini').with_content('foo') }
it { should_not contain_exec('initialize kallithea config') }
it { should contain_file(config_file).with_content('foo') }
it { should_not contain_exec(config_file) }
end

context 'with complex config_hash set' do
Expand All @@ -30,9 +32,9 @@
}
})}

it { should contain_kallithea__ini_setting('sec1/key1').with_value('val1') }
it { should contain_kallithea__ini_setting('sec1/key2').with_value('val2') }
it { should contain_kallithea__ini_setting('sec2/key3').with_value('val3') }
it { should contain_ini_setting("#{config_file} [sec1] key1").with_value('val1') }
it { should contain_ini_setting("#{config_file} [sec1] key2").with_value('val2') }
it { should contain_ini_setting("#{config_file} [sec2] key3").with_value('val3') }
end

context 'with port = 1234 set' do
Expand Down

0 comments on commit 78405a6

Please sign in to comment.