Skip to content

Commit

Permalink
Fixes spec tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alvagante committed Mar 11, 2014
1 parent 95a7faf commit 4011476
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 33 deletions.
3 changes: 2 additions & 1 deletion .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ fixtures:
"monitor": "git://github.com/example42/puppet-monitor.git"
"firewall": "git://github.com/example42/puppet-firewall.git"
"iptables": "git://github.com/example42/puppet-iptables.git"
"concat": "git://github.com/example42/puppet-concat.git"
"concat": "git://github.com/puppetlabs/puppetlabs-concat.git"
"stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git"
symlinks:
"php": "#{source_dir}"

2 changes: 1 addition & 1 deletion manifests/ini.pp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
default => '/',
}

if ("${sapi_target}" == "all"){
if ($sapi_target == 'all') {

file { "${config_dir}${http_sapi}conf.d/${target}":
ensure => 'present',
Expand Down
38 changes: 7 additions & 31 deletions spec/classes/php_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,50 +25,26 @@

describe 'Test customizations - template' do
let(:params) { {:template => "php/spec.erb" , :options => { 'opt_a' => 'value_a' } } }

it 'should generate a valid template' do
content = catalogue.resource('file', 'php.conf').send(:parameters)[:content]
content.should match "fqdn: rspec.example42.com"
end
it 'should generate a template that uses custom options' do
content = catalogue.resource('file', 'php.conf').send(:parameters)[:content]
content.should match "value_a"
end

it { should contain_file('php.conf').with_content(/fqdn: rspec.example42.com/) }
it { should contain_file('php.conf').with_content(/value_a/) }
end

describe 'Test customizations - source' do
let(:params) { {:source => "puppet://modules/php/spec" , :source_dir => "puppet://modules/php/dir/spec" , :source_dir_purge => true } }

it 'should request a valid source ' do
content = catalogue.resource('file', 'php.conf').send(:parameters)[:source]
content.should == "puppet://modules/php/spec"
end
it 'should request a valid source dir' do
content = catalogue.resource('file', 'php.dir').send(:parameters)[:source]
content.should == "puppet://modules/php/dir/spec"
end
it 'should purge source dir if source_dir_purge is true' do
content = catalogue.resource('file', 'php.dir').send(:parameters)[:purge]
content.should == true
end
it { should contain_file('php.conf').with_source('puppet://modules/php/spec') }
it { should contain_file('php.dir').with_source('puppet://modules/php/dir/spec') }
it { should contain_file('php.dir').with_purge('true') }
end

describe 'Test customizations - custom class' do
let(:params) { {:my_class => "php::spec" } }
it 'should automatically include a custom class' do
content = catalogue.resource('file', 'php.conf').send(:parameters)[:content]
content.should match "fqdn: rspec.example42.com"
end
it { should contain_file('php.conf').with_content(/fqdn: rspec.example42.com/) }
end

describe 'Test Puppi Integration' do
let(:params) { {:puppi => true, :puppi_helper => "myhelper"} }

it 'should generate a puppi::ze define' do
content = catalogue.resource('puppi::ze', 'php').send(:parameters)[:helper]
content.should == "myhelper"
end
it { should contain_puppi__ze('php').with_helper('myhelper') }
end


Expand Down

0 comments on commit 4011476

Please sign in to comment.