Fix rspec 3.x oneliner deprecation

* Convert 'should' keyword to 'is_expected.to' (prepare rspec 3.x) *

Change-Id: I06ca2322319f3a8bce92764e964e9fd5b6c0fd51
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
This commit is contained in:
Gael Chamoulaud 2015-03-20 10:55:25 +01:00
parent bbcbae45fc
commit 4bce7b46ef
13 changed files with 77 additions and 77 deletions

View File

@ -13,25 +13,25 @@ describe 'designate::agent' do
shared_examples 'designate-agent' do shared_examples 'designate-agent' do
context 'with default parameters' do context 'with default parameters' do
it 'installs designate-agent package and service' do it 'installs designate-agent package and service' do
should contain_service('designate-agent').with( is_expected.to contain_service('designate-agent').with(
:name => platform_params[:agent_service_name], :name => platform_params[:agent_service_name],
:ensure => 'running', :ensure => 'running',
:enable => 'true' :enable => 'true'
) )
should contain_package('designate-agent').with( is_expected.to contain_package('designate-agent').with(
:name => platform_params[:agent_package_name], :name => platform_params[:agent_package_name],
:ensure => 'present' :ensure => 'present'
) )
end end
it 'configures designate-agent with default parameters' do it 'configures designate-agent with default parameters' do
should contain_designate_config('service:agent/backend_driver').with_value('bind9') is_expected.to contain_designate_config('service:agent/backend_driver').with_value('bind9')
end end
context 'when using Power DNS backend driver' do context 'when using Power DNS backend driver' do
before { params.merge!(:backend_driver => 'powerdns') } before { params.merge!(:backend_driver => 'powerdns') }
it 'configures designate-agent with pdns backend' do it 'configures designate-agent with pdns backend' do
should contain_designate_config('service:agent/backend_driver').with_value('powerdns') is_expected.to contain_designate_config('service:agent/backend_driver').with_value('powerdns')
end end
end end
end end

View File

@ -18,36 +18,36 @@ describe 'designate::api' do
shared_examples 'designate-api' do shared_examples 'designate-api' do
context 'with default parameters' do context 'with default parameters' do
it 'installs designate-api package and service' do it 'installs designate-api package and service' do
should contain_service('designate-api').with( is_expected.to contain_service('designate-api').with(
:name => platform_params[:api_service_name], :name => platform_params[:api_service_name],
:ensure => 'running', :ensure => 'running',
:require => 'Class[Designate::Db]', :require => 'Class[Designate::Db]',
:enable => 'true', :enable => 'true',
:subscribe => 'Exec[designate-dbsync]' :subscribe => 'Exec[designate-dbsync]'
) )
should contain_package('designate-api').with( is_expected.to contain_package('designate-api').with(
:name => platform_params[:api_package_name], :name => platform_params[:api_package_name],
:ensure => 'present' :ensure => 'present'
) )
end end
it 'configures designate-api with default parameters' do it 'configures designate-api with default parameters' do
should contain_designate_config('service:api/auth_strategy').with_value('noauth') is_expected.to contain_designate_config('service:api/auth_strategy').with_value('noauth')
should contain_designate_config('service:api/enable_api_v1').with_value(true) is_expected.to contain_designate_config('service:api/enable_api_v1').with_value(true)
should contain_designate_config('keystone_authtoken/auth_host').with_value('10.0.0.42') is_expected.to contain_designate_config('keystone_authtoken/auth_host').with_value('10.0.0.42')
should contain_designate_config('keystone_authtoken/auth_port').with_value('35357') is_expected.to contain_designate_config('keystone_authtoken/auth_port').with_value('35357')
should contain_designate_config('keystone_authtoken/auth_protocol').with_value('https') is_expected.to contain_designate_config('keystone_authtoken/auth_protocol').with_value('https')
should contain_designate_config('keystone_authtoken/admin_tenant_name').with_value('_services_') is_expected.to contain_designate_config('keystone_authtoken/admin_tenant_name').with_value('_services_')
should contain_designate_config('keystone_authtoken/admin_user').with_value('designate') is_expected.to contain_designate_config('keystone_authtoken/admin_user').with_value('designate')
should contain_designate_config('keystone_authtoken/admin_password').with_value('passw0rd') is_expected.to contain_designate_config('keystone_authtoken/admin_password').with_value('passw0rd')
end end
context 'when using auth against keystone' do context 'when using auth against keystone' do
before { params.merge!(:auth_strategy => 'keystone') } before { params.merge!(:auth_strategy => 'keystone') }
it 'configures designate-api with keystone auth strategy' do it 'configures designate-api with keystone auth strategy' do
should contain_designate_config('service:api/auth_strategy').with_value('keystone') is_expected.to contain_designate_config('service:api/auth_strategy').with_value('keystone')
end end
end end
end end

View File

@ -11,11 +11,11 @@ describe 'designate::backend::bind9' do
context 'with default params' do context 'with default params' do
it 'configures designate backend bind9 with default parameters' do it 'configures designate backend bind9 with default parameters' do
should contain_designate_config('backend:bind9/rndc_host').with_value('127.0.0.1') is_expected.to contain_designate_config('backend:bind9/rndc_host').with_value('127.0.0.1')
should contain_designate_config('backend:bind9/rndc_port').with_value('953') is_expected.to contain_designate_config('backend:bind9/rndc_port').with_value('953')
should contain_designate_config('backend:bind9/rndc_config_file').with_value('/etc/rndc.conf') is_expected.to contain_designate_config('backend:bind9/rndc_config_file').with_value('/etc/rndc.conf')
should contain_designate_config('backend:bind9/rndc_key_file').with_value('/etc/rndc.key') is_expected.to contain_designate_config('backend:bind9/rndc_key_file').with_value('/etc/rndc.key')
should contain_file_line('dns allow-new-zones') is_expected.to contain_file_line('dns allow-new-zones')
end end
end end
@ -25,7 +25,7 @@ describe 'designate::backend::bind9' do
end end
it 'configures designate bind9 backend with custom rndc_config_file' do it 'configures designate bind9 backend with custom rndc_config_file' do
should contain_designate_config('backend:bind9/rndc_config_file').with_value(params[:rndc_config_file]) is_expected.to contain_designate_config('backend:bind9/rndc_config_file').with_value(params[:rndc_config_file])
end end
end end
@ -38,8 +38,8 @@ describe 'designate::backend::bind9' do
end end
it 'configures designate bind9 backend with custom rndc_port and rndc_host' do it 'configures designate bind9 backend with custom rndc_port and rndc_host' do
should contain_designate_config('backend:bind9/rndc_port').with_value(params[:rndc_port]) is_expected.to contain_designate_config('backend:bind9/rndc_port').with_value(params[:rndc_port])
should contain_designate_config('backend:bind9/rndc_host').with_value(params[:rndc_host]) is_expected.to contain_designate_config('backend:bind9/rndc_host').with_value(params[:rndc_host])
end end
end end

View File

@ -13,25 +13,25 @@ describe 'designate::central' do
shared_examples 'designate-central' do shared_examples 'designate-central' do
context 'with default parameters' do context 'with default parameters' do
it 'installs designate-central package and service' do it 'installs designate-central package and service' do
should contain_service('designate-central').with( is_expected.to contain_service('designate-central').with(
:name => platform_params[:central_service_name], :name => platform_params[:central_service_name],
:ensure => 'running', :ensure => 'running',
:enable => 'true' :enable => 'true'
) )
should contain_package('designate-central').with( is_expected.to contain_package('designate-central').with(
:name => platform_params[:central_package_name], :name => platform_params[:central_package_name],
:ensure => 'present' :ensure => 'present'
) )
end end
it 'configures designate-central with default parameters' do it 'configures designate-central with default parameters' do
should contain_designate_config('service:central/backend_driver').with_value('bind9') is_expected.to contain_designate_config('service:central/backend_driver').with_value('bind9')
end end
context 'when using Power DNS backend driver' do context 'when using Power DNS backend driver' do
before { params.merge!(:backend_driver => 'powerdns') } before { params.merge!(:backend_driver => 'powerdns') }
it 'configures designate-central with pdns backend' do it 'configures designate-central with pdns backend' do
should contain_designate_config('service:central/backend_driver').with_value('powerdns') is_expected.to contain_designate_config('service:central/backend_driver').with_value('powerdns')
end end
end end
end end

View File

@ -7,10 +7,10 @@ describe 'designate::client' do
shared_examples 'designate-client' do shared_examples 'designate-client' do
it { should contain_class('designate::params') } it { is_expected.to contain_class('designate::params') }
it 'installs designate client package' do it 'installs designate client package' do
should contain_package('python-designateclient').with( is_expected.to contain_package('python-designateclient').with(
:ensure => 'present', :ensure => 'present',
:name => platform_params[:client_package_name] :name => platform_params[:client_package_name]
) )

View File

@ -17,14 +17,14 @@ describe 'designate::config' do
end end
it 'configures arbitrary designate configurations' do it 'configures arbitrary designate configurations' do
should contain_designate_config('DEFAULT/foo').with_value('fooValue') is_expected.to contain_designate_config('DEFAULT/foo').with_value('fooValue')
should contain_designate_config('DEFAULT/bar').with_value('barValue') is_expected.to contain_designate_config('DEFAULT/bar').with_value('barValue')
should contain_designate_config('DEFAULT/baz').with_ensure('absent') is_expected.to contain_designate_config('DEFAULT/baz').with_ensure('absent')
end end
it 'configures arbitrary designate api-paste configurations' do it 'configures arbitrary designate api-paste configurations' do
should contain_designate_api_paste_ini('DEFAULT/foo2').with_value('fooValue') is_expected.to contain_designate_api_paste_ini('DEFAULT/foo2').with_value('fooValue')
should contain_designate_api_paste_ini('DEFAULT/bar2').with_value('barValue') is_expected.to contain_designate_api_paste_ini('DEFAULT/bar2').with_value('barValue')
should contain_designate_api_paste_ini('DEFAULT/baz2').with_ensure('absent') is_expected.to contain_designate_api_paste_ini('DEFAULT/baz2').with_ensure('absent')
end end
end end

View File

@ -20,7 +20,7 @@ describe 'designate::db::mysql' do
required_params required_params
end end
it { should contain_openstacklib__db__mysql('designate').with( it { is_expected.to contain_openstacklib__db__mysql('designate').with(
:user => 'designate', :user => 'designate',
:password_hash => '*AA1420F182E88B9E5F874F6FBE7459291E8F4601', :password_hash => '*AA1420F182E88B9E5F874F6FBE7459291E8F4601',
:charset => 'utf8' :charset => 'utf8'
@ -32,7 +32,7 @@ describe 'designate::db::mysql' do
{ :charset => 'latin1' }.merge(required_params) { :charset => 'latin1' }.merge(required_params)
end end
it { should contain_openstacklib__db__mysql('designate').with_charset(params[:charset]) } it { is_expected.to contain_openstacklib__db__mysql('designate').with_charset(params[:charset]) }
end end
end end
@ -46,7 +46,7 @@ describe 'designate::db::mysql' do
required_params required_params
end end
it { should contain_openstacklib__db__mysql('designate').with( it { is_expected.to contain_openstacklib__db__mysql('designate').with(
:user => 'designate', :user => 'designate',
:password_hash => '*AA1420F182E88B9E5F874F6FBE7459291E8F4601', :password_hash => '*AA1420F182E88B9E5F874F6FBE7459291E8F4601',
:charset => 'utf8' :charset => 'utf8'
@ -58,7 +58,7 @@ describe 'designate::db::mysql' do
{ :charset => 'latin1' }.merge(required_params) { :charset => 'latin1' }.merge(required_params)
end end
it { should contain_openstacklib__db__mysql('designate').with_charset(params[:charset]) } it { is_expected.to contain_openstacklib__db__mysql('designate').with_charset(params[:charset]) }
end end
end end

View File

@ -9,10 +9,10 @@ describe 'designate::db' do
context 'with default params' do context 'with default params' do
it 'configures designate db with default parameters' do it 'configures designate db with default parameters' do
should contain_designate_config('storage:sqlalchemy/connection').with_value('mysql://designate:designate@localhost/designate') is_expected.to contain_designate_config('storage:sqlalchemy/connection').with_value('mysql://designate:designate@localhost/designate')
should contain_class('mysql::bindings') is_expected.to contain_class('mysql::bindings')
should contain_class('mysql::bindings::python') is_expected.to contain_class('mysql::bindings::python')
should contain_exec('designate-dbsync') is_expected.to contain_exec('designate-dbsync')
end end
end end

View File

@ -8,11 +8,11 @@ describe 'designate::dns' do
shared_examples 'designate-dns' do shared_examples 'designate-dns' do
it 'configures designate configuration folder' do it 'configures designate configuration folder' do
should contain_file(params[:designatepath]).with(:ensure => 'directory') is_expected.to contain_file(params[:designatepath]).with(:ensure => 'directory')
end end
it 'configures designate configuration file' do it 'configures designate configuration file' do
should contain_file(params[:designatefile]) is_expected.to contain_file(params[:designatefile])
end end
end end

View File

@ -35,10 +35,10 @@ describe 'designate' do
shared_examples_for 'a designate base installation' do shared_examples_for 'a designate base installation' do
it { should contain_class('designate::params') } it { is_expected.to contain_class('designate::params') }
it 'configures designate group' do it 'configures designate group' do
should contain_group('designate').with( is_expected.to contain_group('designate').with(
:ensure => 'present', :ensure => 'present',
:name => 'designate', :name => 'designate',
:require => 'Package[designate-common]', :require => 'Package[designate-common]',
@ -46,7 +46,7 @@ describe 'designate' do
end end
it 'configures designate user' do it 'configures designate user' do
should contain_user('designate').with( is_expected.to contain_user('designate').with(
:ensure => 'present', :ensure => 'present',
:name => 'designate', :name => 'designate',
:gid => 'designate', :gid => 'designate',
@ -55,7 +55,7 @@ describe 'designate' do
end end
it 'configures designate configuration folder' do it 'configures designate configuration folder' do
should contain_file('/etc/designate/').with( is_expected.to contain_file('/etc/designate/').with(
:ensure => 'directory', :ensure => 'directory',
:owner => 'designate', :owner => 'designate',
:group => 'designate', :group => 'designate',
@ -64,7 +64,7 @@ describe 'designate' do
end end
it 'configures designate configuration file' do it 'configures designate configuration file' do
should contain_file('/etc/designate/designate.conf').with( is_expected.to contain_file('/etc/designate/designate.conf').with(
:owner => 'designate', :owner => 'designate',
:group => 'designate', :group => 'designate',
:mode => '0640' :mode => '0640'
@ -72,16 +72,16 @@ describe 'designate' do
end end
it 'installs designate common package' do it 'installs designate common package' do
should contain_package('designate-common').with( is_expected.to contain_package('designate-common').with(
:ensure => 'installed', :ensure => 'installed',
:name => platform_params[:common_package_name] :name => platform_params[:common_package_name]
) )
end end
it 'configures debug and verbosity' do it 'configures debug and verbosity' do
should contain_designate_config('DEFAULT/debug').with_value( params[:debug] ) is_expected.to contain_designate_config('DEFAULT/debug').with_value( params[:debug] )
should contain_designate_config('DEFAULT/verbose').with_value( params[:verbose] ) is_expected.to contain_designate_config('DEFAULT/verbose').with_value( params[:verbose] )
should contain_designate_config('DEFAULT/root_helper').with_value( params[:root_helper] ) is_expected.to contain_designate_config('DEFAULT/root_helper').with_value( params[:root_helper] )
end end
end end
@ -89,14 +89,14 @@ describe 'designate' do
shared_examples_for 'rabbit without HA support' do shared_examples_for 'rabbit without HA support' do
it 'configures rabbit' do it 'configures rabbit' do
should contain_designate_config('DEFAULT/rabbit_userid').with_value( params[:rabbit_userid] ) is_expected.to contain_designate_config('DEFAULT/rabbit_userid').with_value( params[:rabbit_userid] )
should contain_designate_config('DEFAULT/rabbit_password').with_value( params[:rabbit_password] ) is_expected.to contain_designate_config('DEFAULT/rabbit_password').with_value( params[:rabbit_password] )
should contain_designate_config('DEFAULT/rabbit_password').with_value( params[:rabbit_password] ).with_secret(true) is_expected.to contain_designate_config('DEFAULT/rabbit_password').with_value( params[:rabbit_password] ).with_secret(true)
should contain_designate_config('DEFAULT/rabbit_virtualhost').with_value( params[:rabbit_virtualhost] ) is_expected.to contain_designate_config('DEFAULT/rabbit_virtualhost').with_value( params[:rabbit_virtualhost] )
end end
it { should contain_designate_config('DEFAULT/rabbit_host').with_value( params[:rabbit_host] ) } it { is_expected.to contain_designate_config('DEFAULT/rabbit_host').with_value( params[:rabbit_host] ) }
it { should contain_designate_config('DEFAULT/rabbit_port').with_value( params[:rabbit_port] ) } it { is_expected.to contain_designate_config('DEFAULT/rabbit_port').with_value( params[:rabbit_port] ) }
end end

View File

@ -15,24 +15,24 @@ describe 'designate::keystone::auth' do
:tenant => 'fooboozoo' } :tenant => 'fooboozoo' }
end end
it { should contain_keystone_user('designate').with( it { is_expected.to contain_keystone_user('designate').with(
:ensure => 'present', :ensure => 'present',
:password => 'desigpwd', :password => 'desigpwd',
:tenant => 'fooboozoo' :tenant => 'fooboozoo'
) } ) }
it { should contain_keystone_user_role('designate@fooboozoo').with( it { is_expected.to contain_keystone_user_role('designate@fooboozoo').with(
:ensure => 'present', :ensure => 'present',
:roles => 'admin' :roles => 'admin'
)} )}
it { should contain_keystone_service('designate').with( it { is_expected.to contain_keystone_service('designate').with(
:ensure => 'present', :ensure => 'present',
:type => 'dns', :type => 'dns',
:description => 'Openstack DNSaas Service' :description => 'Openstack DNSaas Service'
) } ) }
it { should contain_keystone_endpoint('RegionOne/designate').with( it { is_expected.to contain_keystone_endpoint('RegionOne/designate').with(
:ensure => 'present', :ensure => 'present',
:public_url => "http://127.0.0.1:9001/v1", :public_url => "http://127.0.0.1:9001/v1",
:admin_url => "http://127.0.0.1:9001/v1", :admin_url => "http://127.0.0.1:9001/v1",
@ -61,7 +61,7 @@ describe 'designate::keystone::auth' do
:admin_address => '10.10.10.12' } :admin_address => '10.10.10.12' }
end end
it { should contain_keystone_endpoint('RegionOne/designate').with( it { is_expected.to contain_keystone_endpoint('RegionOne/designate').with(
:ensure => 'present', :ensure => 'present',
:public_url => "https://10.10.10.10:81/v1", :public_url => "https://10.10.10.10:81/v1",
:internal_url => "http://10.10.10.11:81/v1", :internal_url => "http://10.10.10.11:81/v1",
@ -75,9 +75,9 @@ describe 'designate::keystone::auth' do
:auth_name => 'designate1' } :auth_name => 'designate1' }
end end
it { should contain_keystone_user('designate1') } it { is_expected.to contain_keystone_user('designate1') }
it { should contain_keystone_user_role('designate1@services') } it { is_expected.to contain_keystone_user_role('designate1@services') }
it { should contain_keystone_service('designate1') } it { is_expected.to contain_keystone_service('designate1') }
it { should contain_keystone_endpoint('RegionOne/designate1') } it { is_expected.to contain_keystone_endpoint('RegionOne/designate1') }
end end
end end

View File

@ -13,12 +13,12 @@ describe 'designate::sink' do
shared_examples 'designate-sink' do shared_examples 'designate-sink' do
context 'with default parameters' do context 'with default parameters' do
it 'installs designate-sink package and service' do it 'installs designate-sink package and service' do
should contain_service('designate-sink').with( is_expected.to contain_service('designate-sink').with(
:name => platform_params[:sink_service_name], :name => platform_params[:sink_service_name],
:ensure => 'running', :ensure => 'running',
:enable => 'true' :enable => 'true'
) )
should contain_package('designate-sink').with( is_expected.to contain_package('designate-sink').with(
:name => platform_params[:sink_package_name], :name => platform_params[:sink_package_name],
:ensure => 'present' :ensure => 'present'
) )

View File

@ -1,6 +1,6 @@
shared_examples_for "a Puppet::Error" do |description| shared_examples_for "a Puppet::Error" do |description|
it "with message matching #{description.inspect}" do it "with message matching #{description.inspect}" do
expect { should have_class_count(1) }.to raise_error(Puppet::Error, description) expect { is_expected.to have_class_count(1) }.to raise_error(Puppet::Error, description)
end end
end end
@ -8,12 +8,12 @@ shared_examples 'generic designate service' do |service|
context 'with default parameters' do context 'with default parameters' do
it 'installs package and service' do it 'installs package and service' do
should contain_package(service[:name]).with({ is_expected.to contain_package(service[:name]).with({
:name => service[:package_name], :name => service[:package_name],
:ensure => 'present', :ensure => 'present',
:notify => "Service[#{service[:name]}]" :notify => "Service[#{service[:name]}]"
}) })
should contain_service(service[:name]).with({ is_expected.to contain_service(service[:name]).with({
:name => service[:service_name], :name => service[:service_name],
:ensure => 'stopped', :ensure => 'stopped',
:hasstatus => true, :hasstatus => true,
@ -29,12 +29,12 @@ shared_examples 'generic designate service' do |service|
end end
it 'installs package and service' do it 'installs package and service' do
should contain_package(service[:name]).with({ is_expected.to contain_package(service[:name]).with({
:name => service[:package_name], :name => service[:package_name],
:ensure => '2014.2-1', :ensure => '2014.2-1',
:notify => "Service[#{service[:name]}]" :notify => "Service[#{service[:name]}]"
}) })
should contain_service(service[:name]).with({ is_expected.to contain_service(service[:name]).with({
:name => service[:service_name], :name => service[:service_name],
:ensure => 'running', :ensure => 'running',
:hasstatus => true, :hasstatus => true,
@ -50,7 +50,7 @@ shared_examples 'generic designate service' do |service|
end end
it 'does not control service state' do it 'does not control service state' do
should contain_service(service[:name]).without_ensure is_expected.to contain_service(service[:name]).without_ensure
end end
end end
end end