From 803099bf9035d6e2480576e4008eed8207b7b5ea Mon Sep 17 00:00:00 2001 From: Sander van Zoest Date: Thu, 24 Mar 2016 22:29:56 -0700 Subject: [PATCH] Fix chefspec tests for mod_php5 --- recipes/mod_php5.rb | 2 +- spec/modules/mod_php5_spec.rb | 11 +++++++---- test/fixtures/platforms/opensuse/13.1.json | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/recipes/mod_php5.rb b/recipes/mod_php5.rb index 29d44c2dd..bd2820861 100644 --- a/recipes/mod_php5.rb +++ b/recipes/mod_php5.rb @@ -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' diff --git a/spec/modules/mod_php5_spec.rb b/spec/modules/mod_php5_spec.rb index 0aff00225..9eba57301 100644 --- a/spec/modules/mod_php5_spec.rb +++ b/spec/modules/mod_php5_spec.rb @@ -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) @@ -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) diff --git a/test/fixtures/platforms/opensuse/13.1.json b/test/fixtures/platforms/opensuse/13.1.json index 1f0669bbf..43ae60636 100644 --- a/test/fixtures/platforms/opensuse/13.1.json +++ b/test/fixtures/platforms/opensuse/13.1.json @@ -42,7 +42,7 @@ "pkg_name": "mod_ssl" }, "mod_php5": { - "so_filename": "libphp5.so" + "so_filename": "mod_php5.so" } } }