Skip to content

Commit

Permalink
Fix chefspec tests for mod_php5
Browse files Browse the repository at this point in the history
  • Loading branch information
svanzoest committed Mar 25, 2016
1 parent 2d6c0b2 commit 803099b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion recipes/mod_php5.rb
Expand Up @@ -35,7 +35,7 @@
when 'rhel'
package 'which'
package 'php package' do
if node['platform_version'].to_f < 6.0
if node['platform_version'].to_f < 6.0 && node['platform'] != 'amazon'
package_name 'php53'
else
package_name 'php'
Expand Down
11 changes: 7 additions & 4 deletions spec/modules/mod_php5_spec.rb
Expand Up @@ -11,7 +11,10 @@
property = load_platform_properties(:platform => platform, :platform_version => version)

before(:context) do
@chef_run = ChefSpec::SoloRunner.new(:platform => platform, :version => version)
@chef_run = ChefSpec::SoloRunner.new(:platform => platform, :version => version) do |node|
node.set['apache']['mpm'] = 'prefork'
end

stub_command("#{property[:apache][:binary]} -t").and_return(true)
stub_command('which php').and_return(false)
@chef_run.converge(described_recipe)
Expand All @@ -21,10 +24,10 @@
pkg = 'php'
pkg = 'php53' if version.to_f < 6.0
it "installs package #{pkg}" do
expect(chef_run).to install_yum_package(pkg)
expect(chef_run).to_not install_yum_package("not_#{pkg}")
expect(chef_run).to install_package(pkg)
expect(chef_run).to_not install_package("not_#{pkg}")
end
let(:package) { chef_run.yum_package(pkg) }
let(:package) { chef_run.package(pkg) }
it "triggers a notification by #{pkg} package install to execute[generate-module-list]" do
expect(package).to notify('execute[generate-module-list]').to(:run)
expect(package).to_not notify('execute[generate-module-list]').to(:nothing)
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/platforms/opensuse/13.1.json
Expand Up @@ -42,7 +42,7 @@
"pkg_name": "mod_ssl"
},
"mod_php5": {
"so_filename": "libphp5.so"
"so_filename": "mod_php5.so"
}
}
}

0 comments on commit 803099b

Please sign in to comment.