From 815f5cd745f5f89e5fe9d3c5db623db956f4b8f4 Mon Sep 17 00:00:00 2001 From: Ashley Penney Date: Fri, 6 Jun 2014 10:08:35 -0400 Subject: [PATCH 1/4] Convert specs to RSpec 3.0.0 syntax with Transpec This conversion is done by Transpec 2.2.1 with the following command: transpec spec/classes * 384 conversions from: it { should ... } to: it { is_expected.to ... } * 47 conversions from: it { should_not ... } to: it { is_expected.not_to ... } * 3 conversions from: obj.should to: expect(obj).to * 2 conversions from: == expected to: eq(expected) For more details: https://github.com/yujinakayama/transpec#supported-conversions --- spec/classes/apache_spec.rb | 182 +++++++++++++-------------- spec/classes/dev_spec.rb | 14 +-- spec/classes/mod/auth_kerb_spec.rb | 18 +-- spec/classes/mod/authnz_ldap_spec.rb | 24 ++-- spec/classes/mod/dav_svn_spec.rb | 18 +-- spec/classes/mod/deflate_spec.rb | 12 +- spec/classes/mod/dev_spec.rb | 2 +- spec/classes/mod/dir_spec.rb | 66 +++++----- spec/classes/mod/event_spec.rb | 34 ++--- spec/classes/mod/fastcgi_spec.rb | 16 +-- spec/classes/mod/fcgid_spec.rb | 22 ++-- spec/classes/mod/info_spec.rb | 14 +-- spec/classes/mod/itk_spec.rb | 24 ++-- spec/classes/mod/mime_magic_spec.rb | 16 +-- spec/classes/mod/mime_spec.rb | 6 +- spec/classes/mod/pagespeed_spec.rb | 16 +-- spec/classes/mod/passenger_spec.rb | 88 ++++++------- spec/classes/mod/perl_spec.rb | 18 +-- spec/classes/mod/peruser_spec.rb | 6 +- spec/classes/mod/php_spec.rb | 42 +++---- spec/classes/mod/prefork_spec.rb | 36 +++--- spec/classes/mod/proxy_html_spec.rb | 18 +-- spec/classes/mod/python_spec.rb | 18 +-- spec/classes/mod/rpaf_spec.rb | 32 ++--- spec/classes/mod/speling_spec.rb | 4 +- spec/classes/mod/ssl_spec.rb | 16 +-- spec/classes/mod/status_spec.rb | 20 +-- spec/classes/mod/suphp_spec.rb | 8 +- spec/classes/mod/worker_spec.rb | 36 +++--- spec/classes/mod/wsgi_spec.rb | 22 ++-- spec/classes/params_spec.rb | 4 +- spec/classes/service_spec.rb | 18 +-- 32 files changed, 435 insertions(+), 435 deletions(-) diff --git a/spec/classes/apache_spec.rb b/spec/classes/apache_spec.rb index f32fec808..55d71e039 100644 --- a/spec/classes/apache_spec.rb +++ b/spec/classes/apache_spec.rb @@ -14,16 +14,16 @@ :concat_basedir => '/dne', } end - it { should contain_class("apache::params") } - it { should contain_package("httpd").with( + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_package("httpd").with( 'notify' => 'Class[Apache::Service]', 'ensure' => 'installed' ) } - it { should contain_user("www-data") } - it { should contain_group("www-data") } - it { should contain_class("apache::service") } - it { should contain_file("/etc/apache2/sites-enabled").with( + it { is_expected.to contain_user("www-data") } + it { is_expected.to contain_group("www-data") } + it { is_expected.to contain_class("apache::service") } + it { is_expected.to contain_file("/etc/apache2/sites-enabled").with( 'ensure' => 'directory', 'recurse' => 'true', 'purge' => 'true', @@ -31,7 +31,7 @@ 'require' => 'Package[httpd]' ) } - it { should contain_file("/etc/apache2/mods-enabled").with( + it { is_expected.to contain_file("/etc/apache2/mods-enabled").with( 'ensure' => 'directory', 'recurse' => 'true', 'purge' => 'true', @@ -39,7 +39,7 @@ 'require' => 'Package[httpd]' ) } - it { should contain_file("/etc/apache2/mods-available").with( + it { is_expected.to contain_file("/etc/apache2/mods-available").with( 'ensure' => 'directory', 'recurse' => 'true', 'purge' => 'false', @@ -47,7 +47,7 @@ 'require' => 'Package[httpd]' ) } - it { should contain_concat("/etc/apache2/ports.conf").with( + it { is_expected.to contain_concat("/etc/apache2/ports.conf").with( 'owner' => 'root', 'group' => 'root', 'mode' => '0644', @@ -65,17 +65,17 @@ 'dav', 'env' ].each do |modname| - it { should contain_file("#{modname}.load").with( + it { is_expected.to contain_file("#{modname}.load").with( 'path' => "/etc/apache2/mods-available/#{modname}.load", 'ensure' => 'file' ) } - it { should contain_file("#{modname}.load symlink").with( + it { is_expected.to contain_file("#{modname}.load symlink").with( 'path' => "/etc/apache2/mods-enabled/#{modname}.load", 'ensure' => 'link', 'target' => "/etc/apache2/mods-available/#{modname}.load" ) } - it { should_not contain_file("#{modname}.conf") } - it { should_not contain_file("#{modname}.conf symlink") } + it { is_expected.not_to contain_file("#{modname}.conf") } + it { is_expected.not_to contain_file("#{modname}.conf symlink") } end context "with Apache version < 2.4" do @@ -83,7 +83,7 @@ { :apache_version => '2.2' } end - it { should contain_file("/etc/apache2/apache2.conf").with_content %r{^Include "/etc/apache2/conf\.d/\*\.conf"$} } + it { is_expected.to contain_file("/etc/apache2/apache2.conf").with_content %r{^Include "/etc/apache2/conf\.d/\*\.conf"$} } end context "with Apache version >= 2.4" do @@ -91,7 +91,7 @@ { :apache_version => '2.4' } end - it { should contain_file("/etc/apache2/apache2.conf").with_content %r{^IncludeOptional "/etc/apache2/conf\.d/\*\.conf"$} } + it { is_expected.to contain_file("/etc/apache2/apache2.conf").with_content %r{^IncludeOptional "/etc/apache2/conf\.d/\*\.conf"$} } end # Assert that both load files and conf files are placed and symlinked for these mods @@ -105,20 +105,20 @@ 'negotiation', 'setenvif', ].each do |modname| - it { should contain_file("#{modname}.load").with( + it { is_expected.to contain_file("#{modname}.load").with( 'path' => "/etc/apache2/mods-available/#{modname}.load", 'ensure' => 'file' ) } - it { should contain_file("#{modname}.load symlink").with( + it { is_expected.to contain_file("#{modname}.load symlink").with( 'path' => "/etc/apache2/mods-enabled/#{modname}.load", 'ensure' => 'link', 'target' => "/etc/apache2/mods-available/#{modname}.load" ) } - it { should contain_file("#{modname}.conf").with( + it { is_expected.to contain_file("#{modname}.conf").with( 'path' => "/etc/apache2/mods-available/#{modname}.conf", 'ensure' => 'file' ) } - it { should contain_file("#{modname}.conf symlink").with( + it { is_expected.to contain_file("#{modname}.conf symlink").with( 'path' => "/etc/apache2/mods-enabled/#{modname}.conf", 'ensure' => 'link', 'target' => "/etc/apache2/mods-available/#{modname}.conf" @@ -131,8 +131,8 @@ { :manage_user => false } end - it { should_not contain_user('www-data') } - it { should contain_file("/etc/apache2/apache2.conf").with_content %r{^User www-data\n} } + it { is_expected.not_to contain_user('www-data') } + it { is_expected.to contain_file("/etc/apache2/apache2.conf").with_content %r{^User www-data\n} } end end describe "Don't create group resource" do @@ -141,8 +141,8 @@ { :manage_group => false } end - it { should_not contain_group('www-data') } - it { should contain_file("/etc/apache2/apache2.conf").with_content %r{^Group www-data\n} } + it { is_expected.not_to contain_group('www-data') } + it { is_expected.to contain_file("/etc/apache2/apache2.conf").with_content %r{^Group www-data\n} } end end @@ -155,8 +155,8 @@ } } end - it { should contain_file("/etc/apache2/apache2.conf").with_content %r{^LogFormat "%v %h %l %u %t \"%r\" %>s %b" vhost_common\n} } - it { should contain_file("/etc/apache2/apache2.conf").with_content %r{^LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" vhost_combined\n} } + it { is_expected.to contain_file("/etc/apache2/apache2.conf").with_content %r{^LogFormat "%v %h %l %u %t \"%r\" %>s %b" vhost_common\n} } + it { is_expected.to contain_file("/etc/apache2/apache2.conf").with_content %r{^LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" vhost_combined\n} } end end @@ -174,7 +174,7 @@ :operatingsystemrelease => '13.10' }) end - it { should contain_class('apache').with_apache_version('2.4') } + it { is_expected.to contain_class('apache').with_apache_version('2.4') } end context "12.04" do let :facts do @@ -183,7 +183,7 @@ :operatingsystemrelease => '12.04' }) end - it { should contain_class('apache').with_apache_version('2.2') } + it { is_expected.to contain_class('apache').with_apache_version('2.2') } end context "13.04" do let :facts do @@ -192,7 +192,7 @@ :operatingsystemrelease => '13.04' }) end - it { should contain_class('apache').with_apache_version('2.2') } + it { is_expected.to contain_class('apache').with_apache_version('2.2') } end end end @@ -208,16 +208,16 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should contain_package("httpd").with( + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_package("httpd").with( 'notify' => 'Class[Apache::Service]', 'ensure' => 'installed' ) } - it { should contain_user("apache") } - it { should contain_group("apache") } - it { should contain_class("apache::service") } - it { should contain_file("/etc/httpd/conf.d").with( + it { is_expected.to contain_user("apache") } + it { is_expected.to contain_group("apache") } + it { is_expected.to contain_class("apache::service") } + it { is_expected.to contain_file("/etc/httpd/conf.d").with( 'ensure' => 'directory', 'recurse' => 'true', 'purge' => 'true', @@ -225,7 +225,7 @@ 'require' => 'Package[httpd]' ) } - it { should contain_concat("/etc/httpd/conf/ports.conf").with( + it { is_expected.to contain_concat("/etc/httpd/conf/ports.conf").with( 'owner' => 'root', 'group' => 'root', 'mode' => '0644', @@ -242,7 +242,7 @@ end ['mod.d','site.d','conf.d'].each do |dir| - it { should contain_file("/etc/httpd/#{dir}").with( + it { is_expected.to contain_file("/etc/httpd/#{dir}").with( 'ensure' => 'directory', 'recurse' => 'true', 'purge' => 'true', @@ -262,10 +262,10 @@ 'dav', 'env', ].each do |modname| - it { should contain_file("#{modname}.load").with_path( + it { is_expected.to contain_file("#{modname}.load").with_path( "/etc/httpd/mod.d/#{modname}.load" ) } - it { should_not contain_file("#{modname}.conf").with_path( + it { is_expected.not_to contain_file("#{modname}.conf").with_path( "/etc/httpd/mod.d/#{modname}.conf" ) } end @@ -281,10 +281,10 @@ 'negotiation', 'setenvif', ].each do |modname| - it { should contain_file("#{modname}.load").with_path( + it { is_expected.to contain_file("#{modname}.load").with_path( "/etc/httpd/mod.d/#{modname}.load" ) } - it { should contain_file("#{modname}.conf").with_path( + it { is_expected.to contain_file("#{modname}.conf").with_path( "/etc/httpd/mod.d/#{modname}.conf" ) } end @@ -294,7 +294,7 @@ { :apache_version => '2.2' } end - it { should contain_file("/etc/httpd/conf/httpd.conf").with_content %r{^Include "/etc/httpd/conf\.d/\*\.conf"$} } + it { is_expected.to contain_file("/etc/httpd/conf/httpd.conf").with_content %r{^Include "/etc/httpd/conf\.d/\*\.conf"$} } end context "with Apache version >= 2.4" do @@ -302,12 +302,12 @@ { :apache_version => '2.4' } end - it { should contain_file("/etc/httpd/conf/httpd.conf").with_content %r{^IncludeOptional "/etc/httpd/conf\.d/\*\.conf"$} } + it { is_expected.to contain_file("/etc/httpd/conf/httpd.conf").with_content %r{^IncludeOptional "/etc/httpd/conf\.d/\*\.conf"$} } end - it { should contain_file("/etc/httpd/conf/httpd.conf").with_content %r{^Include "/etc/httpd/site\.d/\*"$} } - it { should contain_file("/etc/httpd/conf/httpd.conf").with_content %r{^Include "/etc/httpd/mod\.d/\*\.conf"$} } - it { should contain_file("/etc/httpd/conf/httpd.conf").with_content %r{^Include "/etc/httpd/mod\.d/\*\.load"$} } + it { is_expected.to contain_file("/etc/httpd/conf/httpd.conf").with_content %r{^Include "/etc/httpd/site\.d/\*"$} } + it { is_expected.to contain_file("/etc/httpd/conf/httpd.conf").with_content %r{^Include "/etc/httpd/mod\.d/\*\.conf"$} } + it { is_expected.to contain_file("/etc/httpd/conf/httpd.conf").with_content %r{^Include "/etc/httpd/mod\.d/\*\.load"$} } end describe "Alternate conf.d directory" do @@ -315,7 +315,7 @@ { :confd_dir => '/etc/httpd/special_conf.d' } end - it { should contain_file("/etc/httpd/special_conf.d").with( + it { is_expected.to contain_file("/etc/httpd/special_conf.d").with( 'ensure' => 'directory', 'recurse' => 'true', 'purge' => 'true', @@ -330,32 +330,32 @@ { :mpm_module => false } end it 'should not declare mpm modules' do - should_not contain_class('apache::mod::event') - should_not contain_class('apache::mod::itk') - should_not contain_class('apache::mod::peruser') - should_not contain_class('apache::mod::prefork') - should_not contain_class('apache::mod::worker') + is_expected.not_to contain_class('apache::mod::event') + is_expected.not_to contain_class('apache::mod::itk') + is_expected.not_to contain_class('apache::mod::peruser') + is_expected.not_to contain_class('apache::mod::prefork') + is_expected.not_to contain_class('apache::mod::worker') end end context "when declaring mpm_module => prefork" do let :params do { :mpm_module => 'prefork' } end - it { should contain_class('apache::mod::prefork') } - it { should_not contain_class('apache::mod::event') } - it { should_not contain_class('apache::mod::itk') } - it { should_not contain_class('apache::mod::peruser') } - it { should_not contain_class('apache::mod::worker') } + it { is_expected.to contain_class('apache::mod::prefork') } + it { is_expected.not_to contain_class('apache::mod::event') } + it { is_expected.not_to contain_class('apache::mod::itk') } + it { is_expected.not_to contain_class('apache::mod::peruser') } + it { is_expected.not_to contain_class('apache::mod::worker') } end context "when declaring mpm_module => worker" do let :params do { :mpm_module => 'worker' } end - it { should contain_class('apache::mod::worker') } - it { should_not contain_class('apache::mod::event') } - it { should_not contain_class('apache::mod::itk') } - it { should_not contain_class('apache::mod::peruser') } - it { should_not contain_class('apache::mod::prefork') } + it { is_expected.to contain_class('apache::mod::worker') } + it { is_expected.not_to contain_class('apache::mod::event') } + it { is_expected.not_to contain_class('apache::mod::itk') } + it { is_expected.not_to contain_class('apache::mod::peruser') } + it { is_expected.not_to contain_class('apache::mod::prefork') } end context "when declaring mpm_module => breakme" do let :params do @@ -370,13 +370,13 @@ let :params do { :conf_template => 'apache/httpd.conf.erb' } end - it { should contain_file("/etc/httpd/conf/httpd.conf").with_content %r{^# Security\n} } + it { is_expected.to contain_file("/etc/httpd/conf/httpd.conf").with_content %r{^# Security\n} } end context "with non-default" do let :params do { :conf_template => 'site_apache/fake.conf.erb' } end - it { should contain_file("/etc/httpd/conf/httpd.conf").with_content %r{^Fake template for rspec.$} } + it { is_expected.to contain_file("/etc/httpd/conf/httpd.conf").with_content %r{^Fake template for rspec.$} } end end @@ -386,8 +386,8 @@ { :default_mods => false } end - it { should contain_apache__mod('authz_host') } - it { should_not contain_apache__mod('env') } + it { is_expected.to contain_apache__mod('authz_host') } + it { is_expected.not_to contain_apache__mod('env') } end context "custom" do let :params do @@ -401,10 +401,10 @@ ]} end - it { should contain_apache__mod('authz_host') } - it { should contain_apache__mod('env') } - it { should contain_class('apache::mod::info') } - it { should contain_class('apache::mod::mime') } + it { is_expected.to contain_apache__mod('authz_host') } + it { is_expected.to contain_apache__mod('env') } + it { is_expected.to contain_class('apache::mod::info') } + it { is_expected.to contain_class('apache::mod::mime') } end end describe "Don't create user resource" do @@ -413,8 +413,8 @@ { :manage_user => false } end - it { should_not contain_user('apache') } - it { should contain_file("/etc/httpd/conf/httpd.conf").with_content %r{^User apache\n} } + it { is_expected.not_to contain_user('apache') } + it { is_expected.to contain_file("/etc/httpd/conf/httpd.conf").with_content %r{^User apache\n} } end end describe "Don't create group resource" do @@ -423,8 +423,8 @@ { :manage_group => false } end - it { should_not contain_group('apache') } - it { should contain_file("/etc/httpd/conf/httpd.conf").with_content %r{^Group apache\n} } + it { is_expected.not_to contain_group('apache') } + it { is_expected.to contain_file("/etc/httpd/conf/httpd.conf").with_content %r{^Group apache\n} } end end @@ -443,13 +443,13 @@ let :params do { :sendfile => 'On' } end - it { should contain_file("/etc/httpd/conf/httpd.conf").with_content %r{^EnableSendfile On\n} } + it { is_expected.to contain_file("/etc/httpd/conf/httpd.conf").with_content %r{^EnableSendfile On\n} } end context "Off" do let :params do { :sendfile => 'Off' } end - it { should contain_file("/etc/httpd/conf/httpd.conf").with_content %r{^EnableSendfile Off\n} } + it { is_expected.to contain_file("/etc/httpd/conf/httpd.conf").with_content %r{^EnableSendfile Off\n} } end end end @@ -465,26 +465,26 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should contain_class("apache::package").with({'ensure' => 'present'}) } - it { should contain_user("www") } - it { should contain_group("www") } - it { should contain_class("apache::service") } - it { should contain_file("/usr/local/etc/apache22/Vhosts").with( + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_class("apache::package").with({'ensure' => 'present'}) } + it { is_expected.to contain_user("www") } + it { is_expected.to contain_group("www") } + it { is_expected.to contain_class("apache::service") } + it { is_expected.to contain_file("/usr/local/etc/apache22/Vhosts").with( 'ensure' => 'directory', 'recurse' => 'true', 'purge' => 'true', 'notify' => 'Class[Apache::Service]', 'require' => 'Package[httpd]' ) } - it { should contain_file("/usr/local/etc/apache22/Modules").with( + it { is_expected.to contain_file("/usr/local/etc/apache22/Modules").with( 'ensure' => 'directory', 'recurse' => 'true', 'purge' => 'true', 'notify' => 'Class[Apache::Service]', 'require' => 'Package[httpd]' ) } - it { should contain_concat("/usr/local/etc/apache22/ports.conf").with( + it { is_expected.to contain_concat("/usr/local/etc/apache22/ports.conf").with( 'owner' => 'root', 'group' => 'wheel', 'mode' => '0644', @@ -501,11 +501,11 @@ 'dav', 'env' ].each do |modname| - it { should contain_file("#{modname}.load").with( + it { is_expected.to contain_file("#{modname}.load").with( 'path' => "/usr/local/etc/apache22/Modules/#{modname}.load", 'ensure' => 'file' ) } - it { should_not contain_file("#{modname}.conf") } + it { is_expected.not_to contain_file("#{modname}.conf") } end # Assert that both load files and conf files are placed for these mods @@ -519,11 +519,11 @@ 'negotiation', 'setenvif', ].each do |modname| - it { should contain_file("#{modname}.load").with( + it { is_expected.to contain_file("#{modname}.load").with( 'path' => "/usr/local/etc/apache22/Modules/#{modname}.load", 'ensure' => 'file' ) } - it { should contain_file("#{modname}.conf").with( + it { is_expected.to contain_file("#{modname}.conf").with( 'path' => "/usr/local/etc/apache22/Modules/#{modname}.conf", 'ensure' => 'file' ) } @@ -542,22 +542,22 @@ } end context 'default vhost defaults' do - it { should contain_apache__vhost('default').with_ensure('present') } - it { should contain_apache__vhost('default-ssl').with_ensure('absent') } + it { is_expected.to contain_apache__vhost('default').with_ensure('present') } + it { is_expected.to contain_apache__vhost('default-ssl').with_ensure('absent') } end context 'without default non-ssl vhost' do let :params do { :default_vhost => false } end - it { should contain_apache__vhost('default').with_ensure('absent') } + it { is_expected.to contain_apache__vhost('default').with_ensure('absent') } end context 'with default ssl vhost' do let :params do { :default_ssl_vhost => true } end - it { should contain_apache__vhost('default-ssl').with_ensure('present') } + it { is_expected.to contain_apache__vhost('default-ssl').with_ensure('present') } end end end diff --git a/spec/classes/dev_spec.rb b/spec/classes/dev_spec.rb index eceadca4a..df342d40e 100644 --- a/spec/classes/dev_spec.rb +++ b/spec/classes/dev_spec.rb @@ -10,10 +10,10 @@ :operatingsystemrelease => '6', } end - it { should contain_class("apache::params") } - it { should contain_package("libaprutil1-dev") } - it { should contain_package("libapr1-dev") } - it { should contain_package("apache2-prefork-dev") } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_package("libaprutil1-dev") } + it { is_expected.to contain_package("libapr1-dev") } + it { is_expected.to contain_package("apache2-prefork-dev") } end context "on a RedHat OS" do let :facts do @@ -23,8 +23,8 @@ :operatingsystemrelease => '6', } end - it { should contain_class("apache::params") } - it { should contain_package("httpd-devel") } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_package("httpd-devel") } end context "on a FreeBSD OS" do let :pre_condition do @@ -37,6 +37,6 @@ :operatingsystemrelease => '9', } end - it { should contain_class("apache::params") } + it { is_expected.to contain_class("apache::params") } end end diff --git a/spec/classes/mod/auth_kerb_spec.rb b/spec/classes/mod/auth_kerb_spec.rb index 6e2c16b7e..1706bfb8d 100644 --- a/spec/classes/mod/auth_kerb_spec.rb +++ b/spec/classes/mod/auth_kerb_spec.rb @@ -17,9 +17,9 @@ :concat_basedir => '/dne', } end - it { should contain_class("apache::params") } - it { should contain_apache__mod("auth_kerb") } - it { should contain_package("libapache2-mod-auth-kerb") } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod("auth_kerb") } + it { is_expected.to contain_package("libapache2-mod-auth-kerb") } end context "on a RedHat OS", :compile do let :facts do @@ -33,9 +33,9 @@ :concat_basedir => '/dne', } end - it { should contain_class("apache::params") } - it { should contain_apache__mod("auth_kerb") } - it { should contain_package("mod_auth_kerb") } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod("auth_kerb") } + it { is_expected.to contain_package("mod_auth_kerb") } end context "on a FreeBSD OS", :compile do let :facts do @@ -49,8 +49,8 @@ :concat_basedir => '/dne', } end - it { should contain_class("apache::params") } - it { should contain_apache__mod("auth_kerb") } - it { should contain_package("www/mod_auth_kerb2") } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod("auth_kerb") } + it { is_expected.to contain_package("www/mod_auth_kerb2") } end end diff --git a/spec/classes/mod/authnz_ldap_spec.rb b/spec/classes/mod/authnz_ldap_spec.rb index d9ca5398b..a0a913a6e 100644 --- a/spec/classes/mod/authnz_ldap_spec.rb +++ b/spec/classes/mod/authnz_ldap_spec.rb @@ -18,23 +18,23 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should contain_class("apache::mod::ldap") } - it { should contain_apache__mod('authnz_ldap') } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_class("apache::mod::ldap") } + it { is_expected.to contain_apache__mod('authnz_ldap') } context 'default verifyServerCert' do - it { should contain_file('authnz_ldap.conf').with_content(/^LDAPVerifyServerCert On$/) } + it { is_expected.to contain_file('authnz_ldap.conf').with_content(/^LDAPVerifyServerCert On$/) } end context 'verifyServerCert = false' do let(:params) { { :verifyServerCert => false } } - it { should contain_file('authnz_ldap.conf').with_content(/^LDAPVerifyServerCert Off$/) } + it { is_expected.to contain_file('authnz_ldap.conf').with_content(/^LDAPVerifyServerCert Off$/) } end context 'verifyServerCert = wrong' do let(:params) { { :verifyServerCert => 'wrong' } } it 'should raise an error' do - expect { should raise_error Puppet::Error } + expect { is_expected.to raise_error Puppet::Error } end end end #Debian @@ -51,23 +51,23 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should contain_class("apache::mod::ldap") } - it { should contain_apache__mod('authnz_ldap') } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_class("apache::mod::ldap") } + it { is_expected.to contain_apache__mod('authnz_ldap') } context 'default verifyServerCert' do - it { should contain_file('authnz_ldap.conf').with_content(/^LDAPVerifyServerCert On$/) } + it { is_expected.to contain_file('authnz_ldap.conf').with_content(/^LDAPVerifyServerCert On$/) } end context 'verifyServerCert = false' do let(:params) { { :verifyServerCert => false } } - it { should contain_file('authnz_ldap.conf').with_content(/^LDAPVerifyServerCert Off$/) } + it { is_expected.to contain_file('authnz_ldap.conf').with_content(/^LDAPVerifyServerCert Off$/) } end context 'verifyServerCert = wrong' do let(:params) { { :verifyServerCert => 'wrong' } } it 'should raise an error' do - expect { should raise_error Puppet::Error } + expect { is_expected.to raise_error Puppet::Error } end end end # Redhat diff --git a/spec/classes/mod/dav_svn_spec.rb b/spec/classes/mod/dav_svn_spec.rb index 4898cdece..859174af7 100644 --- a/spec/classes/mod/dav_svn_spec.rb +++ b/spec/classes/mod/dav_svn_spec.rb @@ -17,9 +17,9 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should contain_apache__mod('dav_svn') } - it { should contain_package("libapache2-svn") } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('dav_svn') } + it { is_expected.to contain_package("libapache2-svn") } end context "on a RedHat OS" do let :facts do @@ -33,9 +33,9 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should contain_apache__mod('dav_svn') } - it { should contain_package("mod_dav_svn") } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('dav_svn') } + it { is_expected.to contain_package("mod_dav_svn") } end context "on a FreeBSD OS" do let :facts do @@ -49,8 +49,8 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should contain_apache__mod('dav_svn') } - it { should contain_package("devel/subversion") } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('dav_svn') } + it { is_expected.to contain_package("devel/subversion") } end end diff --git a/spec/classes/mod/deflate_spec.rb b/spec/classes/mod/deflate_spec.rb index f8eb88101..227c97a82 100644 --- a/spec/classes/mod/deflate_spec.rb +++ b/spec/classes/mod/deflate_spec.rb @@ -2,10 +2,10 @@ # This function is called inside the OS specific contexts def general_deflate_specs - it { should contain_apache__mod("deflate") } + it { is_expected.to contain_apache__mod("deflate") } it do - should contain_file("deflate.conf").with_content( + is_expected.to contain_file("deflate.conf").with_content( "AddOutputFilterByType DEFLATE text/html text/plain text/xml\n"\ "AddOutputFilterByType DEFLATE text/css\n"\ "AddOutputFilterByType DEFLATE application/x-javascript application/javascript application/ecmascript\n"\ @@ -39,11 +39,11 @@ def general_deflate_specs # Load the more generic tests for this context general_deflate_specs() - it { should contain_file("deflate.conf").with({ + it { is_expected.to contain_file("deflate.conf").with({ :ensure => 'file', :path => '/etc/apache2/mods-available/deflate.conf', } ) } - it { should contain_file("deflate.conf symlink").with({ + it { is_expected.to contain_file("deflate.conf symlink").with({ :ensure => 'link', :path => '/etc/apache2/mods-enabled/deflate.conf', } ) } @@ -64,7 +64,7 @@ def general_deflate_specs # Load the more generic tests for this context general_deflate_specs() - it { should contain_file("deflate.conf").with_path("/etc/httpd/conf.d/deflate.conf") } + it { is_expected.to contain_file("deflate.conf").with_path("/etc/httpd/conf.d/deflate.conf") } end context "On a FreeBSD OS with default params" do @@ -82,7 +82,7 @@ def general_deflate_specs # Load the more generic tests for this context general_deflate_specs() - it { should contain_file("deflate.conf").with({ + it { is_expected.to contain_file("deflate.conf").with({ :ensure => 'file', :path => '/usr/local/etc/apache22/Modules/deflate.conf', } ) } diff --git a/spec/classes/mod/dev_spec.rb b/spec/classes/mod/dev_spec.rb index 0de62afcb..84d80e344 100644 --- a/spec/classes/mod/dev_spec.rb +++ b/spec/classes/mod/dev_spec.rb @@ -20,7 +20,7 @@ :operatingsystemrelease => operatingsystemrelease, } end - it { should contain_class('apache::dev') } + it { is_expected.to contain_class('apache::dev') } end end end diff --git a/spec/classes/mod/dir_spec.rb b/spec/classes/mod/dir_spec.rb index 8bcdc0b6b..1efed2fe7 100644 --- a/spec/classes/mod/dir_spec.rb +++ b/spec/classes/mod/dir_spec.rb @@ -20,22 +20,22 @@ } end context "passing no parameters" do - it { should contain_class("apache::params") } - it { should contain_apache__mod('dir') } - it { should contain_file('dir.conf').with_content(/^DirectoryIndex /) } - it { should contain_file('dir.conf').with_content(/ index\.html /) } - it { should contain_file('dir.conf').with_content(/ index\.html\.var /) } - it { should contain_file('dir.conf').with_content(/ index\.cgi /) } - it { should contain_file('dir.conf').with_content(/ index\.pl /) } - it { should contain_file('dir.conf').with_content(/ index\.php /) } - it { should contain_file('dir.conf').with_content(/ index\.xhtml$/) } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('dir') } + it { is_expected.to contain_file('dir.conf').with_content(/^DirectoryIndex /) } + it { is_expected.to contain_file('dir.conf').with_content(/ index\.html /) } + it { is_expected.to contain_file('dir.conf').with_content(/ index\.html\.var /) } + it { is_expected.to contain_file('dir.conf').with_content(/ index\.cgi /) } + it { is_expected.to contain_file('dir.conf').with_content(/ index\.pl /) } + it { is_expected.to contain_file('dir.conf').with_content(/ index\.php /) } + it { is_expected.to contain_file('dir.conf').with_content(/ index\.xhtml$/) } end context "passing indexes => ['example.txt','fearsome.aspx']" do let :params do {:indexes => ['example.txt','fearsome.aspx']} end - it { should contain_file('dir.conf').with_content(/ example\.txt /) } - it { should contain_file('dir.conf').with_content(/ fearsome\.aspx$/) } + it { is_expected.to contain_file('dir.conf').with_content(/ example\.txt /) } + it { is_expected.to contain_file('dir.conf').with_content(/ fearsome\.aspx$/) } end end context "on a RedHat OS" do @@ -51,22 +51,22 @@ } end context "passing no parameters" do - it { should contain_class("apache::params") } - it { should contain_apache__mod('dir') } - it { should contain_file('dir.conf').with_content(/^DirectoryIndex /) } - it { should contain_file('dir.conf').with_content(/ index\.html /) } - it { should contain_file('dir.conf').with_content(/ index\.html\.var /) } - it { should contain_file('dir.conf').with_content(/ index\.cgi /) } - it { should contain_file('dir.conf').with_content(/ index\.pl /) } - it { should contain_file('dir.conf').with_content(/ index\.php /) } - it { should contain_file('dir.conf').with_content(/ index\.xhtml$/) } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('dir') } + it { is_expected.to contain_file('dir.conf').with_content(/^DirectoryIndex /) } + it { is_expected.to contain_file('dir.conf').with_content(/ index\.html /) } + it { is_expected.to contain_file('dir.conf').with_content(/ index\.html\.var /) } + it { is_expected.to contain_file('dir.conf').with_content(/ index\.cgi /) } + it { is_expected.to contain_file('dir.conf').with_content(/ index\.pl /) } + it { is_expected.to contain_file('dir.conf').with_content(/ index\.php /) } + it { is_expected.to contain_file('dir.conf').with_content(/ index\.xhtml$/) } end context "passing indexes => ['example.txt','fearsome.aspx']" do let :params do {:indexes => ['example.txt','fearsome.aspx']} end - it { should contain_file('dir.conf').with_content(/ example\.txt /) } - it { should contain_file('dir.conf').with_content(/ fearsome\.aspx$/) } + it { is_expected.to contain_file('dir.conf').with_content(/ example\.txt /) } + it { is_expected.to contain_file('dir.conf').with_content(/ fearsome\.aspx$/) } end end context "on a FreeBSD OS" do @@ -82,22 +82,22 @@ } end context "passing no parameters" do - it { should contain_class("apache::params") } - it { should contain_apache__mod('dir') } - it { should contain_file('dir.conf').with_content(/^DirectoryIndex /) } - it { should contain_file('dir.conf').with_content(/ index\.html /) } - it { should contain_file('dir.conf').with_content(/ index\.html\.var /) } - it { should contain_file('dir.conf').with_content(/ index\.cgi /) } - it { should contain_file('dir.conf').with_content(/ index\.pl /) } - it { should contain_file('dir.conf').with_content(/ index\.php /) } - it { should contain_file('dir.conf').with_content(/ index\.xhtml$/) } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('dir') } + it { is_expected.to contain_file('dir.conf').with_content(/^DirectoryIndex /) } + it { is_expected.to contain_file('dir.conf').with_content(/ index\.html /) } + it { is_expected.to contain_file('dir.conf').with_content(/ index\.html\.var /) } + it { is_expected.to contain_file('dir.conf').with_content(/ index\.cgi /) } + it { is_expected.to contain_file('dir.conf').with_content(/ index\.pl /) } + it { is_expected.to contain_file('dir.conf').with_content(/ index\.php /) } + it { is_expected.to contain_file('dir.conf').with_content(/ index\.xhtml$/) } end context "passing indexes => ['example.txt','fearsome.aspx']" do let :params do {:indexes => ['example.txt','fearsome.aspx']} end - it { should contain_file('dir.conf').with_content(/ example\.txt /) } - it { should contain_file('dir.conf').with_content(/ fearsome\.aspx$/) } + it { is_expected.to contain_file('dir.conf').with_content(/ example\.txt /) } + it { is_expected.to contain_file('dir.conf').with_content(/ fearsome\.aspx$/) } end end end diff --git a/spec/classes/mod/event_spec.rb b/spec/classes/mod/event_spec.rb index 850bd5c55..3061ca9b1 100644 --- a/spec/classes/mod/event_spec.rb +++ b/spec/classes/mod/event_spec.rb @@ -16,9 +16,9 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should_not contain_apache__mod('event') } - it { should contain_file("/usr/local/etc/apache22/Modules/event.conf").with_ensure('file') } + it { is_expected.to contain_class("apache::params") } + it { is_expected.not_to contain_apache__mod('event') } + it { is_expected.to contain_file("/usr/local/etc/apache22/Modules/event.conf").with_ensure('file') } end context "on a Debian OS" do let :facts do @@ -34,10 +34,10 @@ } end - it { should contain_class("apache::params") } - it { should_not contain_apache__mod('event') } - it { should contain_file("/etc/apache2/mods-available/event.conf").with_ensure('file') } - it { should contain_file("/etc/apache2/mods-enabled/event.conf").with_ensure('link') } + it { is_expected.to contain_class("apache::params") } + it { is_expected.not_to contain_apache__mod('event') } + it { is_expected.to contain_file("/etc/apache2/mods-available/event.conf").with_ensure('file') } + it { is_expected.to contain_file("/etc/apache2/mods-enabled/event.conf").with_ensure('link') } context "with Apache version < 2.4" do let :params do @@ -46,10 +46,10 @@ } end - it { should_not contain_file("/etc/apache2/mods-available/event.load") } - it { should_not contain_file("/etc/apache2/mods-enabled/event.load") } + it { is_expected.not_to contain_file("/etc/apache2/mods-available/event.load") } + it { is_expected.not_to contain_file("/etc/apache2/mods-enabled/event.load") } - it { should contain_package("apache2-mpm-event") } + it { is_expected.to contain_package("apache2-mpm-event") } end context "with Apache version >= 2.4" do @@ -59,12 +59,12 @@ } end - it { should contain_file("/etc/apache2/mods-available/event.load").with({ + it { is_expected.to contain_file("/etc/apache2/mods-available/event.load").with({ 'ensure' => 'file', 'content' => "LoadModule mpm_event_module /usr/lib/apache2/modules/mod_mpm_event.so\n" }) } - it { should contain_file("/etc/apache2/mods-enabled/event.load").with_ensure('link') } + it { is_expected.to contain_file("/etc/apache2/mods-enabled/event.load").with_ensure('link') } end end context "on a RedHat OS" do @@ -87,13 +87,13 @@ } end - it { should contain_class("apache::params") } - it { should_not contain_apache__mod('worker') } - it { should_not contain_apache__mod('prefork') } + it { is_expected.to contain_class("apache::params") } + it { is_expected.not_to contain_apache__mod('worker') } + it { is_expected.not_to contain_apache__mod('prefork') } - it { should contain_file("/etc/httpd/conf.d/event.conf").with_ensure('file') } + it { is_expected.to contain_file("/etc/httpd/conf.d/event.conf").with_ensure('file') } - it { should contain_file("/etc/httpd/conf.d/event.load").with({ + it { is_expected.to contain_file("/etc/httpd/conf.d/event.load").with({ 'ensure' => 'file', 'content' => "LoadModule mpm_event_module modules/mod_mpm_event.so\n", }) diff --git a/spec/classes/mod/fastcgi_spec.rb b/spec/classes/mod/fastcgi_spec.rb index 98ad2e870..126c5cc3e 100644 --- a/spec/classes/mod/fastcgi_spec.rb +++ b/spec/classes/mod/fastcgi_spec.rb @@ -17,10 +17,10 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should contain_apache__mod('fastcgi') } - it { should contain_package("libapache2-mod-fastcgi") } - it { should contain_file('fastcgi.conf') } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('fastcgi') } + it { is_expected.to contain_package("libapache2-mod-fastcgi") } + it { is_expected.to contain_file('fastcgi.conf') } end context "on a RedHat OS" do @@ -35,9 +35,9 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should contain_apache__mod('fastcgi') } - it { should contain_package("mod_fastcgi") } - it { should_not contain_file('fastcgi.conf') } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('fastcgi') } + it { is_expected.to contain_package("mod_fastcgi") } + it { is_expected.not_to contain_file('fastcgi.conf') } end end diff --git a/spec/classes/mod/fcgid_spec.rb b/spec/classes/mod/fcgid_spec.rb index 16719415d..ab47a5a8e 100644 --- a/spec/classes/mod/fcgid_spec.rb +++ b/spec/classes/mod/fcgid_spec.rb @@ -18,9 +18,9 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should contain_apache__mod('fcgid') } - it { should contain_package("libapache2-mod-fcgid") } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('fcgid') } + it { is_expected.to contain_package("libapache2-mod-fcgid") } end context "on a RedHat OS" do @@ -37,9 +37,9 @@ end describe 'without parameters' do - it { should contain_class("apache::params") } - it { should contain_apache__mod('fcgid') } - it { should contain_package("mod_fcgid") } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('fcgid') } + it { is_expected.to contain_package("mod_fcgid") } end describe 'with parameters' do @@ -54,14 +54,14 @@ it 'should contain the correct config' do content = subject.resource('file', 'fcgid.conf').send(:parameters)[:content] - content.split("\n").reject { |c| c =~ /(^#|^$)/ }.should == [ + expect(content.split("\n").reject { |c| c =~ /(^#|^$)/ }).to eq([ '', ' AddHandler fcgid-script .fcgi', ' FcgidIPCDir /var/run/fcgidsock', ' FcgidMinProcessesPerClass 0', ' SharememPath /var/run/fcgid_shm', '', - ] + ]) end end end @@ -79,8 +79,8 @@ } end - it { should contain_class("apache::params") } - it { should contain_apache__mod('fcgid') } - it { should contain_package("www/mod_fcgid") } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('fcgid') } + it { is_expected.to contain_package("www/mod_fcgid") } end end diff --git a/spec/classes/mod/info_spec.rb b/spec/classes/mod/info_spec.rb index ed078c519..3415dec67 100644 --- a/spec/classes/mod/info_spec.rb +++ b/spec/classes/mod/info_spec.rb @@ -2,10 +2,10 @@ # This function is called inside the OS specific contexts def general_info_specs - it { should contain_apache__mod("info") } + it { is_expected.to contain_apache__mod("info") } it do - should contain_file("info.conf").with_content( + is_expected.to contain_file("info.conf").with_content( "\n"\ " SetHandler server-info\n"\ " Order deny,allow\n"\ @@ -38,11 +38,11 @@ def general_info_specs # Load the more generic tests for this context general_info_specs() - it { should contain_file("info.conf").with({ + it { is_expected.to contain_file("info.conf").with({ :ensure => 'file', :path => '/etc/apache2/mods-available/info.conf', } ) } - it { should contain_file("info.conf symlink").with({ + it { is_expected.to contain_file("info.conf symlink").with({ :ensure => 'link', :path => '/etc/apache2/mods-enabled/info.conf', } ) } @@ -64,7 +64,7 @@ def general_info_specs # Load the more generic tests for this context general_info_specs() - it { should contain_file("info.conf").with_path("/etc/httpd/conf.d/info.conf") } + it { is_expected.to contain_file("info.conf").with_path("/etc/httpd/conf.d/info.conf") } end context "On a FreeBSD OS with default params" do @@ -83,7 +83,7 @@ def general_info_specs # Load the more generic tests for this context general_info_specs() - it { should contain_file("info.conf").with({ + it { is_expected.to contain_file("info.conf").with({ :ensure => 'file', :path => '/usr/local/etc/apache22/Modules/info.conf', } ) } @@ -106,7 +106,7 @@ def general_info_specs { :allow_from => ['10.10.10.10','11.11.11.11'] } end it do - should contain_file("info.conf").with_content( + is_expected.to contain_file("info.conf").with_content( "\n"\ " SetHandler server-info\n"\ " Order deny,allow\n"\ diff --git a/spec/classes/mod/itk_spec.rb b/spec/classes/mod/itk_spec.rb index d9fe2e3d1..b5d50a18a 100644 --- a/spec/classes/mod/itk_spec.rb +++ b/spec/classes/mod/itk_spec.rb @@ -17,10 +17,10 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should_not contain_apache__mod('itk') } - it { should contain_file("/etc/apache2/mods-available/itk.conf").with_ensure('file') } - it { should contain_file("/etc/apache2/mods-enabled/itk.conf").with_ensure('link') } + it { is_expected.to contain_class("apache::params") } + it { is_expected.not_to contain_apache__mod('itk') } + it { is_expected.to contain_file("/etc/apache2/mods-available/itk.conf").with_ensure('file') } + it { is_expected.to contain_file("/etc/apache2/mods-enabled/itk.conf").with_ensure('link') } context "with Apache version < 2.4" do let :params do @@ -29,10 +29,10 @@ } end - it { should_not contain_file("/etc/apache2/mods-available/itk.load") } - it { should_not contain_file("/etc/apache2/mods-enabled/itk.load") } + it { is_expected.not_to contain_file("/etc/apache2/mods-available/itk.load") } + it { is_expected.not_to contain_file("/etc/apache2/mods-enabled/itk.load") } - it { should contain_package("apache2-mpm-itk") } + it { is_expected.to contain_package("apache2-mpm-itk") } end context "with Apache version >= 2.4" do @@ -42,12 +42,12 @@ } end - it { should contain_file("/etc/apache2/mods-available/itk.load").with({ + it { is_expected.to contain_file("/etc/apache2/mods-available/itk.load").with({ 'ensure' => 'file', 'content' => "LoadModule mpm_itk_module /usr/lib/apache2/modules/mod_mpm_itk.so\n" }) } - it { should contain_file("/etc/apache2/mods-enabled/itk.load").with_ensure('link') } + it { is_expected.to contain_file("/etc/apache2/mods-enabled/itk.load").with_ensure('link') } end end context "on a FreeBSD OS" do @@ -62,8 +62,8 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should_not contain_apache__mod('itk') } - it { should contain_file("/usr/local/etc/apache22/Modules/itk.conf").with_ensure('file') } + it { is_expected.to contain_class("apache::params") } + it { is_expected.not_to contain_apache__mod('itk') } + it { is_expected.to contain_file("/usr/local/etc/apache22/Modules/itk.conf").with_ensure('file') } end end diff --git a/spec/classes/mod/mime_magic_spec.rb b/spec/classes/mod/mime_magic_spec.rb index e9984ecba..5e78230e2 100644 --- a/spec/classes/mod/mime_magic_spec.rb +++ b/spec/classes/mod/mime_magic_spec.rb @@ -2,7 +2,7 @@ # This function is called inside the OS specific contexts def general_mime_magic_specs - it { should contain_apache__mod("mime_magic") } + it { is_expected.to contain_apache__mod("mime_magic") } end describe 'apache::mod::mime_magic', :type => :class do @@ -27,16 +27,16 @@ def general_mime_magic_specs general_mime_magic_specs() it do - should contain_file("mime_magic.conf").with_content( + is_expected.to contain_file("mime_magic.conf").with_content( "MIMEMagicFile \"/etc/apache2/magic\"\n" ) end - it { should contain_file("mime_magic.conf").with({ + it { is_expected.to contain_file("mime_magic.conf").with({ :ensure => 'file', :path => '/etc/apache2/mods-available/mime_magic.conf', } ) } - it { should contain_file("mime_magic.conf symlink").with({ + it { is_expected.to contain_file("mime_magic.conf symlink").with({ :ensure => 'link', :path => '/etc/apache2/mods-enabled/mime_magic.conf', } ) } @@ -47,7 +47,7 @@ def general_mime_magic_specs end it do - should contain_file("mime_magic.conf").with_content( + is_expected.to contain_file("mime_magic.conf").with_content( "MIMEMagicFile \"/tmp/Debian_magic\"\n" ) end @@ -71,12 +71,12 @@ def general_mime_magic_specs general_mime_magic_specs() it do - should contain_file("mime_magic.conf").with_content( + is_expected.to contain_file("mime_magic.conf").with_content( "MIMEMagicFile \"/etc/httpd/conf/magic\"\n" ) end - it { should contain_file("mime_magic.conf").with_path("/etc/httpd/conf.d/mime_magic.conf") } + it { is_expected.to contain_file("mime_magic.conf").with_path("/etc/httpd/conf.d/mime_magic.conf") } end @@ -99,7 +99,7 @@ def general_mime_magic_specs end it do - should contain_file("mime_magic.conf").with_content( + is_expected.to contain_file("mime_magic.conf").with_content( "MIMEMagicFile \"/tmp/magic\"\n" ) end diff --git a/spec/classes/mod/mime_spec.rb b/spec/classes/mod/mime_spec.rb index 2b6154fb8..32edbc4b0 100644 --- a/spec/classes/mod/mime_spec.rb +++ b/spec/classes/mod/mime_spec.rb @@ -2,7 +2,7 @@ # This function is called inside the OS specific conte, :compilexts def general_mime_specs - it { should contain_apache__mod("mime") } + it { is_expected.to contain_apache__mod("mime") } end describe 'apache::mod::mime', :type => :class do @@ -26,7 +26,7 @@ def general_mime_specs general_mime_specs() - it { should contain_file("mime.conf").with_path('/etc/apache2/mods-available/mime.conf') } + it { is_expected.to contain_file("mime.conf").with_path('/etc/apache2/mods-available/mime.conf') } end @@ -45,7 +45,7 @@ def general_mime_specs general_mime_specs() - it { should contain_file("mime.conf").with_path("/etc/httpd/conf.d/mime.conf") } + it { is_expected.to contain_file("mime.conf").with_path("/etc/httpd/conf.d/mime.conf") } end diff --git a/spec/classes/mod/pagespeed_spec.rb b/spec/classes/mod/pagespeed_spec.rb index 9439f719e..c4abd3e10 100644 --- a/spec/classes/mod/pagespeed_spec.rb +++ b/spec/classes/mod/pagespeed_spec.rb @@ -17,10 +17,10 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should contain_apache__mod('pagespeed') } - it { should contain_package("mod-pagespeed-stable") } - it { should contain_file('pagespeed.conf') } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('pagespeed') } + it { is_expected.to contain_package("mod-pagespeed-stable") } + it { is_expected.to contain_file('pagespeed.conf') } end context "on a RedHat OS" do @@ -35,9 +35,9 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should contain_apache__mod('pagespeed') } - it { should contain_package("mod-pagespeed-stable") } - it { should contain_file('pagespeed.conf') } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('pagespeed') } + it { is_expected.to contain_package("mod-pagespeed-stable") } + it { is_expected.to contain_file('pagespeed.conf') } end end diff --git a/spec/classes/mod/passenger_spec.rb b/spec/classes/mod/passenger_spec.rb index 3bf7d2995..7fc1e3a63 100644 --- a/spec/classes/mod/passenger_spec.rb +++ b/spec/classes/mod/passenger_spec.rb @@ -17,105 +17,105 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should contain_apache__mod('passenger') } - it { should contain_package("libapache2-mod-passenger") } - it { should contain_file('passenger.load').with({ + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('passenger') } + it { is_expected.to contain_package("libapache2-mod-passenger") } + it { is_expected.to contain_file('passenger.load').with({ 'path' => '/etc/apache2/mods-available/passenger.load', }) } - it { should contain_file('passenger.conf').with({ + it { is_expected.to contain_file('passenger.conf').with({ 'path' => '/etc/apache2/mods-available/passenger.conf', }) } - it { should contain_file('passenger_package.conf').with_ensure('absent') } + it { is_expected.to contain_file('passenger_package.conf').with_ensure('absent') } describe "with passenger_root => '/usr/lib/example'" do let :params do { :passenger_root => '/usr/lib/example' } end - it { should contain_file('passenger.conf').with_content(%r{PassengerRoot "/usr/lib/example"}) } + it { is_expected.to contain_file('passenger.conf').with_content(%r{PassengerRoot "/usr/lib/example"}) } end describe "with passenger_ruby => /usr/lib/example/ruby" do let :params do { :passenger_ruby => '/usr/lib/example/ruby' } end - it { should contain_file('passenger.conf').with_content(%r{PassengerRuby "/usr/lib/example/ruby"}) } + it { is_expected.to contain_file('passenger.conf').with_content(%r{PassengerRuby "/usr/lib/example/ruby"}) } end describe "with passenger_default_ruby => /usr/lib/example/ruby1.9.3" do let :params do { :passenger_ruby => '/usr/lib/example/ruby1.9.3' } end - it { should contain_file('passenger.conf').with_content(%r{PassengerRuby "/usr/lib/example/ruby1.9.3"}) } + it { is_expected.to contain_file('passenger.conf').with_content(%r{PassengerRuby "/usr/lib/example/ruby1.9.3"}) } end describe "with passenger_high_performance => on" do let :params do { :passenger_high_performance => 'on' } end - it { should contain_file('passenger.conf').with_content(/^ PassengerHighPerformance on$/) } + it { is_expected.to contain_file('passenger.conf').with_content(/^ PassengerHighPerformance on$/) } end describe "with passenger_pool_idle_time => 1200" do let :params do { :passenger_pool_idle_time => 1200 } end - it { should contain_file('passenger.conf').with_content(/^ PassengerPoolIdleTime 1200$/) } + it { is_expected.to contain_file('passenger.conf').with_content(/^ PassengerPoolIdleTime 1200$/) } end describe "with passenger_max_requests => 20" do let :params do { :passenger_max_requests => 20 } end - it { should contain_file('passenger.conf').with_content(/^ PassengerMaxRequests 20$/) } + it { is_expected.to contain_file('passenger.conf').with_content(/^ PassengerMaxRequests 20$/) } end describe "with passenger_stat_throttle_rate => 10" do let :params do { :passenger_stat_throttle_rate => 10 } end - it { should contain_file('passenger.conf').with_content(/^ PassengerStatThrottleRate 10$/) } + it { is_expected.to contain_file('passenger.conf').with_content(/^ PassengerStatThrottleRate 10$/) } end describe "with passenger_max_pool_size => 16" do let :params do { :passenger_max_pool_size => 16 } end - it { should contain_file('passenger.conf').with_content(/^ PassengerMaxPoolSize 16$/) } + it { is_expected.to contain_file('passenger.conf').with_content(/^ PassengerMaxPoolSize 16$/) } end describe "with rack_autodetect => on" do let :params do { :rack_autodetect => 'on' } end - it { should contain_file('passenger.conf').with_content(/^ RackAutoDetect on$/) } + it { is_expected.to contain_file('passenger.conf').with_content(/^ RackAutoDetect on$/) } end describe "with rails_autodetect => on" do let :params do { :rails_autodetect => 'on' } end - it { should contain_file('passenger.conf').with_content(/^ RailsAutoDetect on$/) } + it { is_expected.to contain_file('passenger.conf').with_content(/^ RailsAutoDetect on$/) } end describe "with passenger_use_global_queue => on" do let :params do { :passenger_use_global_queue => 'on' } end - it { should contain_file('passenger.conf').with_content(/^ PassengerUseGlobalQueue on$/) } + it { is_expected.to contain_file('passenger.conf').with_content(/^ PassengerUseGlobalQueue on$/) } end describe "with mod_path => '/usr/lib/foo/mod_foo.so'" do let :params do { :mod_path => '/usr/lib/foo/mod_foo.so' } end - it { should contain_file('passenger.load').with_content(/^LoadModule passenger_module \/usr\/lib\/foo\/mod_foo\.so$/) } + it { is_expected.to contain_file('passenger.load').with_content(/^LoadModule passenger_module \/usr\/lib\/foo\/mod_foo\.so$/) } end describe "with mod_lib_path => '/usr/lib/foo'" do let :params do { :mod_lib_path => '/usr/lib/foo' } end - it { should contain_file('passenger.load').with_content(/^LoadModule passenger_module \/usr\/lib\/foo\/mod_passenger\.so$/) } + it { is_expected.to contain_file('passenger.load').with_content(/^LoadModule passenger_module \/usr\/lib\/foo\/mod_passenger\.so$/) } end describe "with mod_lib => 'mod_foo.so'" do let :params do { :mod_lib => 'mod_foo.so' } end - it { should contain_file('passenger.load').with_content(/^LoadModule passenger_module \/usr\/lib\/apache2\/modules\/mod_foo\.so$/) } + it { is_expected.to contain_file('passenger.load').with_content(/^LoadModule passenger_module \/usr\/lib\/apache2\/modules\/mod_foo\.so$/) } end describe "with mod_id => 'mod_foo'" do let :params do { :mod_id => 'mod_foo' } end - it { should contain_file('passenger.load').with_content(/^LoadModule mod_foo \/usr\/lib\/apache2\/modules\/mod_passenger\.so$/) } + it { is_expected.to contain_file('passenger.load').with_content(/^LoadModule mod_foo \/usr\/lib\/apache2\/modules\/mod_passenger\.so$/) } end context "with Ubuntu 12.04 defaults" do @@ -131,9 +131,9 @@ } end - it { should contain_file('passenger.conf').with_content(%r{PassengerRoot "/usr"}) } - it { should contain_file('passenger.conf').with_content(%r{PassengerRuby "/usr/bin/ruby"}) } - it { should contain_file('passenger.conf').without_content(/PassengerDefaultRuby/) } + it { is_expected.to contain_file('passenger.conf').with_content(%r{PassengerRoot "/usr"}) } + it { is_expected.to contain_file('passenger.conf').with_content(%r{PassengerRuby "/usr/bin/ruby"}) } + it { is_expected.to contain_file('passenger.conf').without_content(/PassengerDefaultRuby/) } end context "with Ubuntu 14.04 defaults" do @@ -149,9 +149,9 @@ } end - it { should contain_file('passenger.conf').with_content(%r{PassengerRoot "/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini"}) } - it { should contain_file('passenger.conf').without_content(/PassengerRuby/) } - it { should contain_file('passenger.conf').with_content(%r{PassengerDefaultRuby "/usr/bin/ruby"}) } + it { is_expected.to contain_file('passenger.conf').with_content(%r{PassengerRoot "/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini"}) } + it { is_expected.to contain_file('passenger.conf').without_content(/PassengerRuby/) } + it { is_expected.to contain_file('passenger.conf').with_content(%r{PassengerDefaultRuby "/usr/bin/ruby"}) } end context "with Debian 7 defaults" do @@ -167,9 +167,9 @@ } end - it { should contain_file('passenger.conf').with_content(%r{PassengerRoot "/usr"}) } - it { should contain_file('passenger.conf').with_content(%r{PassengerRuby "/usr/bin/ruby"}) } - it { should contain_file('passenger.conf').without_content(/PassengerDefaultRuby/) } + it { is_expected.to contain_file('passenger.conf').with_content(%r{PassengerRoot "/usr"}) } + it { is_expected.to contain_file('passenger.conf').with_content(%r{PassengerRuby "/usr/bin/ruby"}) } + it { is_expected.to contain_file('passenger.conf').without_content(/PassengerDefaultRuby/) } end end @@ -185,30 +185,30 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should contain_apache__mod('passenger') } - it { should contain_package("mod_passenger") } - it { should contain_file('passenger_package.conf').with({ + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('passenger') } + it { is_expected.to contain_package("mod_passenger") } + it { is_expected.to contain_file('passenger_package.conf').with({ 'path' => '/etc/httpd/conf.d/passenger.conf', }) } - it { should contain_file('passenger_package.conf').without_content } - it { should contain_file('passenger_package.conf').without_source } - it { should contain_file('passenger.load').with({ + it { is_expected.to contain_file('passenger_package.conf').without_content } + it { is_expected.to contain_file('passenger_package.conf').without_source } + it { is_expected.to contain_file('passenger.load').with({ 'path' => '/etc/httpd/conf.d/passenger.load', }) } - it { should contain_file('passenger.conf').without_content(/PassengerRoot/) } - it { should contain_file('passenger.conf').without_content(/PassengerRuby/) } + it { is_expected.to contain_file('passenger.conf').without_content(/PassengerRoot/) } + it { is_expected.to contain_file('passenger.conf').without_content(/PassengerRuby/) } describe "with passenger_root => '/usr/lib/example'" do let :params do { :passenger_root => '/usr/lib/example' } end - it { should contain_file('passenger.conf').with_content(/^ PassengerRoot "\/usr\/lib\/example"$/) } + it { is_expected.to contain_file('passenger.conf').with_content(/^ PassengerRoot "\/usr\/lib\/example"$/) } end describe "with passenger_ruby => /usr/lib/example/ruby" do let :params do { :passenger_ruby => '/usr/lib/example/ruby' } end - it { should contain_file('passenger.conf').with_content(/^ PassengerRuby "\/usr\/lib\/example\/ruby"$/) } + it { is_expected.to contain_file('passenger.conf').with_content(/^ PassengerRuby "\/usr\/lib\/example\/ruby"$/) } end end context "on a FreeBSD OS" do @@ -223,8 +223,8 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should contain_apache__mod('passenger') } - it { should contain_package("www/rubygem-passenger") } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('passenger') } + it { is_expected.to contain_package("www/rubygem-passenger") } end end diff --git a/spec/classes/mod/perl_spec.rb b/spec/classes/mod/perl_spec.rb index f674318e2..2c14c31f0 100644 --- a/spec/classes/mod/perl_spec.rb +++ b/spec/classes/mod/perl_spec.rb @@ -17,9 +17,9 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should contain_apache__mod('perl') } - it { should contain_package("libapache2-mod-perl2") } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('perl') } + it { is_expected.to contain_package("libapache2-mod-perl2") } end context "on a RedHat OS" do let :facts do @@ -33,9 +33,9 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should contain_apache__mod('perl') } - it { should contain_package("mod_perl") } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('perl') } + it { is_expected.to contain_package("mod_perl") } end context "on a FreeBSD OS" do let :facts do @@ -49,8 +49,8 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should contain_apache__mod('perl') } - it { should contain_package("www/mod_perl2") } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('perl') } + it { is_expected.to contain_package("www/mod_perl2") } end end diff --git a/spec/classes/mod/peruser_spec.rb b/spec/classes/mod/peruser_spec.rb index e1ee004e9..c0dfc96f5 100644 --- a/spec/classes/mod/peruser_spec.rb +++ b/spec/classes/mod/peruser_spec.rb @@ -16,8 +16,8 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should_not contain_apache__mod('peruser') } - it { should contain_file("/usr/local/etc/apache22/Modules/peruser.conf").with_ensure('file') } + it { is_expected.to contain_class("apache::params") } + it { is_expected.not_to contain_apache__mod('peruser') } + it { is_expected.to contain_file("/usr/local/etc/apache22/Modules/peruser.conf").with_ensure('file') } end end diff --git a/spec/classes/mod/php_spec.rb b/spec/classes/mod/php_spec.rb index cba128a82..c1fd14b01 100644 --- a/spec/classes/mod/php_spec.rb +++ b/spec/classes/mod/php_spec.rb @@ -18,10 +18,10 @@ let :pre_condition do 'class { "apache": mpm_module => prefork, }' end - it { should contain_class("apache::params") } - it { should contain_apache__mod('php5') } - it { should contain_package("libapache2-mod-php5") } - it { should contain_file("php5.load").with( + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('php5') } + it { is_expected.to contain_package("libapache2-mod-php5") } + it { is_expected.to contain_file("php5.load").with( :content => "LoadModule php5_module /usr/lib/apache2/modules/libphp5.so\n" ) } end @@ -50,10 +50,10 @@ let :pre_condition do 'class { "apache": }' end - it { should contain_class("apache::params") } - it { should contain_apache__mod('php5') } - it { should contain_package("php") } - it { should contain_file("php5.load").with( + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('php5') } + it { is_expected.to contain_package("php") } + it { is_expected.to contain_file("php5.load").with( :content => "LoadModule php5_module modules/libphp5.so\n" ) } end @@ -63,7 +63,7 @@ let :params do { :package_name => 'php54'} end - it { should contain_package("php54") } + it { is_expected.to contain_package("php54") } end context "with alternative path" do let :pre_condition do 'class { "apache": }' @@ -71,7 +71,7 @@ let :params do { :path => 'alternative-path'} end - it { should contain_file("php5.load").with( + it { is_expected.to contain_file("php5.load").with( :content => "LoadModule php5_module alternative-path\n" ) } end @@ -81,7 +81,7 @@ let :params do { :extensions => ['.php','.php5']} end - it { should contain_file("php5.conf").with_content(/AddHandler php5-script .php .php5\n/) } + it { is_expected.to contain_file("php5.conf").with_content(/AddHandler php5-script .php .php5\n/) } end context "with specific version" do let :pre_condition do @@ -90,7 +90,7 @@ let :params do { :package_ensure => '5.3.13'} end - it { should contain_package("php").with( + it { is_expected.to contain_package("php").with( :ensure => '5.3.13' ) } end @@ -98,10 +98,10 @@ let :pre_condition do 'class { "apache": mpm_module => prefork, }' end - it { should contain_class("apache::params") } - it { should contain_apache__mod('php5') } - it { should contain_package("php") } - it { should contain_file("php5.load").with( + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('php5') } + it { is_expected.to contain_package("php") } + it { is_expected.to contain_file("php5.load").with( :content => "LoadModule php5_module modules/libphp5.so\n" ) } end @@ -122,10 +122,10 @@ let :pre_condition do 'class { "apache": mpm_module => prefork, }' end - it { should contain_class('apache::params') } - it { should contain_apache__mod('php5') } - it { should contain_package("lang/php5") } - it { should contain_file('php5.load') } + it { is_expected.to contain_class('apache::params') } + it { is_expected.to contain_apache__mod('php5') } + it { is_expected.to contain_package("lang/php5") } + it { is_expected.to contain_file('php5.load') } end # FIXME: not sure about the following context context 'with mpm_module => worker' do @@ -133,7 +133,7 @@ 'class { "apache": mpm_module => worker, }' end it 'should raise an error' do - expect { subject.should contain_apache__mod('php5') }.to raise_error Puppet::Error, /mpm_module => 'prefork'/ + expect { expect(subject).to contain_apache__mod('php5') }.to raise_error Puppet::Error, /mpm_module => 'prefork'/ end end end diff --git a/spec/classes/mod/prefork_spec.rb b/spec/classes/mod/prefork_spec.rb index 847aecf9c..34bca08dc 100644 --- a/spec/classes/mod/prefork_spec.rb +++ b/spec/classes/mod/prefork_spec.rb @@ -17,10 +17,10 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should_not contain_apache__mod('prefork') } - it { should contain_file("/etc/apache2/mods-available/prefork.conf").with_ensure('file') } - it { should contain_file("/etc/apache2/mods-enabled/prefork.conf").with_ensure('link') } + it { is_expected.to contain_class("apache::params") } + it { is_expected.not_to contain_apache__mod('prefork') } + it { is_expected.to contain_file("/etc/apache2/mods-available/prefork.conf").with_ensure('file') } + it { is_expected.to contain_file("/etc/apache2/mods-enabled/prefork.conf").with_ensure('link') } context "with Apache version < 2.4" do let :params do @@ -29,10 +29,10 @@ } end - it { should_not contain_file("/etc/apache2/mods-available/prefork.load") } - it { should_not contain_file("/etc/apache2/mods-enabled/prefork.load") } + it { is_expected.not_to contain_file("/etc/apache2/mods-available/prefork.load") } + it { is_expected.not_to contain_file("/etc/apache2/mods-enabled/prefork.load") } - it { should contain_package("apache2-mpm-prefork") } + it { is_expected.to contain_package("apache2-mpm-prefork") } end context "with Apache version >= 2.4" do @@ -42,12 +42,12 @@ } end - it { should contain_file("/etc/apache2/mods-available/prefork.load").with({ + it { is_expected.to contain_file("/etc/apache2/mods-available/prefork.load").with({ 'ensure' => 'file', 'content' => "LoadModule mpm_prefork_module /usr/lib/apache2/modules/mod_mpm_prefork.so\n" }) } - it { should contain_file("/etc/apache2/mods-enabled/prefork.load").with_ensure('link') } + it { is_expected.to contain_file("/etc/apache2/mods-enabled/prefork.load").with_ensure('link') } end end context "on a RedHat OS" do @@ -62,9 +62,9 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should_not contain_apache__mod('prefork') } - it { should contain_file("/etc/httpd/conf.d/prefork.conf").with_ensure('file') } + it { is_expected.to contain_class("apache::params") } + it { is_expected.not_to contain_apache__mod('prefork') } + it { is_expected.to contain_file("/etc/httpd/conf.d/prefork.conf").with_ensure('file') } context "with Apache version < 2.4" do let :params do @@ -73,7 +73,7 @@ } end - it { should contain_file_line("/etc/sysconfig/httpd prefork enable").with({ + it { is_expected.to contain_file_line("/etc/sysconfig/httpd prefork enable").with({ 'require' => 'Package[httpd]', }) } @@ -86,9 +86,9 @@ } end - it { should_not contain_apache__mod('event') } + it { is_expected.not_to contain_apache__mod('event') } - it { should contain_file("/etc/httpd/conf.d/prefork.load").with({ + it { is_expected.to contain_file("/etc/httpd/conf.d/prefork.load").with({ 'ensure' => 'file', 'content' => "LoadModule mpm_prefork_module modules/mod_mpm_prefork.so\n", }) @@ -107,8 +107,8 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should_not contain_apache__mod('prefork') } - it { should contain_file("/usr/local/etc/apache22/Modules/prefork.conf").with_ensure('file') } + it { is_expected.to contain_class("apache::params") } + it { is_expected.not_to contain_apache__mod('prefork') } + it { is_expected.to contain_file("/usr/local/etc/apache22/Modules/prefork.conf").with_ensure('file') } end end diff --git a/spec/classes/mod/proxy_html_spec.rb b/spec/classes/mod/proxy_html_spec.rb index 77e1ab15d..81a2bb537 100644 --- a/spec/classes/mod/proxy_html_spec.rb +++ b/spec/classes/mod/proxy_html_spec.rb @@ -10,9 +10,9 @@ end context "on a Debian OS" do shared_examples "debian" do |loadfiles| - it { should contain_class("apache::params") } - it { should contain_apache__mod('proxy_html').with(:loadfiles => loadfiles) } - it { should contain_package("libapache2-mod-proxy-html") } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('proxy_html').with(:loadfiles => loadfiles) } + it { is_expected.to contain_package("libapache2-mod-proxy-html") } end let :facts do { @@ -62,9 +62,9 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should contain_apache__mod('proxy_html').with(:loadfiles => nil) } - it { should contain_package("mod_proxy_html") } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('proxy_html').with(:loadfiles => nil) } + it { is_expected.to contain_package("mod_proxy_html") } end context "on a FreeBSD OS", :compile do let :facts do @@ -78,8 +78,8 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should contain_apache__mod('proxy_html').with(:loadfiles => nil) } - it { should contain_package("www/mod_proxy_html") } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('proxy_html').with(:loadfiles => nil) } + it { is_expected.to contain_package("www/mod_proxy_html") } end end diff --git a/spec/classes/mod/python_spec.rb b/spec/classes/mod/python_spec.rb index d2d1fca7b..17b62d43b 100644 --- a/spec/classes/mod/python_spec.rb +++ b/spec/classes/mod/python_spec.rb @@ -17,9 +17,9 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should contain_apache__mod("python") } - it { should contain_package("libapache2-mod-python") } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod("python") } + it { is_expected.to contain_package("libapache2-mod-python") } end context "on a RedHat OS" do let :facts do @@ -33,9 +33,9 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should contain_apache__mod("python") } - it { should contain_package("mod_python") } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod("python") } + it { is_expected.to contain_package("mod_python") } end context "on a FreeBSD OS" do let :facts do @@ -49,8 +49,8 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should contain_apache__mod("python") } - it { should contain_package("www/mod_python3") } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod("python") } + it { is_expected.to contain_package("www/mod_python3") } end end diff --git a/spec/classes/mod/rpaf_spec.rb b/spec/classes/mod/rpaf_spec.rb index 949dd5702..ca3a59484 100644 --- a/spec/classes/mod/rpaf_spec.rb +++ b/spec/classes/mod/rpaf_spec.rb @@ -19,31 +19,31 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should contain_apache__mod('rpaf') } - it { should contain_package("libapache2-mod-rpaf") } - it { should contain_file('rpaf.conf').with({ + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('rpaf') } + it { is_expected.to contain_package("libapache2-mod-rpaf") } + it { is_expected.to contain_file('rpaf.conf').with({ 'path' => '/etc/apache2/mods-available/rpaf.conf', }) } - it { should contain_file('rpaf.conf').with_content(/^RPAFenable On$/) } + it { is_expected.to contain_file('rpaf.conf').with_content(/^RPAFenable On$/) } describe "with sethostname => true" do let :params do { :sethostname => 'true' } end - it { should contain_file('rpaf.conf').with_content(/^RPAFsethostname On$/) } + it { is_expected.to contain_file('rpaf.conf').with_content(/^RPAFsethostname On$/) } end describe "with proxy_ips => [ 10.42.17.8, 10.42.18.99 ]" do let :params do { :proxy_ips => [ '10.42.17.8', '10.42.18.99' ] } end - it { should contain_file('rpaf.conf').with_content(/^RPAFproxy_ips 10.42.17.8 10.42.18.99$/) } + it { is_expected.to contain_file('rpaf.conf').with_content(/^RPAFproxy_ips 10.42.17.8 10.42.18.99$/) } end describe "with header => X-Real-IP" do let :params do { :header => 'X-Real-IP' } end - it { should contain_file('rpaf.conf').with_content(/^RPAFheader X-Real-IP$/) } + it { is_expected.to contain_file('rpaf.conf').with_content(/^RPAFheader X-Real-IP$/) } end end context "on a FreeBSD OS" do @@ -58,31 +58,31 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should contain_apache__mod('rpaf') } - it { should contain_package("www/mod_rpaf2") } - it { should contain_file('rpaf.conf').with({ + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('rpaf') } + it { is_expected.to contain_package("www/mod_rpaf2") } + it { is_expected.to contain_file('rpaf.conf').with({ 'path' => '/usr/local/etc/apache22/Modules/rpaf.conf', }) } - it { should contain_file('rpaf.conf').with_content(/^RPAFenable On$/) } + it { is_expected.to contain_file('rpaf.conf').with_content(/^RPAFenable On$/) } describe "with sethostname => true" do let :params do { :sethostname => 'true' } end - it { should contain_file('rpaf.conf').with_content(/^RPAFsethostname On$/) } + it { is_expected.to contain_file('rpaf.conf').with_content(/^RPAFsethostname On$/) } end describe "with proxy_ips => [ 10.42.17.8, 10.42.18.99 ]" do let :params do { :proxy_ips => [ '10.42.17.8', '10.42.18.99' ] } end - it { should contain_file('rpaf.conf').with_content(/^RPAFproxy_ips 10.42.17.8 10.42.18.99$/) } + it { is_expected.to contain_file('rpaf.conf').with_content(/^RPAFproxy_ips 10.42.17.8 10.42.18.99$/) } end describe "with header => X-Real-IP" do let :params do { :header => 'X-Real-IP' } end - it { should contain_file('rpaf.conf').with_content(/^RPAFheader X-Real-IP$/) } + it { is_expected.to contain_file('rpaf.conf').with_content(/^RPAFheader X-Real-IP$/) } end end end diff --git a/spec/classes/mod/speling_spec.rb b/spec/classes/mod/speling_spec.rb index e7e6e1d64..814e0d672 100644 --- a/spec/classes/mod/speling_spec.rb +++ b/spec/classes/mod/speling_spec.rb @@ -17,7 +17,7 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_apache__mod('speling') } + it { is_expected.to contain_apache__mod('speling') } end context "on a RedHat OS" do @@ -32,6 +32,6 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_apache__mod('speling') } + it { is_expected.to contain_apache__mod('speling') } end end diff --git a/spec/classes/mod/ssl_spec.rb b/spec/classes/mod/ssl_spec.rb index 11e7964de..fb6ba4eb5 100644 --- a/spec/classes/mod/ssl_spec.rb +++ b/spec/classes/mod/ssl_spec.rb @@ -31,9 +31,9 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class('apache::params') } - it { should contain_apache__mod('ssl') } - it { should contain_package('mod_ssl') } + it { is_expected.to contain_class('apache::params') } + it { is_expected.to contain_apache__mod('ssl') } + it { is_expected.to contain_package('mod_ssl') } end context 'on a Debian OS' do @@ -49,9 +49,9 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class('apache::params') } - it { should contain_apache__mod('ssl') } - it { should_not contain_package('libapache2-mod-ssl') } + it { is_expected.to contain_class('apache::params') } + it { is_expected.to contain_apache__mod('ssl') } + it { is_expected.not_to contain_package('libapache2-mod-ssl') } end context 'on a FreeBSD OS' do @@ -66,7 +66,7 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class('apache::params') } - it { should contain_apache__mod('ssl') } + it { is_expected.to contain_class('apache::params') } + it { is_expected.to contain_apache__mod('ssl') } end end diff --git a/spec/classes/mod/status_spec.rb b/spec/classes/mod/status_spec.rb index 5023bc7bf..adb60861b 100644 --- a/spec/classes/mod/status_spec.rb +++ b/spec/classes/mod/status_spec.rb @@ -3,7 +3,7 @@ # Helper function for testing the contents of `status.conf` def status_conf_spec(allow_from, extended_status) it do - should contain_file("status.conf").with_content( + is_expected.to contain_file("status.conf").with_content( "\n"\ " SetHandler server-status\n"\ " Order deny,allow\n"\ @@ -39,16 +39,16 @@ def status_conf_spec(allow_from, extended_status) } end - it { should contain_apache__mod("status") } + it { is_expected.to contain_apache__mod("status") } status_conf_spec(["127.0.0.1", "::1"], "On") - it { should contain_file("status.conf").with({ + it { is_expected.to contain_file("status.conf").with({ :ensure => 'file', :path => '/etc/apache2/mods-available/status.conf', } ) } - it { should contain_file("status.conf symlink").with({ + it { is_expected.to contain_file("status.conf symlink").with({ :ensure => 'link', :path => '/etc/apache2/mods-enabled/status.conf', } ) } @@ -68,11 +68,11 @@ def status_conf_spec(allow_from, extended_status) } end - it { should contain_apache__mod("status") } + it { is_expected.to contain_apache__mod("status") } status_conf_spec(["127.0.0.1", "::1"], "On") - it { should contain_file("status.conf").with_path("/etc/httpd/conf.d/status.conf") } + it { is_expected.to contain_file("status.conf").with_path("/etc/httpd/conf.d/status.conf") } end @@ -118,7 +118,7 @@ def status_conf_spec(allow_from, extended_status) end it 'should expect to succeed array validation' do expect { - should contain_file("status.conf") + is_expected.to contain_file("status.conf") }.not_to raise_error() end end @@ -140,7 +140,7 @@ def status_conf_spec(allow_from, extended_status) end it 'should expect to fail array validation' do expect { - should contain_file("status.conf") + is_expected.to contain_file("status.conf") }.to raise_error(Puppet::Error) end end @@ -165,7 +165,7 @@ def status_conf_spec(allow_from, extended_status) end it 'should expect to succeed regular expression validation' do expect { - should contain_file("status.conf") + is_expected.to contain_file("status.conf") }.not_to raise_error() end end @@ -189,7 +189,7 @@ def status_conf_spec(allow_from, extended_status) end it 'should expect to fail regular expression validation' do expect { - should contain_file("status.conf") + is_expected.to contain_file("status.conf") }.to raise_error(Puppet::Error) end end diff --git a/spec/classes/mod/suphp_spec.rb b/spec/classes/mod/suphp_spec.rb index cb91997ac..b74b4c864 100644 --- a/spec/classes/mod/suphp_spec.rb +++ b/spec/classes/mod/suphp_spec.rb @@ -17,8 +17,8 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should contain_package("libapache2-mod-suphp") } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_package("libapache2-mod-suphp") } end context "on a RedHat OS" do let :facts do @@ -32,7 +32,7 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should contain_package("mod_suphp") } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_package("mod_suphp") } end end diff --git a/spec/classes/mod/worker_spec.rb b/spec/classes/mod/worker_spec.rb index 3c9c1cf24..c0a790b18 100644 --- a/spec/classes/mod/worker_spec.rb +++ b/spec/classes/mod/worker_spec.rb @@ -17,10 +17,10 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should_not contain_apache__mod('worker') } - it { should contain_file("/etc/apache2/mods-available/worker.conf").with_ensure('file') } - it { should contain_file("/etc/apache2/mods-enabled/worker.conf").with_ensure('link') } + it { is_expected.to contain_class("apache::params") } + it { is_expected.not_to contain_apache__mod('worker') } + it { is_expected.to contain_file("/etc/apache2/mods-available/worker.conf").with_ensure('file') } + it { is_expected.to contain_file("/etc/apache2/mods-enabled/worker.conf").with_ensure('link') } context "with Apache version < 2.4" do let :params do @@ -29,10 +29,10 @@ } end - it { should_not contain_file("/etc/apache2/mods-available/worker.load") } - it { should_not contain_file("/etc/apache2/mods-enabled/worker.load") } + it { is_expected.not_to contain_file("/etc/apache2/mods-available/worker.load") } + it { is_expected.not_to contain_file("/etc/apache2/mods-enabled/worker.load") } - it { should contain_package("apache2-mpm-worker") } + it { is_expected.to contain_package("apache2-mpm-worker") } end context "with Apache version >= 2.4" do @@ -42,12 +42,12 @@ } end - it { should contain_file("/etc/apache2/mods-available/worker.load").with({ + it { is_expected.to contain_file("/etc/apache2/mods-available/worker.load").with({ 'ensure' => 'file', 'content' => "LoadModule mpm_worker_module /usr/lib/apache2/modules/mod_mpm_worker.so\n" }) } - it { should contain_file("/etc/apache2/mods-enabled/worker.load").with_ensure('link') } + it { is_expected.to contain_file("/etc/apache2/mods-enabled/worker.load").with_ensure('link') } end end context "on a RedHat OS" do @@ -62,9 +62,9 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should_not contain_apache__mod('worker') } - it { should contain_file("/etc/httpd/conf.d/worker.conf").with_ensure('file') } + it { is_expected.to contain_class("apache::params") } + it { is_expected.not_to contain_apache__mod('worker') } + it { is_expected.to contain_file("/etc/httpd/conf.d/worker.conf").with_ensure('file') } context "with Apache version < 2.4" do let :params do @@ -73,7 +73,7 @@ } end - it { should contain_file_line("/etc/sysconfig/httpd worker enable").with({ + it { is_expected.to contain_file_line("/etc/sysconfig/httpd worker enable").with({ 'require' => 'Package[httpd]', }) } @@ -86,9 +86,9 @@ } end - it { should_not contain_apache__mod('event') } + it { is_expected.not_to contain_apache__mod('event') } - it { should contain_file("/etc/httpd/conf.d/worker.load").with({ + it { is_expected.to contain_file("/etc/httpd/conf.d/worker.load").with({ 'ensure' => 'file', 'content' => "LoadModule mpm_worker_module modules/mod_mpm_worker.so\n", }) @@ -107,8 +107,8 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should_not contain_apache__mod('worker') } - it { should contain_file("/usr/local/etc/apache22/Modules/worker.conf").with_ensure('file') } + it { is_expected.to contain_class("apache::params") } + it { is_expected.not_to contain_apache__mod('worker') } + it { is_expected.to contain_file("/usr/local/etc/apache22/Modules/worker.conf").with_ensure('file') } end end diff --git a/spec/classes/mod/wsgi_spec.rb b/spec/classes/mod/wsgi_spec.rb index d4c391a29..5945e3beb 100644 --- a/spec/classes/mod/wsgi_spec.rb +++ b/spec/classes/mod/wsgi_spec.rb @@ -17,9 +17,9 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should contain_apache__mod('wsgi') } - it { should contain_package("libapache2-mod-wsgi") } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('wsgi') } + it { is_expected.to contain_package("libapache2-mod-wsgi") } end context "on a RedHat OS" do let :facts do @@ -33,21 +33,21 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should contain_apache__mod('wsgi') } - it { should contain_package("mod_wsgi") } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('wsgi') } + it { is_expected.to contain_package("mod_wsgi") } describe "with custom WSGISocketPrefix" do let :params do { :wsgi_socket_prefix => 'run/wsgi' } end - it {should contain_file('wsgi.conf').with_content(/^ WSGISocketPrefix run\/wsgi$/)} + it {is_expected.to contain_file('wsgi.conf').with_content(/^ WSGISocketPrefix run\/wsgi$/)} end describe "with custom WSGIPythonHome" do let :params do { :wsgi_python_home => '/path/to/virtenv' } end - it {should contain_file('wsgi.conf').with_content(/^ WSGIPythonHome "\/path\/to\/virtenv"$/)} + it {is_expected.to contain_file('wsgi.conf').with_content(/^ WSGIPythonHome "\/path\/to\/virtenv"$/)} end end context "on a FreeBSD OS" do @@ -62,8 +62,8 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_class("apache::params") } - it { should contain_apache__mod('wsgi') } - it { should contain_package("www/mod_wsgi") } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('wsgi') } + it { is_expected.to contain_package("www/mod_wsgi") } end end diff --git a/spec/classes/params_spec.rb b/spec/classes/params_spec.rb index eaa178c41..6f63758a3 100644 --- a/spec/classes/params_spec.rb +++ b/spec/classes/params_spec.rb @@ -14,13 +14,13 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_apache__params } + it { is_expected.to contain_apache__params } # There are 4 resources in this class currently # there should not be any more resources because it is a params class # The resources are class[apache::version], class[apache::params], class[main], class[settings], stage[main] it "Should not contain any resources" do - subject.resources.size.should == 5 + expect(subject.resources.size).to eq(5) end end end diff --git a/spec/classes/service_spec.rb b/spec/classes/service_spec.rb index 2cd075357..4d6efbe3f 100644 --- a/spec/classes/service_spec.rb +++ b/spec/classes/service_spec.rb @@ -17,7 +17,7 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_service("httpd").with( + it { is_expected.to contain_service("httpd").with( 'name' => 'apache2', 'ensure' => 'running', 'enable' => 'true' @@ -26,7 +26,7 @@ context "with $service_name => 'foo'" do let (:params) {{ :service_name => 'foo' }} - it { should contain_service("httpd").with( + it { is_expected.to contain_service("httpd").with( 'name' => 'foo' ) } @@ -34,7 +34,7 @@ context "with $service_enable => true" do let (:params) {{ :service_enable => true }} - it { should contain_service("httpd").with( + it { is_expected.to contain_service("httpd").with( 'name' => 'apache2', 'ensure' => 'running', 'enable' => 'true' @@ -44,7 +44,7 @@ context "with $service_enable => false" do let (:params) {{ :service_enable => false }} - it { should contain_service("httpd").with( + it { is_expected.to contain_service("httpd").with( 'name' => 'apache2', 'ensure' => 'running', 'enable' => 'false' @@ -62,7 +62,7 @@ context "with $service_ensure => 'running'" do let (:params) {{ :service_ensure => 'running', }} - it { should contain_service("httpd").with( + it { is_expected.to contain_service("httpd").with( 'ensure' => 'running', 'enable' => 'true' ) @@ -71,7 +71,7 @@ context "with $service_ensure => 'stopped'" do let (:params) {{ :service_ensure => 'stopped', }} - it { should contain_service("httpd").with( + it { is_expected.to contain_service("httpd").with( 'ensure' => 'stopped', 'enable' => 'true' ) @@ -80,7 +80,7 @@ context "with $service_ensure => 'UNDEF'" do let (:params) {{ :service_ensure => 'UNDEF' }} - it { should contain_service("httpd").without_ensure } + it { is_expected.to contain_service("httpd").without_ensure } end end @@ -97,7 +97,7 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_service("httpd").with( + it { is_expected.to contain_service("httpd").with( 'name' => 'httpd', 'ensure' => 'running', 'enable' => 'true' @@ -117,7 +117,7 @@ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end - it { should contain_service("httpd").with( + it { is_expected.to contain_service("httpd").with( 'name' => 'apache22', 'ensure' => 'running', 'enable' => 'true' From 9f97fc7c8d5cee1e62dac560bf034ca3997e1f33 Mon Sep 17 00:00:00 2001 From: Ashley Penney Date: Fri, 6 Jun 2014 10:11:14 -0400 Subject: [PATCH 2/4] Convert specs to RSpec 3.0.0 syntax with Transpec This conversion is done by Transpec 2.2.1 with the following command: transpec spec/defines * 65 conversions from: it { should ... } to: it { is_expected.to ... } * 9 conversions from: it { should_not ... } to: it { is_expected.not_to ... } For more details: https://github.com/yujinakayama/transpec#supported-conversions --- spec/defines/mod_spec.rb | 18 ++--- spec/defines/vhost_spec.rb | 130 ++++++++++++++++++------------------- 2 files changed, 74 insertions(+), 74 deletions(-) diff --git a/spec/defines/mod_spec.rb b/spec/defines/mod_spec.rb index e6d521409..377c87792 100644 --- a/spec/defines/mod_spec.rb +++ b/spec/defines/mod_spec.rb @@ -21,9 +21,9 @@ let :title do 'spec_m' end - it { should contain_class("apache::params") } + it { is_expected.to contain_class("apache::params") } it "should manage the module load file" do - should contain_file('spec_m.load').with({ + is_expected.to contain_file('spec_m.load').with({ :path => '/etc/httpd/conf.d/spec_m.load', :content => "LoadModule spec_m_module modules/mod_spec_m.so\n", :owner => 'root', @@ -41,8 +41,8 @@ # parameters let(:params) { {:package => 'mod_xsendfile'} } - it { should contain_class("apache::params") } - it { should contain_package('mod_xsendfile') } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_package('mod_xsendfile') } end end @@ -64,9 +64,9 @@ let :title do 'spec_m' end - it { should contain_class("apache::params") } + it { is_expected.to contain_class("apache::params") } it "should manage the module load file" do - should contain_file('spec_m.load').with({ + is_expected.to contain_file('spec_m.load').with({ :path => '/etc/apache2/mods-available/spec_m.load', :content => "LoadModule spec_m_module /usr/lib/apache2/modules/mod_spec_m.so\n", :owner => 'root', @@ -75,7 +75,7 @@ } ) end it "should link the module load file" do - should contain_file('spec_m.load symlink').with({ + is_expected.to contain_file('spec_m.load symlink').with({ :path => '/etc/apache2/mods-enabled/spec_m.load', :target => '/etc/apache2/mods-available/spec_m.load', :owner => 'root', @@ -103,9 +103,9 @@ let :title do 'spec_m' end - it { should contain_class("apache::params") } + it { is_expected.to contain_class("apache::params") } it "should manage the module load file" do - should contain_file('spec_m.load').with({ + is_expected.to contain_file('spec_m.load').with({ :path => '/usr/local/etc/apache22/Modules/spec_m.load', :content => "LoadModule spec_m_module /usr/local/libexec/apache22/mod_spec_m.so\n", :owner => 'root', diff --git a/spec/defines/vhost_spec.rb b/spec/defines/vhost_spec.rb index 4037b3011..d8233a323 100644 --- a/spec/defines/vhost_spec.rb +++ b/spec/defines/vhost_spec.rb @@ -28,8 +28,8 @@ end let :params do default_params end let :facts do default_facts end - it { should contain_class("apache") } - it { should contain_class("apache::params") } + it { is_expected.to contain_class("apache") } + it { is_expected.to contain_class("apache::params") } end context "on Debian based systems" do let :default_facts do @@ -46,13 +46,13 @@ end let :params do default_params end let :facts do default_facts end - it { should contain_class("apache") } - it { should contain_class("apache::params") } - it { should contain_file("25-rspec.example.com.conf").with( + it { is_expected.to contain_class("apache") } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_file("25-rspec.example.com.conf").with( :ensure => 'present', :path => '/etc/apache2/sites-available/25-rspec.example.com.conf' ) } - it { should contain_file("25-rspec.example.com.conf symlink").with( + it { is_expected.to contain_file("25-rspec.example.com.conf symlink").with( :ensure => 'link', :path => '/etc/apache2/sites-enabled/25-rspec.example.com.conf', :target => '/etc/apache2/sites-available/25-rspec.example.com.conf' @@ -72,9 +72,9 @@ end let :params do default_params end let :facts do default_facts end - it { should contain_class("apache") } - it { should contain_class("apache::params") } - it { should contain_file("25-rspec.example.com.conf").with( + it { is_expected.to contain_class("apache") } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_file("25-rspec.example.com.conf").with( :ensure => 'present', :path => '/usr/local/etc/apache22/Vhosts/25-rspec.example.com.conf' ) } @@ -95,10 +95,10 @@ end describe 'basic assumptions' do let :params do default_params end - it { should contain_class("apache") } - it { should contain_class("apache::params") } - it { should contain_apache__listen(params[:port]) } - it { should contain_apache__namevirtualhost("*:#{params[:port]}") } + it { is_expected.to contain_class("apache") } + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__listen(params[:port]) } + it { is_expected.to contain_apache__namevirtualhost("*:#{params[:port]}") } end # All match and notmatch should be a list of regexs and exact match strings @@ -669,18 +669,18 @@ describe "when #{param[:attr]} is #{param[:value]}" do let :params do default_params.merge({ param[:attr].to_sym => param[:value] }) end - it { should contain_file("25-#{title}.conf").with_mode('0644') } + it { is_expected.to contain_file("25-#{title}.conf").with_mode('0644') } if param[:match] it "#{param[:title]}: matches" do param[:match].each do |match| - should contain_file("25-#{title}.conf").with_content( match ) + is_expected.to contain_file("25-#{title}.conf").with_content( match ) end end end if param[:notmatch] it "#{param[:title]}: notmatches" do param[:notmatch].each do |notmatch| - should_not contain_file("25-#{title}.conf").with_content( notmatch ) + is_expected.not_to contain_file("25-#{title}.conf").with_content( notmatch ) end end end @@ -821,18 +821,18 @@ :apache_version => '2.2', }) end - it { should contain_file("25-#{title}.conf").with_mode('0644') } + it { is_expected.to contain_file("25-#{title}.conf").with_mode('0644') } if param[:match] it "#{param[:title]}: matches" do param[:match].each do |match| - should contain_file("25-#{title}.conf").with_content( match ) + is_expected.to contain_file("25-#{title}.conf").with_content( match ) end end end if param[:notmatch] it "#{param[:title]}: notmatches" do param[:notmatch].each do |notmatch| - should_not contain_file("25-#{title}.conf").with_content( notmatch ) + is_expected.not_to contain_file("25-#{title}.conf").with_content( notmatch ) end end end @@ -958,18 +958,18 @@ :apache_version => '2.4', }) end - it { should contain_file("25-#{title}.conf").with_mode('0644') } + it { is_expected.to contain_file("25-#{title}.conf").with_mode('0644') } if param[:match] it "#{param[:title]}: matches" do param[:match].each do |match| - should contain_file("25-#{title}.conf").with_content( match ) + is_expected.to contain_file("25-#{title}.conf").with_content( match ) end end end if param[:notmatch] it "#{param[:title]}: notmatches" do param[:notmatch].each do |notmatch| - should_not contain_file("25-#{title}.conf").with_content( notmatch ) + is_expected.not_to contain_file("25-#{title}.conf").with_content( notmatch ) end end end @@ -1090,18 +1090,18 @@ :ssl => true, } ) end - it { should contain_file("25-#{title}.conf").with_mode('0644') } + it { is_expected.to contain_file("25-#{title}.conf").with_mode('0644') } if param[:match] it "#{param[:title]}: matches" do param[:match].each do |match| - should contain_file("25-#{title}.conf").with_content( match ) + is_expected.to contain_file("25-#{title}.conf").with_content( match ) end end end if param[:notmatch] it "#{param[:title]}: notmatches" do param[:notmatch].each do |notmatch| - should_not contain_file("25-#{title}.conf").with_content( notmatch ) + is_expected.not_to contain_file("25-#{title}.conf").with_content( notmatch ) end end end @@ -1135,7 +1135,7 @@ :docroot_mode => '0750', }) end it 'should set vhost ownership and permissions' do - should contain_file(params[:docroot]).with({ + is_expected.to contain_file(params[:docroot]).with({ :ensure => :directory, :owner => 'testuser', :group => 'testgroup', @@ -1150,7 +1150,7 @@ :wsgi_daemon_process_options => { 'processes' => '2', 'threads' => '15' }, }) end it 'should set wsgi_daemon_process_options' do - should contain_file("25-#{title}.conf").with_content( + is_expected.to contain_file("25-#{title}.conf").with_content( /^ WSGIDaemonProcess example.org processes=2 threads=15$/ ) end @@ -1162,7 +1162,7 @@ :wsgi_import_script_options => { 'application-group' => '%{GLOBAL}', 'process-group' => 'wsgi' }, }) end it 'should set wsgi_import_script_options' do - should contain_file("25-#{title}.conf").with_content( + is_expected.to contain_file("25-#{title}.conf").with_content( /^ WSGIImportScript \/var\/www\/demo.wsgi application-group=%{GLOBAL} process-group=wsgi$/ ) end @@ -1180,22 +1180,22 @@ ] }) end it 'should set RewriteConds and RewriteRules' do - should contain_file("25-#{title}.conf").with_content( + is_expected.to contain_file("25-#{title}.conf").with_content( /^ #test rewrites$/ ) - should contain_file("25-#{title}.conf").with_content( + is_expected.to contain_file("25-#{title}.conf").with_content( /^ RewriteCond %\{HTTP_USER_AGENT\} \^Lynx\/ \[OR\]$/ ) - should contain_file("25-#{title}.conf").with_content( + is_expected.to contain_file("25-#{title}.conf").with_content( /^ RewriteBase \/mytestpath\/$/ ) - should contain_file("25-#{title}.conf").with_content( + is_expected.to contain_file("25-#{title}.conf").with_content( /^ RewriteCond %\{HTTP_USER_AGENT\} \^Mozilla\/\[12\]$/ ) - should contain_file("25-#{title}.conf").with_content( + is_expected.to contain_file("25-#{title}.conf").with_content( /^ RewriteRule \^index\\.html\$ welcome.html$/ ) - should contain_file("25-#{title}.conf").with_content( + is_expected.to contain_file("25-#{title}.conf").with_content( /^ RewriteRule \^index\\.cgi\$ index.php$/ ) end @@ -1207,7 +1207,7 @@ :rewrite_rule => '(.*) https://%{HTTPS_HOST}%{REQUEST_URI}', }) end it 'should set RewriteCond' do - should contain_file("25-#{title}.conf").with_content( + is_expected.to contain_file("25-#{title}.conf").with_content( /^ RewriteCond %\{HTTPS\} off$/ ) end @@ -1218,7 +1218,7 @@ :action => 'php-fastcgi', }) end it 'should set Action' do - should contain_file("25-#{title}.conf").with_content( + is_expected.to contain_file("25-#{title}.conf").with_content( /^ Action php-fastcgi \/cgi-bin virtual$/ ) end @@ -1230,7 +1230,7 @@ :suphp_configpath => '/etc/php5/apache2', }) end it 'should set suphp_configpath' do - should contain_file("25-#{title}.conf").with_content( + is_expected.to contain_file("25-#{title}.conf").with_content( /^ suPHP_ConfigPath "\/etc\/php5\/apache2"$/ ) end @@ -1242,7 +1242,7 @@ :suphp_addhandler => 'x-httpd-php', }) end it 'should set suphp_addhandler' do - should contain_file("25-#{title}.conf").with_content( + is_expected.to contain_file("25-#{title}.conf").with_content( /^ suPHP_AddHandler x-httpd-php/ ) end @@ -1256,7 +1256,7 @@ } }) end it 'should set suphp_UserGroup' do - should contain_file("25-#{title}.conf").with_content( + is_expected.to contain_file("25-#{title}.conf").with_content( /^ suPHP_UserGroup myappuser myappgroup/ ) end @@ -1265,7 +1265,7 @@ describe 'priority/default settings' do describe 'when neither priority/default is specified' do let :params do default_params end - it { should contain_file("25-#{title}.conf").with_path( + it { is_expected.to contain_file("25-#{title}.conf").with_path( /25-#{title}.conf/ ) } end @@ -1276,7 +1276,7 @@ :default_vhost => true, }) end - it { should contain_file("15-#{title}.conf").with_path( + it { is_expected.to contain_file("15-#{title}.conf").with_path( /15-#{title}.conf/ ) } end @@ -1284,7 +1284,7 @@ let :params do default_params.merge({ :priority => 14, }) end - it { should contain_file("14-#{title}.conf").with_path( + it { is_expected.to contain_file("14-#{title}.conf").with_path( /14-#{title}.conf/ ) } end @@ -1292,7 +1292,7 @@ let :params do default_params.merge({ :default_vhost => true, }) end - it { should contain_file("10-#{title}.conf").with_path( + it { is_expected.to contain_file("10-#{title}.conf").with_path( /10-#{title}.conf/ ) } end @@ -1306,7 +1306,7 @@ }) end - it { should_not contain_file("25-#{title}.conf").with_content(%r{FcgidWrapper}) } + it { is_expected.not_to contain_file("25-#{title}.conf").with_content(%r{FcgidWrapper}) } end describe 'Only a command' do @@ -1318,7 +1318,7 @@ }) end - it { should contain_file("25-#{title}.conf").with_content(%r{^ FcgidWrapper /usr/local/bin/fcgiwrapper $}) } + it { is_expected.to contain_file("25-#{title}.conf").with_content(%r{^ FcgidWrapper /usr/local/bin/fcgiwrapper $}) } end describe 'All parameters' do @@ -1330,7 +1330,7 @@ }) end - it { should contain_file("25-#{title}.conf").with_content(%r{^ FcgidWrapper /usr/local/bin/fcgiwrapper .php virtual$}) } + it { is_expected.to contain_file("25-#{title}.conf").with_content(%r{^ FcgidWrapper /usr/local/bin/fcgiwrapper .php virtual$}) } end end @@ -1338,25 +1338,25 @@ describe 'when ip_based is true' do let :params do default_params.merge({ :ip_based => true }) end it 'should not specify a NameVirtualHost' do - should contain_apache__listen(params[:port]) - should_not contain_apache__namevirtualhost("*:#{params[:port]}") + is_expected.to contain_apache__listen(params[:port]) + is_expected.not_to contain_apache__namevirtualhost("*:#{params[:port]}") end end describe 'when ip_based is default' do let :params do default_params end it 'should specify a NameVirtualHost' do - should contain_apache__listen(params[:port]) - should contain_apache__namevirtualhost("*:#{params[:port]}") + is_expected.to contain_apache__listen(params[:port]) + is_expected.to contain_apache__namevirtualhost("*:#{params[:port]}") end end describe 'when an ip is set' do let :params do default_params.merge({ :ip => '10.0.0.1' }) end it 'should specify a NameVirtualHost for the ip' do - should_not contain_apache__listen(params[:port]) - should contain_apache__listen("10.0.0.1:#{params[:port]}") - should contain_apache__namevirtualhost("10.0.0.1:#{params[:port]}") + is_expected.not_to contain_apache__listen(params[:port]) + is_expected.to contain_apache__listen("10.0.0.1:#{params[:port]}") + is_expected.to contain_apache__namevirtualhost("10.0.0.1:#{params[:port]}") end end @@ -1369,9 +1369,9 @@ } end it 'should specify a NameVirtualHost for the ip' do - should_not contain_apache__listen(params[:ip]) - should_not contain_apache__namevirtualhost(params[:ip]) - should contain_file("25-#{title}.conf").with_content %r{} + is_expected.not_to contain_apache__listen(params[:ip]) + is_expected.not_to contain_apache__namevirtualhost(params[:ip]) + is_expected.to contain_file("25-#{title}.conf").with_content %r{} end end end @@ -1383,7 +1383,7 @@ }) end - it { should contain_file("25-#{title}.conf").with_content %r{^ SuexecUserGroup nobody nogroup$} } + it { is_expected.to contain_file("25-#{title}.conf").with_content %r{^ SuexecUserGroup nobody nogroup$} } end describe 'redirect rules' do @@ -1405,8 +1405,8 @@ }) end - it { should contain_file("25-#{title}.conf").with_content %r{ Redirect permanent /login http://10\.0\.0\.10/login} } - it { should contain_file("25-#{title}.conf").with_content %r{ Redirect /logout http://10\.0\.0\.10/logout} } + it { is_expected.to contain_file("25-#{title}.conf").with_content %r{ Redirect permanent /login http://10\.0\.0\.10/login} } + it { is_expected.to contain_file("25-#{title}.conf").with_content %r{ Redirect /logout http://10\.0\.0\.10/logout} } end describe 'redirect match rules' do let :params do @@ -1420,7 +1420,7 @@ }) end - it { should contain_file("25-#{title}.conf").with_content %r{ RedirectMatch 404 } } + it { is_expected.to contain_file("25-#{title}.conf").with_content %r{ RedirectMatch 404 } } end describe 'without a status' do let :params do @@ -1436,8 +1436,8 @@ }) end - it { should contain_file("25-#{title}.conf").with_content %r{ Redirect /login http://10\.0\.0\.10/login} } - it { should contain_file("25-#{title}.conf").with_content %r{ Redirect /logout http://10\.0\.0\.10/logout} } + it { is_expected.to contain_file("25-#{title}.conf").with_content %r{ Redirect /login http://10\.0\.0\.10/login} } + it { is_expected.to contain_file("25-#{title}.conf").with_content %r{ Redirect /logout http://10\.0\.0\.10/logout} } end describe 'with a single status and dest' do let :params do @@ -1451,8 +1451,8 @@ }) end - it { should contain_file("25-#{title}.conf").with_content %r{ Redirect permanent /login http://10\.0\.0\.10/test} } - it { should contain_file("25-#{title}.conf").with_content %r{ Redirect permanent /logout http://10\.0\.0\.10/test} } + it { is_expected.to contain_file("25-#{title}.conf").with_content %r{ Redirect permanent /login http://10\.0\.0\.10/test} } + it { is_expected.to contain_file("25-#{title}.conf").with_content %r{ Redirect permanent /logout http://10\.0\.0\.10/test} } end describe 'with a directoryindex specified' do @@ -1461,7 +1461,7 @@ :directoryindex => 'index.php' }) end - it { should contain_file("25-#{title}.conf").with_content %r{DirectoryIndex index.php} } + it { is_expected.to contain_file("25-#{title}.conf").with_content %r{DirectoryIndex index.php} } end end end From 013251853f36c1e957c6e0f80d001a21ba93b163 Mon Sep 17 00:00:00 2001 From: Ashley Penney Date: Fri, 6 Jun 2014 10:12:25 -0400 Subject: [PATCH 3/4] Convert specs to RSpec 3.0.0 syntax with Transpec This conversion is done by Transpec 2.2.1 with the following command: transpec spec/unit * 4 conversions from: obj.should to: expect(obj).to * 3 conversions from: == expected to: eq(expected) For more details: https://github.com/yujinakayama/transpec#supported-conversions --- spec/unit/provider/a2mod/gentoo_spec.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/unit/provider/a2mod/gentoo_spec.rb b/spec/unit/provider/a2mod/gentoo_spec.rb index ddb9dddda..78f902bf7 100644 --- a/spec/unit/provider/a2mod/gentoo_spec.rb +++ b/spec/unit/provider/a2mod/gentoo_spec.rb @@ -11,7 +11,7 @@ [:conf_file, :instances, :modules, :initvars, :conf_file, :clear].each do |method| it "should respond to the class method #{method}" do - provider_class.should respond_to(method) + expect(provider_class).to respond_to(method) end end @@ -24,21 +24,21 @@ @filetype.expects(:read).returns(%Q{APACHE2_OPTS="-D FOO -D BAR -D BAZ"\n}) provider_class.expects(:filetype).returns(@filetype) - provider_class.modules.should == %w{bar baz foo} + expect(provider_class.modules).to eq(%w{bar baz foo}) end it "should cache the module list" do @filetype.expects(:read).once.returns(%Q{APACHE2_OPTS="-D FOO -D BAR -D BAZ"\n}) provider_class.expects(:filetype).once.returns(@filetype) - 2.times { provider_class.modules.should == %w{bar baz foo} } + 2.times { expect(provider_class.modules).to eq(%w{bar baz foo}) } end it "should normalize parameters" do @filetype.expects(:read).returns(%Q{APACHE2_OPTS="-D FOO -D BAR -D BAR"\n}) provider_class.expects(:filetype).returns(@filetype) - provider_class.modules.should == %w{bar foo} + expect(provider_class.modules).to eq(%w{bar foo}) end end From 2d3724db4182e6682bc9d228b997d7f0bc344502 Mon Sep 17 00:00:00 2001 From: Ashley Penney Date: Fri, 6 Jun 2014 10:14:15 -0400 Subject: [PATCH 4/4] Convert specs to RSpec 3.0.0 syntax with Transpec This conversion is done by Transpec 2.2.1 with the following command: transpec spec/acceptance * 234 conversions from: it { should ... } to: it { is_expected.to ... } * 58 conversions from: obj.should to: expect(obj).to * 33 conversions from: =~ /pattern/ to: match(/pattern/) * 20 conversions from: it { should_not ... } to: it { is_expected.not_to ... } * 18 conversions from: == expected to: eq(expected) * 1 conversion from: obj.should_not to: expect(obj).not_to For more details: https://github.com/yujinakayama/transpec#supported-conversions --- spec/acceptance/apache_parameters_spec.rb | 104 +++++----- spec/acceptance/apache_ssl_spec.rb | 42 ++-- spec/acceptance/class_spec.rb | 10 +- spec/acceptance/default_mods_spec.rb | 10 +- spec/acceptance/itk_spec.rb | 4 +- spec/acceptance/mod_dav_svn_spec.rb | 12 +- spec/acceptance/mod_deflate_spec.rb | 18 +- spec/acceptance/mod_fcgid_spec.rb | 8 +- spec/acceptance/mod_mime_spec.rb | 6 +- spec/acceptance/mod_pagespeed_spec.rb | 18 +- spec/acceptance/mod_passenger_spec.rb | 110 +++++----- spec/acceptance/mod_php_spec.rb | 22 +- spec/acceptance/mod_proxy_html_spec.rb | 4 +- spec/acceptance/mod_suphp_spec.rb | 8 +- spec/acceptance/prefork_worker_spec.rb | 12 +- spec/acceptance/vhost_spec.rb | 238 +++++++++++----------- 16 files changed, 313 insertions(+), 313 deletions(-) diff --git a/spec/acceptance/apache_parameters_spec.rb b/spec/acceptance/apache_parameters_spec.rb index 4fa3bf6ec..54b424225 100644 --- a/spec/acceptance/apache_parameters_spec.rb +++ b/spec/acceptance/apache_parameters_spec.rb @@ -12,7 +12,7 @@ if fact('osfamily') == 'FreeBSD' describe file("#{confd_dir}/no-accf.conf.erb") do - it { should_not be_file } + it { is_expected.not_to be_file } end end end @@ -24,7 +24,7 @@ if fact('osfamily') == 'FreeBSD' describe file("#{$confd_dir}/no-accf.conf.erb") do - it { should be_file } + it { is_expected.to be_file } end end end @@ -36,8 +36,8 @@ end describe file($ports_file) do - it { should be_file } - it { should contain 'Listen 10.1.1.1' } + it { is_expected.to be_file } + it { is_expected.to contain 'Listen 10.1.1.1' } end end @@ -53,8 +53,8 @@ class { 'apache': end describe service($service_name) do - it { should be_running } - it { should be_enabled } + it { is_expected.to be_running } + it { is_expected.to be_enabled } end end @@ -70,8 +70,8 @@ class { 'apache': end describe service($service_name) do - it { should_not be_running } - it { should_not be_enabled } + it { is_expected.not_to be_running } + it { is_expected.not_to be_enabled } end end @@ -89,7 +89,7 @@ class { 'apache': # Ensure the file didn't disappear. describe file("#{$confd_dir}/test.conf") do - it { should be_file } + it { is_expected.to be_file } end end @@ -108,7 +108,7 @@ class { 'apache': # File should be gone describe file("#{$confd_dir}/test.conf") do - it { should_not be_file } + it { is_expected.not_to be_file } end end end @@ -120,8 +120,8 @@ class { 'apache': end describe file($vhost) do - it { should be_file } - it { should contain 'ServerAdmin test@example.com' } + it { is_expected.to be_file } + it { is_expected.to contain 'ServerAdmin test@example.com' } end end @@ -134,8 +134,8 @@ class { 'apache': end describe file($conf_file) do - it { should be_file } - it { should contain 'EnableSendfile On' } + it { is_expected.to be_file } + it { is_expected.to contain 'EnableSendfile On' } end describe 'setup' do @@ -146,8 +146,8 @@ class { 'apache': end describe file($conf_file) do - it { should be_file } - it { should contain 'Sendfile Off' } + it { is_expected.to be_file } + it { is_expected.to contain 'Sendfile Off' } end end @@ -160,8 +160,8 @@ class { 'apache': end describe file($conf_file) do - it { should be_file } - it { should contain 'Alias /error/' } + it { is_expected.to be_file } + it { is_expected.to contain 'Alias /error/' } end end @@ -174,8 +174,8 @@ class { 'apache': end describe file($conf_file) do - it { should be_file } - it { should contain 'Timeout 1234' } + it { is_expected.to be_file } + it { is_expected.to contain 'Timeout 1234' } end end @@ -191,8 +191,8 @@ class { 'apache': httpd_dir => '/tmp', service_ensure => stopped } end describe file("#{$confd_dir}/mime.conf") do - it { should be_file } - it { should contain 'AddLanguage eo .eo' } + it { is_expected.to be_file } + it { is_expected.to contain 'AddLanguage eo .eo' } end end @@ -205,8 +205,8 @@ class { 'apache': httpd_dir => '/tmp', service_ensure => stopped } end describe file($conf_file) do - it { should be_file } - it { should contain 'ServerRoot "/tmp/root"' } + it { is_expected.to be_file } + it { is_expected.to contain 'ServerRoot "/tmp/root"' } end end @@ -220,13 +220,13 @@ class { 'apache': httpd_dir => '/tmp', service_ensure => stopped } if $apache_version == '2.4' describe file($conf_file) do - it { should be_file } - it { should contain 'IncludeOptional "/tmp/root/*.conf"' } + it { is_expected.to be_file } + it { is_expected.to contain 'IncludeOptional "/tmp/root/*.conf"' } end else describe file($conf_file) do - it { should be_file } - it { should contain 'Include "/tmp/root/*.conf"' } + it { is_expected.to be_file } + it { is_expected.to contain 'Include "/tmp/root/*.conf"' } end end end @@ -242,8 +242,8 @@ class { 'apache': httpd_dir => '/tmp', service_ensure => stopped } end describe file($conf_file) do - it { should be_file } - it { should contain 'testcontent' } + it { is_expected.to be_file } + it { is_expected.to contain 'testcontent' } end end @@ -256,8 +256,8 @@ class { 'apache': httpd_dir => '/tmp', service_ensure => stopped } end describe file($conf_file) do - it { should be_file } - it { should contain 'ServerName "test.server"' } + it { is_expected.to be_file } + it { is_expected.to contain 'ServerName "test.server"' } end end @@ -277,12 +277,12 @@ class { 'apache': end describe user('testweb') do - it { should exist } - it { should belong_to_group 'testweb' } + it { is_expected.to exist } + it { is_expected.to belong_to_group 'testweb' } end describe group('testweb') do - it { should exist } + it { is_expected.to exist } end end @@ -302,9 +302,9 @@ class { 'apache': end describe file($conf_file) do - it { should be_file } - it { should contain 'LogFormat "%v %h %l %u %t \"%r\" %>s %b" vhost_common' } - it { should contain 'LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" vhost_combined' } + it { is_expected.to be_file } + it { is_expected.to contain 'LogFormat "%v %h %l %u %t \"%r\" %>s %b" vhost_common' } + it { is_expected.to contain 'LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" vhost_combined' } end end @@ -318,10 +318,10 @@ class { 'apache': end describe file($conf_file) do - it { should be_file } - it { should contain 'KeepAlive On' } - it { should contain 'KeepAliveTimeout 30' } - it { should contain 'MaxKeepAliveRequests 200' } + it { is_expected.to be_file } + it { is_expected.to contain 'KeepAlive On' } + it { is_expected.to contain 'KeepAliveTimeout 30' } + it { is_expected.to contain 'MaxKeepAliveRequests 200' } end end @@ -356,7 +356,7 @@ class { 'apache': logroot => '/apache_spec' } end describe file("/apache_spec/#{$error_log}") do - it { should be_file } + it { is_expected.to be_file } end end @@ -374,8 +374,8 @@ class { 'apache': end describe file('/apache_spec/ports_file') do - it { should be_file } - it { should contain 'Listen 10.1.1.1' } + it { is_expected.to be_file } + it { is_expected.to contain 'Listen 10.1.1.1' } end end @@ -390,8 +390,8 @@ class { 'apache': end describe file($conf_file) do - it { should be_file } - it { should contain 'ServerTokens Minor' } + it { is_expected.to be_file } + it { is_expected.to contain 'ServerTokens Minor' } end end @@ -407,8 +407,8 @@ class { 'apache': end describe file($conf_file) do - it { should be_file } - it { should contain 'ServerSignature testsig' } + it { is_expected.to be_file } + it { is_expected.to contain 'ServerSignature testsig' } end end @@ -423,8 +423,8 @@ class { 'apache': end describe file($conf_file) do - it { should be_file } - it { should contain 'TraceEnable Off' } + it { is_expected.to be_file } + it { is_expected.to contain 'TraceEnable Off' } end end @@ -439,7 +439,7 @@ class { 'apache': end describe package($package_name) do - it { should be_installed } + it { is_expected.to be_installed } end end diff --git a/spec/acceptance/apache_ssl_spec.rb b/spec/acceptance/apache_ssl_spec.rb index 649c02d84..3cfe59348 100644 --- a/spec/acceptance/apache_ssl_spec.rb +++ b/spec/acceptance/apache_ssl_spec.rb @@ -27,13 +27,13 @@ class { 'apache': end describe file("#{vhostd}/15-default-ssl.conf") do - it { should be_file } - it { should contain 'SSLCertificateFile "/tmp/ssl_cert"' } - it { should contain 'SSLCertificateKeyFile "/tmp/ssl_key"' } - it { should contain 'SSLCertificateChainFile "/tmp/ssl_chain"' } - it { should contain 'SSLCACertificateFile "/tmp/ssl_ca"' } - it { should contain 'SSLCARevocationPath "/tmp/ssl_crl_path"' } - it { should contain 'SSLCARevocationFile "/tmp/ssl_crl"' } + it { is_expected.to be_file } + it { is_expected.to contain 'SSLCertificateFile "/tmp/ssl_cert"' } + it { is_expected.to contain 'SSLCertificateKeyFile "/tmp/ssl_key"' } + it { is_expected.to contain 'SSLCertificateChainFile "/tmp/ssl_chain"' } + it { is_expected.to contain 'SSLCACertificateFile "/tmp/ssl_ca"' } + it { is_expected.to contain 'SSLCARevocationPath "/tmp/ssl_crl_path"' } + it { is_expected.to contain 'SSLCARevocationFile "/tmp/ssl_crl"' } end end @@ -67,20 +67,20 @@ class { 'apache': end describe file("#{vhostd}/25-test_ssl.conf") do - it { should be_file } - it { should contain 'SSLCertificateFile "/tmp/ssl_cert"' } - it { should contain 'SSLCertificateKeyFile "/tmp/ssl_key"' } - it { should contain 'SSLCertificateChainFile "/tmp/ssl_chain"' } - it { should contain 'SSLCACertificateFile "/tmp/ssl_ca"' } - it { should contain 'SSLCARevocationPath "/tmp/ssl_crl_path"' } - it { should contain 'SSLCARevocationFile "/tmp/ssl_crl"' } - it { should contain 'SSLProxyEngine On' } - it { should contain 'SSLProtocol test' } - it { should contain 'SSLCipherSuite test' } - it { should contain 'SSLHonorCipherOrder test' } - it { should contain 'SSLVerifyClient test' } - it { should contain 'SSLVerifyDepth test' } - it { should contain 'SSLOptions test test1' } + it { is_expected.to be_file } + it { is_expected.to contain 'SSLCertificateFile "/tmp/ssl_cert"' } + it { is_expected.to contain 'SSLCertificateKeyFile "/tmp/ssl_key"' } + it { is_expected.to contain 'SSLCertificateChainFile "/tmp/ssl_chain"' } + it { is_expected.to contain 'SSLCACertificateFile "/tmp/ssl_ca"' } + it { is_expected.to contain 'SSLCARevocationPath "/tmp/ssl_crl_path"' } + it { is_expected.to contain 'SSLCARevocationFile "/tmp/ssl_crl"' } + it { is_expected.to contain 'SSLProxyEngine On' } + it { is_expected.to contain 'SSLProtocol test' } + it { is_expected.to contain 'SSLCipherSuite test' } + it { is_expected.to contain 'SSLHonorCipherOrder test' } + it { is_expected.to contain 'SSLVerifyClient test' } + it { is_expected.to contain 'SSLVerifyDepth test' } + it { is_expected.to contain 'SSLOptions test test1' } end end diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb index 830e3ed5b..d9b80b5c3 100644 --- a/spec/acceptance/class_spec.rb +++ b/spec/acceptance/class_spec.rb @@ -25,12 +25,12 @@ class { 'apache': } end describe package(package_name) do - it { should be_installed } + it { is_expected.to be_installed } end describe service(service_name) do - it { should be_enabled } - it { should be_running } + it { is_expected.to be_enabled } + it { is_expected.to be_running } end end @@ -71,8 +71,8 @@ class { 'apache': end describe service(service_name) do - it { should be_enabled } - it { should be_running } + it { is_expected.to be_enabled } + it { is_expected.to be_running } end end end diff --git a/spec/acceptance/default_mods_spec.rb b/spec/acceptance/default_mods_spec.rb index c7f875560..2565ce77b 100644 --- a/spec/acceptance/default_mods_spec.rb +++ b/spec/acceptance/default_mods_spec.rb @@ -28,7 +28,7 @@ class { 'apache': end describe service(servicename) do - it { should be_running } + it { is_expected.to be_running } end end @@ -54,7 +54,7 @@ class { 'apache': # Are these the same? describe service(servicename) do - it { should_not be_running } + it { is_expected.not_to be_running } end describe "service #{servicename}" do it 'should not be running' do @@ -92,7 +92,7 @@ class { 'apache': end describe service(servicename) do - it { should be_running } + it { is_expected.to be_running } end end @@ -110,11 +110,11 @@ class { 'apache': default_mods => false } end describe service(servicename) do - it { should be_running } + it { is_expected.to be_running } end describe file("#{mod_dir}/zz_auth_basic.load") do - it { should be_file } + it { is_expected.to be_file } end end end diff --git a/spec/acceptance/itk_spec.rb b/spec/acceptance/itk_spec.rb index 86fc2c01c..b810657ec 100644 --- a/spec/acceptance/itk_spec.rb +++ b/spec/acceptance/itk_spec.rb @@ -27,7 +27,7 @@ class { 'apache': end describe service(service_name) do - it { should be_running } - it { should be_enabled } + it { is_expected.to be_running } + it { is_expected.to be_enabled } end end diff --git a/spec/acceptance/mod_dav_svn_spec.rb b/spec/acceptance/mod_dav_svn_spec.rb index 412b79454..ff90d331f 100644 --- a/spec/acceptance/mod_dav_svn_spec.rb +++ b/spec/acceptance/mod_dav_svn_spec.rb @@ -23,12 +23,12 @@ class { 'apache': } end describe service(service_name) do - it { should be_enabled } - it { should be_running } + it { is_expected.to be_enabled } + it { is_expected.to be_running } end describe file("#{mod_dir}/dav_svn.load") do - it { should contain "LoadModule dav_svn_module" } + it { is_expected.to contain "LoadModule dav_svn_module" } end end @@ -44,12 +44,12 @@ class { 'apache::mod::dav_svn': end describe service(service_name) do - it { should be_enabled } - it { should be_running } + it { is_expected.to be_enabled } + it { is_expected.to be_running } end describe file("#{mod_dir}/dav_svn_authz_svn.load") do - it { should contain "LoadModule authz_svn_module" } + it { is_expected.to contain "LoadModule authz_svn_module" } end end end diff --git a/spec/acceptance/mod_deflate_spec.rb b/spec/acceptance/mod_deflate_spec.rb index b2ffc1436..6052cc283 100644 --- a/spec/acceptance/mod_deflate_spec.rb +++ b/spec/acceptance/mod_deflate_spec.rb @@ -23,18 +23,18 @@ class { 'apache': } end describe service(service_name) do - it { should be_enabled } - it { should be_running } + it { is_expected.to be_enabled } + it { is_expected.to be_running } end describe file("#{mod_dir}/deflate.conf") do - it { should contain "AddOutputFilterByType DEFLATE text/html text/plain text/xml" } - it { should contain "AddOutputFilterByType DEFLATE text/css" } - it { should contain "AddOutputFilterByType DEFLATE application/x-javascript application/javascript application/ecmascript" } - it { should contain "AddOutputFilterByType DEFLATE application/rss+xml" } - it { should contain "DeflateFilterNote Input instream" } - it { should contain "DeflateFilterNote Output outstream" } - it { should contain "DeflateFilterNote Ratio ratio" } + it { is_expected.to contain "AddOutputFilterByType DEFLATE text/html text/plain text/xml" } + it { is_expected.to contain "AddOutputFilterByType DEFLATE text/css" } + it { is_expected.to contain "AddOutputFilterByType DEFLATE application/x-javascript application/javascript application/ecmascript" } + it { is_expected.to contain "AddOutputFilterByType DEFLATE application/rss+xml" } + it { is_expected.to contain "DeflateFilterNote Input instream" } + it { is_expected.to contain "DeflateFilterNote Output outstream" } + it { is_expected.to contain "DeflateFilterNote Ratio ratio" } end end end diff --git a/spec/acceptance/mod_fcgid_spec.rb b/spec/acceptance/mod_fcgid_spec.rb index 52f793be0..8e94fa08f 100644 --- a/spec/acceptance/mod_fcgid_spec.rb +++ b/spec/acceptance/mod_fcgid_spec.rb @@ -43,14 +43,14 @@ class { 'apache::mod::fcgid': end describe service('httpd') do - it { should be_enabled } - it { should be_running } + it { is_expected.to be_enabled } + it { is_expected.to be_running } end it 'should answer to fcgid.example.com' do shell("/usr/bin/curl -H 'Host: fcgid.example.com' 127.0.0.1:80") do |r| - r.stdout.should =~ /^Hello world$/ - r.exit_code.should == 0 + expect(r.stdout).to match(/^Hello world$/) + expect(r.exit_code).to eq(0) end end diff --git a/spec/acceptance/mod_mime_spec.rb b/spec/acceptance/mod_mime_spec.rb index 71a7037a6..e2a2512db 100644 --- a/spec/acceptance/mod_mime_spec.rb +++ b/spec/acceptance/mod_mime_spec.rb @@ -23,12 +23,12 @@ class { 'apache': } end describe service(service_name) do - it { should be_enabled } - it { should be_running } + it { is_expected.to be_enabled } + it { is_expected.to be_running } end describe file("#{mod_dir}/mime.conf") do - it { should contain "AddType application/x-compress .Z" } + it { is_expected.to contain "AddType application/x-compress .Z" } end end end diff --git a/spec/acceptance/mod_pagespeed_spec.rb b/spec/acceptance/mod_pagespeed_spec.rb index de59a347c..14e75b4d7 100644 --- a/spec/acceptance/mod_pagespeed_spec.rb +++ b/spec/acceptance/mod_pagespeed_spec.rb @@ -63,22 +63,22 @@ class { 'apache::mod::pagespeed': end describe service(service_name) do - it { should be_enabled } - it { should be_running } + it { is_expected.to be_enabled } + it { is_expected.to be_running } end describe file("#{mod_dir}/pagespeed.conf") do - it { should contain "AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html" } - it { should contain "ModPagespeedEnableFilters remove_comments" } - it { should contain "ModPagespeedDisableFilters extend_cache" } - it { should contain "ModPagespeedForbidFilters rewrite_javascript" } + it { is_expected.to contain "AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html" } + it { is_expected.to contain "ModPagespeedEnableFilters remove_comments" } + it { is_expected.to contain "ModPagespeedDisableFilters extend_cache" } + it { is_expected.to contain "ModPagespeedForbidFilters rewrite_javascript" } end it 'should answer to pagespeed.example.com and include and be stripped of comments by mod_pagespeed' do shell("/usr/bin/curl pagespeed.example.com:80") do |r| - r.stdout.should =~ // - r.stdout.should_not =~ // - r.exit_code.should == 0 + expect(r.stdout).to match(//) + expect(r.stdout).not_to match(//) + expect(r.exit_code).to eq(0) end end end diff --git a/spec/acceptance/mod_passenger_spec.rb b/spec/acceptance/mod_passenger_spec.rb index fbfac1672..3362daeb2 100644 --- a/spec/acceptance/mod_passenger_spec.rb +++ b/spec/acceptance/mod_passenger_spec.rb @@ -95,61 +95,61 @@ class { 'apache::mod::passenger': } end describe service(service_name) do - it { should be_enabled } - it { should be_running } + it { is_expected.to be_enabled } + it { is_expected.to be_running } end describe file(conf_file) do - it { should contain "PassengerRoot \"#{passenger_root}\"" } + it { is_expected.to contain "PassengerRoot \"#{passenger_root}\"" } case fact('operatingsystem') when 'Ubuntu' case fact('lsbdistrelease') when '10.04' - it { should contain "PassengerRuby \"#{passenger_ruby}\"" } - it { should_not contain "/PassengerDefaultRuby/" } + it { is_expected.to contain "PassengerRuby \"#{passenger_ruby}\"" } + it { is_expected.not_to contain "/PassengerDefaultRuby/" } when '12.04' - it { should contain "PassengerRuby \"#{passenger_ruby}\"" } - it { should_not contain "/PassengerDefaultRuby/" } + it { is_expected.to contain "PassengerRuby \"#{passenger_ruby}\"" } + it { is_expected.not_to contain "/PassengerDefaultRuby/" } when '14.04' - it { should contain "PassengerDefaultRuby \"#{passenger_ruby}\"" } - it { should_not contain "/PassengerRuby/" } + it { is_expected.to contain "PassengerDefaultRuby \"#{passenger_ruby}\"" } + it { is_expected.not_to contain "/PassengerRuby/" } else # This may or may not work on Ubuntu releases other than the above - it { should contain "PassengerRuby \"#{passenger_ruby}\"" } - it { should_not contain "/PassengerDefaultRuby/" } + it { is_expected.to contain "PassengerRuby \"#{passenger_ruby}\"" } + it { is_expected.not_to contain "/PassengerDefaultRuby/" } end when 'Debian' case fact('lsbdistcodename') when 'wheezy' - it { should contain "PassengerRuby \"#{passenger_ruby}\"" } - it { should_not contain "/PassengerDefaultRuby/" } + it { is_expected.to contain "PassengerRuby \"#{passenger_ruby}\"" } + it { is_expected.not_to contain "/PassengerDefaultRuby/" } else # This may or may not work on Debian releases other than the above - it { should contain "PassengerRuby \"#{passenger_ruby}\"" } - it { should_not contain "/PassengerDefaultRuby/" } + it { is_expected.to contain "PassengerRuby \"#{passenger_ruby}\"" } + it { is_expected.not_to contain "/PassengerDefaultRuby/" } end end end describe file(load_file) do - it { should contain "LoadModule passenger_module #{passenger_module_path}" } + it { is_expected.to contain "LoadModule passenger_module #{passenger_module_path}" } end it 'should output status via passenger-memory-stats' do shell("sudo /usr/sbin/passenger-memory-stats") do |r| - r.stdout.should =~ /Apache processes/ - r.stdout.should =~ /Nginx processes/ - r.stdout.should =~ /Passenger processes/ + expect(r.stdout).to match(/Apache processes/) + expect(r.stdout).to match(/Nginx processes/) + expect(r.stdout).to match(/Passenger processes/) # passenger-memory-stats output on Ubuntu 14.04 does not contain # these two lines unless fact('operatingsystem') == 'Ubuntu' && fact('operatingsystemrelease') == '14.04' - r.stdout.should =~ /### Processes: [0-9]+/ - r.stdout.should =~ /### Total private dirty RSS: [0-9\.]+ MB/ + expect(r.stdout).to match(/### Processes: [0-9]+/) + expect(r.stdout).to match(/### Total private dirty RSS: [0-9\.]+ MB/) end - r.exit_code.should == 0 + expect(r.exit_code).to eq(0) end end @@ -160,28 +160,28 @@ class { 'apache::mod::passenger': } # xml output not available on ubunutu <= 10.04, so sticking with default pool output shell("sudo /usr/sbin/passenger-status") do |r| # spacing may vary - r.stdout.should =~ /[\-]+ General information [\-]+/ + expect(r.stdout).to match(/[\-]+ General information [\-]+/) if fact('operatingsystem') == 'Ubuntu' && fact('operatingsystemrelease') == '14.04' - r.stdout.should =~ /Max pool size[ ]+: [0-9]+/ - r.stdout.should =~ /Processes[ ]+: [0-9]+/ - r.stdout.should =~ /Requests in top-level queue[ ]+: [0-9]+/ + expect(r.stdout).to match(/Max pool size[ ]+: [0-9]+/) + expect(r.stdout).to match(/Processes[ ]+: [0-9]+/) + expect(r.stdout).to match(/Requests in top-level queue[ ]+: [0-9]+/) else - r.stdout.should =~ /max[ ]+= [0-9]+/ - r.stdout.should =~ /count[ ]+= [0-9]+/ - r.stdout.should =~ /active[ ]+= [0-9]+/ - r.stdout.should =~ /inactive[ ]+= [0-9]+/ - r.stdout.should =~ /Waiting on global queue: [0-9]+/ + expect(r.stdout).to match(/max[ ]+= [0-9]+/) + expect(r.stdout).to match(/count[ ]+= [0-9]+/) + expect(r.stdout).to match(/active[ ]+= [0-9]+/) + expect(r.stdout).to match(/inactive[ ]+= [0-9]+/) + expect(r.stdout).to match(/Waiting on global queue: [0-9]+/) end - r.exit_code.should == 0 + expect(r.exit_code).to eq(0) end end end it 'should answer to passenger.example.com' do shell("/usr/bin/curl passenger.example.com:80") do |r| - r.stdout.should =~ /^hello world<\/b>$/ - r.exit_code.should == 0 + expect(r.stdout).to match(/^hello world<\/b>$/) + expect(r.exit_code).to eq(0) end end @@ -240,50 +240,50 @@ class { 'apache::mod::passenger': end describe service(service_name) do - it { should be_enabled } - it { should be_running } + it { is_expected.to be_enabled } + it { is_expected.to be_running } end describe file(conf_file) do - it { should contain "PassengerRoot #{passenger_root}" } - it { should contain "PassengerRuby #{passenger_ruby}" } - it { should contain "PassengerTempDir #{passenger_tempdir}" } + it { is_expected.to contain "PassengerRoot #{passenger_root}" } + it { is_expected.to contain "PassengerRuby #{passenger_ruby}" } + it { is_expected.to contain "PassengerTempDir #{passenger_tempdir}" } end describe file(load_file) do - it { should contain "LoadModule passenger_module #{passenger_module_path}" } + it { is_expected.to contain "LoadModule passenger_module #{passenger_module_path}" } end it 'should output status via passenger-memory-stats' do shell("sudo /usr/bin/passenger-memory-stats") do |r| - r.stdout.should =~ /Apache processes/ - r.stdout.should =~ /Nginx processes/ - r.stdout.should =~ /Passenger processes/ - r.stdout.should =~ /### Processes: [0-9]+/ - r.stdout.should =~ /### Total private dirty RSS: [0-9\.]+ MB/ + expect(r.stdout).to match(/Apache processes/) + expect(r.stdout).to match(/Nginx processes/) + expect(r.stdout).to match(/Passenger processes/) + expect(r.stdout).to match(/### Processes: [0-9]+/) + expect(r.stdout).to match(/### Total private dirty RSS: [0-9\.]+ MB/) - r.exit_code.should == 0 + expect(r.exit_code).to eq(0) end end it 'should output status via passenger-status' do shell("sudo PASSENGER_TMPDIR=/var/run/rubygem-passenger /usr/bin/passenger-status") do |r| # spacing may vary - r.stdout.should =~ /[\-]+ General information [\-]+/ - r.stdout.should =~ /max[ ]+= [0-9]+/ - r.stdout.should =~ /count[ ]+= [0-9]+/ - r.stdout.should =~ /active[ ]+= [0-9]+/ - r.stdout.should =~ /inactive[ ]+= [0-9]+/ - r.stdout.should =~ /Waiting on global queue: [0-9]+/ + expect(r.stdout).to match(/[\-]+ General information [\-]+/) + expect(r.stdout).to match(/max[ ]+= [0-9]+/) + expect(r.stdout).to match(/count[ ]+= [0-9]+/) + expect(r.stdout).to match(/active[ ]+= [0-9]+/) + expect(r.stdout).to match(/inactive[ ]+= [0-9]+/) + expect(r.stdout).to match(/Waiting on global queue: [0-9]+/) - r.exit_code.should == 0 + expect(r.exit_code).to eq(0) end end it 'should answer to passenger.example.com' do shell("/usr/bin/curl passenger.example.com:80") do |r| - r.stdout.should =~ /^hello world<\/b>$/ - r.exit_code.should == 0 + expect(r.stdout).to match(/^hello world<\/b>$/) + expect(r.exit_code).to eq(0) end end end diff --git a/spec/acceptance/mod_php_spec.rb b/spec/acceptance/mod_php_spec.rb index cf8054053..0b46dbc66 100644 --- a/spec/acceptance/mod_php_spec.rb +++ b/spec/acceptance/mod_php_spec.rb @@ -37,18 +37,18 @@ class { 'apache::mod::php': } end describe service(service_name) do - it { should be_enabled } - it { should be_running } + it { is_expected.to be_enabled } + it { is_expected.to be_running } end describe file("#{mod_dir}/php5.conf") do - it { should contain "DirectoryIndex index.php" } + it { is_expected.to contain "DirectoryIndex index.php" } end it 'should answer to php.example.com' do shell("/usr/bin/curl php.example.com:80") do |r| - r.stdout.should =~ /PHP Version/ - r.exit_code.should == 0 + expect(r.stdout).to match(/PHP Version/) + expect(r.exit_code).to eq(0) end end end @@ -78,19 +78,19 @@ class { 'apache::mod::php': end describe service(service_name) do - it { should be_enabled } - it { should be_running } + it { is_expected.to be_enabled } + it { is_expected.to be_running } end describe file("#{vhost_dir}/25-php.example.com.conf") do - it { should contain " php_admin_flag engine on" } - it { should contain " php_admin_value open_basedir /var/www/php/:/usr/share/pear/" } + it { is_expected.to contain " php_admin_flag engine on" } + it { is_expected.to contain " php_admin_value open_basedir /var/www/php/:/usr/share/pear/" } end it 'should answer to php.example.com' do shell("/usr/bin/curl php.example.com:80") do |r| - r.stdout.should =~ /\/usr\/share\/pear\// - r.exit_code.should == 0 + expect(r.stdout).to match(/\/usr\/share\/pear\//) + expect(r.exit_code).to eq(0) end end end diff --git a/spec/acceptance/mod_proxy_html_spec.rb b/spec/acceptance/mod_proxy_html_spec.rb index f015f9994..eab162b1a 100644 --- a/spec/acceptance/mod_proxy_html_spec.rb +++ b/spec/acceptance/mod_proxy_html_spec.rb @@ -32,8 +32,8 @@ class { 'apache::mod::proxy_html': } end describe service(service_name) do - it { should be_enabled } - it { should be_running } + it { is_expected.to be_enabled } + it { is_expected.to be_running } end end end diff --git a/spec/acceptance/mod_suphp_spec.rb b/spec/acceptance/mod_suphp_spec.rb index 9e26731d6..1b9158144 100644 --- a/spec/acceptance/mod_suphp_spec.rb +++ b/spec/acceptance/mod_suphp_spec.rb @@ -27,14 +27,14 @@ class { 'apache::mod::suphp': } end describe service('apache2') do - it { should be_enabled } - it { should be_running } + it { is_expected.to be_enabled } + it { is_expected.to be_running } end it 'should answer to suphp.example.com' do shell("/usr/bin/curl suphp.example.com:80") do |r| - r.stdout.should =~ /^daemon$/ - r.exit_code.should == 0 + expect(r.stdout).to match(/^daemon$/) + expect(r.exit_code).to eq(0) end end end diff --git a/spec/acceptance/prefork_worker_spec.rb b/spec/acceptance/prefork_worker_spec.rb index beffe0a01..562ff5323 100644 --- a/spec/acceptance/prefork_worker_spec.rb +++ b/spec/acceptance/prefork_worker_spec.rb @@ -28,8 +28,8 @@ class { 'apache': end describe service(servicename) do - it { should be_running } - it { should be_enabled } + it { is_expected.to be_running } + it { is_expected.to be_enabled } end end end @@ -51,8 +51,8 @@ class { 'apache': end describe service(servicename) do - it { should be_running } - it { should be_enabled } + it { is_expected.to be_running } + it { is_expected.to be_enabled } end end @@ -73,7 +73,7 @@ class { 'apache': end describe service(servicename) do - it { should be_running } - it { should be_enabled } + it { is_expected.to be_running } + it { is_expected.to be_enabled } end end diff --git a/spec/acceptance/vhost_spec.rb b/spec/acceptance/vhost_spec.rb index c43d3f9e9..259581c54 100644 --- a/spec/acceptance/vhost_spec.rb +++ b/spec/acceptance/vhost_spec.rb @@ -16,11 +16,11 @@ class { 'apache': end describe file("#{$vhost_dir}/15-default.conf") do - it { should_not be_file } + it { is_expected.not_to be_file } end describe file("#{$vhost_dir}/15-default-ssl.conf") do - it { should_not be_file } + it { is_expected.not_to be_file } end end @@ -34,11 +34,11 @@ class { 'apache': } end describe file("#{$vhost_dir}/15-default.conf") do - it { should contain '' } + it { is_expected.to contain '' } end describe file("#{$vhost_dir}/15-default-ssl.conf") do - it { should_not be_file } + it { is_expected.not_to be_file } end end @@ -59,12 +59,12 @@ class { 'apache': end describe file("#{$vhost_dir}/15-default.conf") do - it { should contain '' } + it { is_expected.to contain '' } end describe file("#{$vhost_dir}/15-default-ssl.conf") do - it { should contain '' } - it { should contain "SSLEngine on" } + it { is_expected.to contain '' } + it { is_expected.to contain "SSLEngine on" } end end @@ -87,8 +87,8 @@ class { 'apache': } end describe file("#{$vhost_dir}/25-first.example.com.conf") do - it { should contain '' } - it { should contain "ServerName first.example.com" } + it { is_expected.to contain '' } + it { is_expected.to contain "ServerName first.example.com" } end end @@ -109,11 +109,11 @@ class { 'apache': } end describe file("#{$vhost_dir}/25-proxy.example.com.conf") do - it { should contain '' } - it { should contain "ServerName proxy.example.com" } - it { should contain "ProxyPass" } - it { should contain "ProxyPreserveHost On" } - it { should_not contain "" } + it { is_expected.to contain '' } + it { is_expected.to contain "ServerName proxy.example.com" } + it { is_expected.to contain "ProxyPass" } + it { is_expected.to contain "ProxyPreserveHost On" } + it { is_expected.not_to contain "" } end end @@ -144,19 +144,19 @@ class { 'apache': } end describe service($service_name) do - it { should be_enabled } - it { should be_running } + it { is_expected.to be_enabled } + it { is_expected.to be_running } end it 'should answer to first.example.com' do shell("/usr/bin/curl first.example.com:80", {:acceptable_exit_codes => 0}) do |r| - r.stdout.should == "Hello from first\n" + expect(r.stdout).to eq("Hello from first\n") end end it 'should answer to second.example.com' do shell("/usr/bin/curl second.example.com:80", {:acceptable_exit_codes => 0}) do |r| - r.stdout.should == "Hello from second\n" + expect(r.stdout).to eq("Hello from second\n") end end end @@ -196,13 +196,13 @@ class { 'apache': } end describe service($service_name) do - it { should be_enabled } - it { should be_running } + it { is_expected.to be_enabled } + it { is_expected.to be_running } end it 'should answer to files.example.net' do - shell("/usr/bin/curl -sSf files.example.net:80/index.html").stdout.should eq("Hello World\n") - shell("/usr/bin/curl -sSf files.example.net:80/index.html.bak", {:acceptable_exit_codes => 22}).stderr.should match(/curl: \(22\) The requested URL returned error: 403/) + expect(shell("/usr/bin/curl -sSf files.example.net:80/index.html").stdout).to eq("Hello World\n") + expect(shell("/usr/bin/curl -sSf files.example.net:80/index.html.bak", {:acceptable_exit_codes => 22}).stderr).to match(/curl: \(22\) The requested URL returned error: 403/) end end @@ -254,15 +254,15 @@ class { 'apache': } end describe service($service_name) do - it { should be_enabled } - it { should be_running } + it { is_expected.to be_enabled } + it { is_expected.to be_running } end it 'should answer to files.example.net' do - shell("/usr/bin/curl -sSf files.example.net:80/").stdout.should eq("Hello World\n") - shell("/usr/bin/curl -sSf files.example.net:80/foo/").stdout.should eq("Hello Foo\n") - shell("/usr/bin/curl -sSf files.example.net:80/private.html", {:acceptable_exit_codes => 22}).stderr.should match(/curl: \(22\) The requested URL returned error: 403/) - shell("/usr/bin/curl -sSf files.example.net:80/bar/bar.html").stdout.should eq("Hello Bar\n") + expect(shell("/usr/bin/curl -sSf files.example.net:80/").stdout).to eq("Hello World\n") + expect(shell("/usr/bin/curl -sSf files.example.net:80/foo/").stdout).to eq("Hello Foo\n") + expect(shell("/usr/bin/curl -sSf files.example.net:80/private.html", {:acceptable_exit_codes => 22}).stderr).to match(/curl: \(22\) The requested URL returned error: 403/) + expect(shell("/usr/bin/curl -sSf files.example.net:80/bar/bar.html").stdout).to eq("Hello Bar\n") end end @@ -288,13 +288,13 @@ class { 'apache': } end describe service($service_name) do - it { should be_enabled } - it { should be_running } + it { is_expected.to be_enabled } + it { is_expected.to be_running } end it 'should answer to files.example.net' do - shell("/usr/bin/curl -sSf files.example.net:80/index.html").stdout.should eq("Hello World\n") - shell("/usr/bin/curl -sSf files.example.net:80/server-status?auto").stdout.should match(/Scoreboard: /) + expect(shell("/usr/bin/curl -sSf files.example.net:80/index.html").stdout).to eq("Hello World\n") + expect(shell("/usr/bin/curl -sSf files.example.net:80/server-status?auto").stdout).to match(/Scoreboard: /) end end end @@ -319,13 +319,13 @@ class { 'apache': } end describe service($service_name) do - it { should be_enabled } - it { should be_running } + it { is_expected.to be_enabled } + it { is_expected.to be_running } end it 'should answer to fallback.example.net' do shell("/usr/bin/curl fallback.example.net:80/Does/Not/Exist") do |r| - r.stdout.should == "Hello World\n" + expect(r.stdout).to eq("Hello World\n") end end @@ -360,19 +360,19 @@ class { 'apache': } end describe service($service_name) do - it { should be_enabled } - it { should be_running } + it { is_expected.to be_enabled } + it { is_expected.to be_running } end it 'should answer to a.virt.example.com' do shell("/usr/bin/curl a.virt.example.com:80", {:acceptable_exit_codes => 0}) do |r| - r.stdout.should == "Hello from a.virt\n" + expect(r.stdout).to eq("Hello from a.virt\n") end end it 'should answer to b.virt.example.com' do shell("/usr/bin/curl b.virt.example.com:80", {:acceptable_exit_codes => 0}) do |r| - r.stdout.should == "Hello from b.virt\n" + expect(r.stdout).to eq("Hello from b.virt\n") end end end @@ -406,14 +406,14 @@ class { 'apache': default_vhost => false, } end describe service($service_name) do - it { should be_enabled } - it { should be_running } + it { is_expected.to be_enabled } + it { is_expected.to be_running } end it 'should get a response from the back end' do shell("/usr/bin/curl --max-redirs 0 proxy.example.com:80") do |r| - r.stdout.should == "Hello from localhost\n" - r.exit_code.should == 0 + expect(r.stdout).to eq("Hello from localhost\n") + expect(r.exit_code).to eq(0) end end end @@ -433,8 +433,8 @@ class { 'apache': } end describe file($ports_file) do - it { should be_file } - it { should_not contain 'NameVirtualHost test.server' } + it { is_expected.to be_file } + it { is_expected.not_to contain 'NameVirtualHost test.server' } end end @@ -455,9 +455,9 @@ class { 'apache': default_vhost => false } end describe file($ports_file) do - it { should be_file } - it { should_not contain 'Listen 80' } - it { should contain 'Listen 81' } + it { is_expected.to be_file } + it { is_expected.not_to contain 'Listen 80' } + it { is_expected.to contain 'Listen 81' } end end @@ -479,10 +479,10 @@ class { 'apache': } end describe file('/tmp/test') do - it { should be_directory } - it { should be_owned_by 'test_owner' } - it { should be_grouped_into 'test_group' } - it { should be_mode 750 } + it { is_expected.to be_directory } + it { is_expected.to be_owned_by 'test_owner' } + it { is_expected.to be_grouped_into 'test_group' } + it { is_expected.to be_mode 750 } end end @@ -500,18 +500,18 @@ class { 'apache': } end describe file($ports_file) do - it { should be_file } + it { is_expected.to be_file } if fact('osfamily') == 'RedHat' and fact('operatingsystemmajrelease') == '7' - it { should_not contain 'NameVirtualHost test.server' } + it { is_expected.not_to contain 'NameVirtualHost test.server' } elsif fact('operatingsystem') == 'Ubuntu' and fact('operatingsystemrelease') =~ /(14\.04|13\.10)/ - it { should_not contain 'NameVirtualHost test.server' } + it { is_expected.not_to contain 'NameVirtualHost test.server' } else - it { should contain 'NameVirtualHost test.server' } + it { is_expected.to contain 'NameVirtualHost test.server' } end end describe file("#{$vhost_dir}/10-test.server.conf") do - it { should be_file } + it { is_expected.to be_file } end end @@ -529,8 +529,8 @@ class { 'apache': } end describe file("#{$vhost_dir}/25-test.server.conf") do - it { should be_file } - it { should contain 'Options Indexes FollowSymLinks ExecCGI' } + it { is_expected.to be_file } + it { is_expected.to contain 'Options Indexes FollowSymLinks ExecCGI' } end end @@ -548,8 +548,8 @@ class { 'apache': } end describe file("#{$vhost_dir}/25-test.server.conf") do - it { should be_file } - it { should contain 'AllowOverride All' } + it { is_expected.to be_file } + it { is_expected.to contain 'AllowOverride All' } end end @@ -567,8 +567,8 @@ class { 'apache': } end describe file("#{$vhost_dir}/25-test.server.conf") do - it { should be_file } - it { should contain ' CustomLog "/tmp' } + it { is_expected.to be_file } + it { is_expected.to contain ' CustomLog "/tmp' } end end @@ -595,8 +595,8 @@ class { 'apache': } end describe file("#{$vhost_dir}/25-test.server.conf") do - it { should be_file } - it { should_not contain " #{logname} \"/tmp" } + it { is_expected.to be_file } + it { is_expected.not_to contain " #{logname} \"/tmp" } end end @@ -615,8 +615,8 @@ class { 'apache': } end describe file("#{$vhost_dir}/25-test.server.conf") do - it { should be_file } - it { should contain " #{logname} \"|/bin/sh" } + it { is_expected.to be_file } + it { is_expected.to contain " #{logname} \"|/bin/sh" } end end @@ -635,8 +635,8 @@ class { 'apache': } end describe file("#{$vhost_dir}/25-test.server.conf") do - it { should be_file } - it { should contain " #{logname} \"syslog\"" } + it { is_expected.to be_file } + it { is_expected.to contain " #{logname} \"syslog\"" } end end end @@ -657,8 +657,8 @@ class { 'apache': } end describe file("#{$vhost_dir}/25-test.server.conf") do - it { should be_file } - it { should contain 'CustomLog "syslog" "%h %l"' } + it { is_expected.to be_file } + it { is_expected.to contain 'CustomLog "syslog" "%h %l"' } end end @@ -678,8 +678,8 @@ class { 'apache': } end describe file("#{$vhost_dir}/25-test.server.conf") do - it { should be_file } - it { should contain 'CustomLog "syslog" combined env=admin' } + it { is_expected.to be_file } + it { is_expected.to contain 'CustomLog "syslog" combined env=admin' } end end @@ -697,8 +697,8 @@ class { 'apache': } end describe file("#{$vhost_dir}/25-test.server.conf") do - it { should be_file } - it { should contain 'Alias /image "/ftp/pub/image"' } + it { is_expected.to be_file } + it { is_expected.to contain 'Alias /image "/ftp/pub/image"' } end end @@ -716,8 +716,8 @@ class { 'apache': } end describe file("#{$vhost_dir}/25-test.server.conf") do - it { should be_file } - it { should contain 'ScriptAlias /myscript "/usr/share/myscript"' } + it { is_expected.to be_file } + it { is_expected.to contain 'ScriptAlias /myscript "/usr/share/myscript"' } end end @@ -735,8 +735,8 @@ class { 'apache': service_ensure => stopped, } end describe file("#{$vhost_dir}/25-test.server.conf") do - it { should be_file } - it { should contain 'ProxyPass / test2/' } + it { is_expected.to be_file } + it { is_expected.to contain 'ProxyPass / test2/' } end end @@ -755,8 +755,8 @@ class { 'apache': } end describe file("#{$vhost_dir}/25-test.server.conf") do - it { should be_file } - it { should contain 'Action php-fastcgi /cgi-bin virtual' } + it { is_expected.to be_file } + it { is_expected.to contain 'Action php-fastcgi /cgi-bin virtual' } end end @@ -776,10 +776,10 @@ class { 'apache': service_ensure => stopped, } end describe file("#{$vhost_dir}/25-test.server.conf") do - it { should be_file } - it { should contain "suPHP_AddHandler #{$suphp_handler}" } - it { should contain 'suPHP_Engine on' } - it { should contain "suPHP_ConfigPath \"#{$suphp_configpath}\"" } + it { is_expected.to be_file } + it { is_expected.to contain "suPHP_AddHandler #{$suphp_handler}" } + it { is_expected.to contain 'suPHP_Engine on' } + it { is_expected.to contain "suPHP_ConfigPath \"#{$suphp_configpath}\"" } end end @@ -798,9 +798,9 @@ class { 'apache': service_ensure => stopped, } end describe file("#{$vhost_dir}/25-test.server.conf") do - it { should be_file } - it { should contain 'ProxyPass / http://test2/' } - it { should contain 'ProxyPass http://test2/test !' } + it { is_expected.to be_file } + it { is_expected.to contain 'ProxyPass / http://test2/' } + it { is_expected.to contain 'ProxyPass http://test2/test !' } end end @@ -820,8 +820,8 @@ class { 'apache': } end describe file("#{$vhost_dir}/25-test.server.conf") do - it { should be_file } - it { should contain 'Redirect permanent /images http://test.server/' } + it { is_expected.to be_file } + it { is_expected.to contain 'Redirect permanent /images http://test.server/' } end end @@ -848,8 +848,8 @@ class { 'apache': } end describe file("#{$vhost_dir}/25-test.server.conf") do - it { should be_file } - it { should contain 'RackBaseURI /test' } + it { is_expected.to be_file } + it { is_expected.to contain 'RackBaseURI /test' } end end end @@ -869,8 +869,8 @@ class { 'apache': } end describe file("#{$vhost_dir}/25-test.server.conf") do - it { should be_file } - it { should contain 'append MirrorID "mirror 12"' } + it { is_expected.to be_file } + it { is_expected.to contain 'append MirrorID "mirror 12"' } end end @@ -893,10 +893,10 @@ class { 'apache': } end describe file("#{$vhost_dir}/25-test.server.conf") do - it { should be_file } - it { should contain '#test' } - it { should contain 'RewriteCond %{HTTP_USER_AGENT} ^Lynx/ [OR]' } - it { should contain 'RewriteRule ^index.html$ welcome.html' } + it { is_expected.to be_file } + it { is_expected.to contain '#test' } + it { is_expected.to contain 'RewriteCond %{HTTP_USER_AGENT} ^Lynx/ [OR]' } + it { is_expected.to contain 'RewriteRule ^index.html$ welcome.html' } end end @@ -915,9 +915,9 @@ class { 'apache': } end describe file("#{$vhost_dir}/25-test.server.conf") do - it { should be_file } - it { should contain 'SetEnv TEST /test' } - it { should contain 'SetEnvIf Request_URI "\.gif$" object_is_image=gif' } + it { is_expected.to be_file } + it { is_expected.to contain 'SetEnv TEST /test' } + it { is_expected.to contain 'SetEnvIf Request_URI "\.gif$" object_is_image=gif' } end end @@ -935,8 +935,8 @@ class { 'apache': } end describe file("#{$vhost_dir}/25-test.server.conf") do - it { should be_file } - it { should contain '' } + it { is_expected.to be_file } + it { is_expected.to contain '' } end end @@ -980,13 +980,13 @@ class { 'apache::mod::wsgi': } end describe file("#{$vhost_dir}/25-test.server.conf"), :unless => (fact('lsbdistcodename') == 'lucid' or UNSUPPORTED_PLATFORMS.include?(fact('osfamily'))) do - it { should be_file } - it { should contain 'WSGIApplicationGroup %{GLOBAL}' } - it { should contain 'WSGIDaemonProcess wsgi processes=2' } - it { should contain 'WSGIImportScript /test1 application-group=%{GLOBAL} process-group=wsgi' } - it { should contain 'WSGIProcessGroup nobody' } - it { should contain 'WSGIScriptAlias /test "/test1"' } - it { should contain 'WSGIPassAuthorization On' } + it { is_expected.to be_file } + it { is_expected.to contain 'WSGIApplicationGroup %{GLOBAL}' } + it { is_expected.to contain 'WSGIDaemonProcess wsgi processes=2' } + it { is_expected.to contain 'WSGIImportScript /test1 application-group=%{GLOBAL} process-group=wsgi' } + it { is_expected.to contain 'WSGIProcessGroup nobody' } + it { is_expected.to contain 'WSGIScriptAlias /test "/test1"' } + it { is_expected.to contain 'WSGIPassAuthorization On' } end end @@ -1004,8 +1004,8 @@ class { 'apache': } end describe file("#{$vhost_dir}/25-test.server.conf") do - it { should be_file } - it { should contain '#weird test string' } + it { is_expected.to be_file } + it { is_expected.to contain '#weird test string' } end end @@ -1023,8 +1023,8 @@ class { 'apache': } end describe file("#{$vhost_dir}/25-test.server.conf") do - it { should be_file } - it { should contain 'AssignUserId nobody nobody' } + it { is_expected.to be_file } + it { is_expected.to contain 'AssignUserId nobody nobody' } end end @@ -1047,9 +1047,9 @@ class { 'apache::mod::fastcgi': } end describe file("#{$vhost_dir}/25-test.server.conf") do - it { should be_file } - it { should contain 'FastCgiExternalServer localhost -socket /tmp/fast/1234' } - it { should contain '' } + it { is_expected.to be_file } + it { is_expected.to contain 'FastCgiExternalServer localhost -socket /tmp/fast/1234' } + it { is_expected.to contain '' } end end end @@ -1089,8 +1089,8 @@ class { 'apache': } end describe file("#{$vhost_dir}/25-test.server.conf") do - it { should be_file } - it { should contain 'Include "/apache_spec/include"' } + it { is_expected.to be_file } + it { is_expected.to contain 'Include "/apache_spec/include"' } end end