Fix RSpec 3.x syntax

* 41 conversions
    from: it { should ... }
      to: it { is_expected.to ... }

* 5 conversions
    from: it { should_not ... }
      to: it { is_expected.to_not ... }

Change-Id: I143aec9fa309b4bbd664fa205b044131cfadc03b
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
This commit is contained in:
Gael Chamoulaud 2015-09-14 09:52:06 +02:00
parent 13f29975a6
commit e005145df1
5 changed files with 46 additions and 46 deletions

View File

@ -93,6 +93,6 @@ describe 'openstack_extras::auth_file' do
} }
end end
it { should contain_file('/tmp/openrc')} it { is_expected.to contain_file('/tmp/openrc')}
end end
end end

View File

@ -34,19 +34,19 @@ describe 'openstack_extras::repo::debian::debian' do
{}.merge!(default_params) {}.merge!(default_params)
end end
it { should contain_apt__source('debian_wheezy').with( it { is_expected.to contain_apt__source('debian_wheezy').with(
:location => 'http://archive.gplhost.com/debian', :location => 'http://archive.gplhost.com/debian',
:release => 'kilo', :release => 'kilo',
:repos => 'main', :repos => 'main',
)} )}
it { should contain_apt__source('debian_wheezy_backports').with( it { is_expected.to contain_apt__source('debian_wheezy_backports').with(
:location => 'http://archive.gplhost.com/debian', :location => 'http://archive.gplhost.com/debian',
:release => 'kilo-backports', :release => 'kilo-backports',
:repos => 'main' :repos => 'main'
)} )}
it { should contain_exec('installing gplhost-archive-keyring') } it { is_expected.to contain_exec('installing gplhost-archive-keyring') }
end end
describe 'with overridden release' do describe 'with overridden release' do
@ -54,19 +54,19 @@ describe 'openstack_extras::repo::debian::debian' do
default_params.merge!({ :release => 'juno' }) default_params.merge!({ :release => 'juno' })
end end
it { should contain_apt__source('debian_wheezy').with( it { is_expected.to contain_apt__source('debian_wheezy').with(
:location => 'http://archive.gplhost.com/debian', :location => 'http://archive.gplhost.com/debian',
:release => 'juno', :release => 'juno',
:repos => 'main', :repos => 'main',
)} )}
it { should contain_apt__source('debian_wheezy_backports').with( it { is_expected.to contain_apt__source('debian_wheezy_backports').with(
:location => 'http://archive.gplhost.com/debian', :location => 'http://archive.gplhost.com/debian',
:release => 'juno-backports', :release => 'juno-backports',
:repos => 'main' :repos => 'main'
)} )}
it { should contain_exec('installing gplhost-archive-keyring') } it { is_expected.to contain_exec('installing gplhost-archive-keyring') }
end end
describe 'when not managing wheezy repo' do describe 'when not managing wheezy repo' do
@ -74,7 +74,7 @@ describe 'openstack_extras::repo::debian::debian' do
default_params.merge!({ :manage_whz => false }) default_params.merge!({ :manage_whz => false })
end end
it { should_not contain_exec('installing gplhost-archive-keyring') } it { is_expected.to_not contain_exec('installing gplhost-archive-keyring') }
end end
describe 'with overridden source hash' do describe 'with overridden source hash' do
@ -96,13 +96,13 @@ describe 'openstack_extras::repo::debian::debian' do
}) })
end end
it { should contain_apt__source('debian_unstable').with( it { is_expected.to contain_apt__source('debian_unstable').with(
:location => 'http://mymirror/debian/', :location => 'http://mymirror/debian/',
:release => 'unstable', :release => 'unstable',
:repos => 'main' :repos => 'main'
)} )}
it { should contain_apt__source('puppetlabs').with( it { is_expected.to contain_apt__source('puppetlabs').with(
:location => 'http://apt.puppetlabs.com', :location => 'http://apt.puppetlabs.com',
:repos => 'main', :repos => 'main',
:release => 'wheezy', :release => 'wheezy',
@ -110,7 +110,7 @@ describe 'openstack_extras::repo::debian::debian' do
:key_server => 'pgp.mit.edu' :key_server => 'pgp.mit.edu'
)} )}
it { should contain_exec('installing gplhost-archive-keyring') } it { is_expected.to contain_exec('installing gplhost-archive-keyring') }
end end
describe 'with overridden source default' do describe 'with overridden source default' do
@ -129,14 +129,14 @@ describe 'openstack_extras::repo::debian::debian' do
}) })
end end
it { should contain_apt__source('debian_unstable').with( it { is_expected.to contain_apt__source('debian_unstable').with(
:location => 'http://mymirror/debian/', :location => 'http://mymirror/debian/',
:release => 'unstable', :release => 'unstable',
:repos => 'main', :repos => 'main',
:include_src => 'true' :include_src => 'true'
)} )}
it { should contain_exec('installing gplhost-archive-keyring') } it { is_expected.to contain_exec('installing gplhost-archive-keyring') }
end end
end end
end end

View File

@ -35,13 +35,13 @@ describe 'openstack_extras::repo::debian::ubuntu' do
{}.merge!(default_params) {}.merge!(default_params)
end end
it { should contain_apt__source('ubuntu-cloud-archive').with( it { is_expected.to contain_apt__source('ubuntu-cloud-archive').with(
:location => 'http://ubuntu-cloud.archive.canonical.com/ubuntu', :location => 'http://ubuntu-cloud.archive.canonical.com/ubuntu',
:release => 'trusty-updates/kilo', :release => 'trusty-updates/kilo',
:repos => 'main', :repos => 'main',
)} )}
it { should contain_exec('installing ubuntu-cloud-keyring') } it { is_expected.to contain_exec('installing ubuntu-cloud-keyring') }
end end
@ -50,13 +50,13 @@ describe 'openstack_extras::repo::debian::ubuntu' do
default_params.merge!({ :release => 'juno' }) default_params.merge!({ :release => 'juno' })
end end
it { should contain_apt__source('ubuntu-cloud-archive').with( it { is_expected.to contain_apt__source('ubuntu-cloud-archive').with(
:location => 'http://ubuntu-cloud.archive.canonical.com/ubuntu', :location => 'http://ubuntu-cloud.archive.canonical.com/ubuntu',
:release => 'trusty-updates/juno', :release => 'trusty-updates/juno',
:repos => 'main', :repos => 'main',
)} )}
it { should contain_exec('installing ubuntu-cloud-keyring') } it { is_expected.to contain_exec('installing ubuntu-cloud-keyring') }
end end
describe 'when not managing UCA' do describe 'when not managing UCA' do
@ -64,7 +64,7 @@ describe 'openstack_extras::repo::debian::ubuntu' do
default_params.merge!({ :manage_uca => false }) default_params.merge!({ :manage_uca => false })
end end
it { should_not contain_exec('installing ubuntu-cloud-keyring') } it { is_expected.to_not contain_exec('installing ubuntu-cloud-keyring') }
end end
describe 'with overridden source hash' do describe 'with overridden source hash' do
@ -86,13 +86,13 @@ describe 'openstack_extras::repo::debian::ubuntu' do
}) })
end end
it { should contain_apt__source('local_mirror').with( it { is_expected.to contain_apt__source('local_mirror').with(
:location => 'http://mymirror/ubuntu/', :location => 'http://mymirror/ubuntu/',
:release => 'trusty', :release => 'trusty',
:repos => 'main' :repos => 'main'
)} )}
it { should contain_apt__source('puppetlabs').with( it { is_expected.to contain_apt__source('puppetlabs').with(
:location => 'http://apt.puppetlabs.com', :location => 'http://apt.puppetlabs.com',
:release => 'trusty', :release => 'trusty',
:repos => 'main', :repos => 'main',
@ -100,7 +100,7 @@ describe 'openstack_extras::repo::debian::ubuntu' do
:key_server => 'pgp.mit.edu' :key_server => 'pgp.mit.edu'
)} )}
it { should contain_exec('installing ubuntu-cloud-keyring') } it { is_expected.to contain_exec('installing ubuntu-cloud-keyring') }
end end
describe 'with overridden source default' do describe 'with overridden source default' do
@ -119,14 +119,14 @@ describe 'openstack_extras::repo::debian::ubuntu' do
}) })
end end
it { should contain_apt__source('local_mirror').with( it { is_expected.to contain_apt__source('local_mirror').with(
:include_src => 'true', :include_src => 'true',
:location => 'http://mymirror/ubuntu/', :location => 'http://mymirror/ubuntu/',
:release => 'trusty', :release => 'trusty',
:repos => 'main', :repos => 'main',
)} )}
it { should contain_exec('installing ubuntu-cloud-keyring') } it { is_expected.to contain_exec('installing ubuntu-cloud-keyring') }
end end
describe 'with overridden uca repo name' do describe 'with overridden uca repo name' do
@ -134,7 +134,7 @@ describe 'openstack_extras::repo::debian::ubuntu' do
default_params.merge!({ :repo => 'proposed' }) default_params.merge!({ :repo => 'proposed' })
end end
it { should contain_apt__source('ubuntu-cloud-archive').with( it { is_expected.to contain_apt__source('ubuntu-cloud-archive').with(
:location => 'http://ubuntu-cloud.archive.canonical.com/ubuntu', :location => 'http://ubuntu-cloud.archive.canonical.com/ubuntu',
:release => 'trusty-proposed/kilo', :release => 'trusty-proposed/kilo',
:repos => 'main', :repos => 'main',

View File

@ -49,7 +49,7 @@ describe 'openstack_extras::repo::redhat::redhat' do
{}.merge!(default_params) {}.merge!(default_params)
end end
it { should contain_yumrepo('rdo-release').with( it { is_expected.to contain_yumrepo('rdo-release').with(
:baseurl => "http://repos.fedorapeople.org/repos/openstack/openstack-kilo/el7/", :baseurl => "http://repos.fedorapeople.org/repos/openstack/openstack-kilo/el7/",
:descr => "OpenStack Kilo Repository", :descr => "OpenStack Kilo Repository",
:priority => 98, :priority => 98,
@ -63,7 +63,7 @@ describe 'openstack_extras::repo::redhat::redhat' do
# 'metalink' property is supported from Puppet 3.5 # 'metalink' property is supported from Puppet 3.5
if Puppet.version.to_f >= 3.5 if Puppet.version.to_f >= 3.5
it { should contain_yumrepo('epel').with( it { is_expected.to contain_yumrepo('epel').with(
:metalink => "https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=\$basearch", :metalink => "https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=\$basearch",
:descr => 'Extra Packages for Enterprise Linux 7 - $basearch', :descr => 'Extra Packages for Enterprise Linux 7 - $basearch',
:gpgkey => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7", :gpgkey => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7",
@ -75,7 +75,7 @@ describe 'openstack_extras::repo::redhat::redhat' do
:notify => "Exec[yum_refresh]" :notify => "Exec[yum_refresh]"
)} )}
else else
it { should contain_yumrepo('epel').with( it { is_expected.to contain_yumrepo('epel').with(
:baseurl => "https://download.fedoraproject.org/pub/epel/7/\$basearch", :baseurl => "https://download.fedoraproject.org/pub/epel/7/\$basearch",
:descr => 'Extra Packages for Enterprise Linux 7 - $basearch', :descr => 'Extra Packages for Enterprise Linux 7 - $basearch',
:gpgkey => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7", :gpgkey => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7",
@ -88,7 +88,7 @@ describe 'openstack_extras::repo::redhat::redhat' do
)} )}
end end
it { should contain_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-RDO-Kilo').with( it { is_expected.to contain_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-RDO-Kilo').with(
:source => "puppet:///modules/openstack_extras/RPM-GPG-KEY-RDO-Kilo", :source => "puppet:///modules/openstack_extras/RPM-GPG-KEY-RDO-Kilo",
:owner => 'root', :owner => 'root',
:group => 'root', :group => 'root',
@ -103,13 +103,13 @@ describe 'openstack_extras::repo::redhat::redhat' do
default_params.merge!({ :release => 'juno' }) default_params.merge!({ :release => 'juno' })
end end
it { should contain_yumrepo('rdo-release').with( it { is_expected.to contain_yumrepo('rdo-release').with(
:baseurl => "http://repos.fedorapeople.org/repos/openstack/openstack-juno/epel-7/", :baseurl => "http://repos.fedorapeople.org/repos/openstack/openstack-juno/epel-7/",
:descr => "OpenStack Juno Repository", :descr => "OpenStack Juno Repository",
:gpgkey => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-RDO-Juno" :gpgkey => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-RDO-Juno"
)} )}
it { should contain_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-RDO-Juno').with( it { is_expected.to contain_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-RDO-Juno').with(
:source => "puppet:///modules/openstack_extras/RPM-GPG-KEY-RDO-Juno" :source => "puppet:///modules/openstack_extras/RPM-GPG-KEY-RDO-Juno"
)} )}
end end
@ -131,7 +131,7 @@ describe 'openstack_extras::repo::redhat::redhat' do
}) })
end end
it { should contain_yumrepo('CentOS-Base').with( it { is_expected.to contain_yumrepo('CentOS-Base').with(
:baseurl => "http://mymirror/$releasever/os/$basearch/", :baseurl => "http://mymirror/$releasever/os/$basearch/",
:descr => "CentOS-$releasever - Base", :descr => "CentOS-$releasever - Base",
:enabled => '1', :enabled => '1',
@ -142,7 +142,7 @@ describe 'openstack_extras::repo::redhat::redhat' do
:notify => "Exec[yum_refresh]" :notify => "Exec[yum_refresh]"
)} )}
it { should contain_yumrepo('CentOS-Updates').with( it { is_expected.to contain_yumrepo('CentOS-Updates').with(
:baseurl => "http://mymirror/$releasever/updates/$basearch/", :baseurl => "http://mymirror/$releasever/updates/$basearch/",
:descr => "CentOS-$releasever - Updates", :descr => "CentOS-$releasever - Updates",
:enabled => '1', :enabled => '1',
@ -163,7 +163,7 @@ describe 'openstack_extras::repo::redhat::redhat' do
}) })
end end
it { should contain_yumrepo('rdo-release').with( it { is_expected.to contain_yumrepo('rdo-release').with(
:baseurl => "http://repos.fedorapeople.org/repos/openstack/openstack-kilo/el7/", :baseurl => "http://repos.fedorapeople.org/repos/openstack/openstack-kilo/el7/",
:descr => "OpenStack Kilo Repository", :descr => "OpenStack Kilo Repository",
:gpgkey => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-RDO-Kilo", :gpgkey => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-RDO-Kilo",
@ -179,7 +179,7 @@ describe 'openstack_extras::repo::redhat::redhat' do
}) })
end end
it { should contain_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-RDO-Kilo').with( it { is_expected.to contain_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-RDO-Kilo').with(
:owner => "steve" :owner => "steve"
)} )}
end end
@ -189,7 +189,7 @@ describe 'openstack_extras::repo::redhat::redhat' do
default_params.merge!({ :manage_epel => false }) default_params.merge!({ :manage_epel => false })
end end
it { should_not contain_yumrepo('epel') } it { is_expected.to_not contain_yumrepo('epel') }
end end
describe 'with rdo management disabled' do describe 'with rdo management disabled' do
@ -197,7 +197,7 @@ describe 'openstack_extras::repo::redhat::redhat' do
default_params.merge!({ :manage_rdo => false }) default_params.merge!({ :manage_rdo => false })
end end
it { should_not contain_yumrepo('rdo-release') } it { is_expected.to_not contain_yumrepo('rdo-release') }
end end
end end
end end

View File

@ -30,18 +30,18 @@ describe 'openstack_extras::pacemaker::service', :type => :define do
context 'with defaults' do context 'with defaults' do
it 'should contain openstack_extras::pacemaker::service definition' do it 'should contain openstack_extras::pacemaker::service definition' do
should contain_openstack_extras__pacemaker__service(title).with(default_params) is_expected.to contain_openstack_extras__pacemaker__service(title).with(default_params)
end end
it 'should override existing service provider' do it 'should override existing service provider' do
should contain_service('foo-api').with( is_expected.to contain_service('foo-api').with(
{ {
:provider => 'pacemaker' :provider => 'pacemaker'
}) })
end end
it 'should create a pacemaker primitive' do it 'should create a pacemaker primitive' do
should contain_cs_primitive('p_foo-api').with( is_expected.to contain_cs_primitive('p_foo-api').with(
{ {
'ensure' => default_params[:ensure], 'ensure' => default_params[:ensure],
'primitive_class' => default_params[:primitive_class], 'primitive_class' => default_params[:primitive_class],
@ -54,7 +54,7 @@ describe 'openstack_extras::pacemaker::service', :type => :define do
}) })
end end
it 'should not create a cloned resource' do it 'should not create a cloned resource' do
should contain_cs_clone('p_foo-api-clone').with( is_expected.to contain_cs_clone('p_foo-api-clone').with(
{ {
'ensure' => 'absent', 'ensure' => 'absent',
}) })
@ -75,7 +75,7 @@ describe 'openstack_extras::pacemaker::service', :type => :define do
let (:ocf_handler_path) { "#{params[:handler_root_path]}/#{ocf_handler_name}" } let (:ocf_handler_path) { "#{params[:handler_root_path]}/#{ocf_handler_name}" }
it 'should create an OCF file' do it 'should create an OCF file' do
should contain_file("#{title}-ocf-file").with( is_expected.to contain_file("#{title}-ocf-file").with(
{ {
'ensure' => 'present', 'ensure' => 'present',
'path' => ocf_script_path, 'path' => ocf_script_path,
@ -87,7 +87,7 @@ describe 'openstack_extras::pacemaker::service', :type => :define do
end end
it 'should create a handler file' do it 'should create a handler file' do
should contain_file("#{ocf_handler_name}").with( is_expected.to contain_file("#{ocf_handler_name}").with(
{ {
'ensure' => 'present', 'ensure' => 'present',
'path' => ocf_handler_path, 'path' => ocf_handler_path,
@ -115,7 +115,7 @@ describe 'openstack_extras::pacemaker::service', :type => :define do
} }
it 'should create an OCF file from template' do it 'should create an OCF file from template' do
should contain_file("#{title}-ocf-file").with( is_expected.to contain_file("#{title}-ocf-file").with(
{ {
'path' => ocf_script_path, 'path' => ocf_script_path,
'mode' => '0755', 'mode' => '0755',
@ -125,11 +125,11 @@ describe 'openstack_extras::pacemaker::service', :type => :define do
end end
it 'should not create a handler file' do it 'should not create a handler file' do
should_not contain_file("#{params[:ocf_handler_name]}") is_expected.to_not contain_file("#{params[:ocf_handler_name]}")
end end
it 'should create a pacemaker primitive' do it 'should create a pacemaker primitive' do
should contain_cs_primitive('p_foo-api').with( is_expected.to contain_cs_primitive('p_foo-api').with(
{ {
'ensure' => params[:ensure], 'ensure' => params[:ensure],
'primitive_class' => params[:primitive_class], 'primitive_class' => params[:primitive_class],
@ -151,7 +151,7 @@ describe 'openstack_extras::pacemaker::service', :type => :define do
}) })
end end
it 'should create a cloned resource' do it 'should create a cloned resource' do
should contain_cs_clone('p_foo-api-clone').with( is_expected.to contain_cs_clone('p_foo-api-clone').with(
{ {
'ensure' => 'present', 'ensure' => 'present',
'primitive' => 'p_foo-api', 'primitive' => 'p_foo-api',