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
context 'with default parameters' 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],
:ensure => 'running',
:enable => 'true'
)
should contain_package('designate-agent').with(
is_expected.to contain_package('designate-agent').with(
:name => platform_params[:agent_package_name],
:ensure => 'present'
)
end
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
context 'when using Power DNS backend driver' do
before { params.merge!(:backend_driver => 'powerdns') }
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

View File

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

View File

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

View File

@ -13,25 +13,25 @@ describe 'designate::central' do
shared_examples 'designate-central' do
context 'with default parameters' 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],
:ensure => 'running',
:enable => 'true'
)
should contain_package('designate-central').with(
is_expected.to contain_package('designate-central').with(
:name => platform_params[:central_package_name],
:ensure => 'present'
)
end
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
context 'when using Power DNS backend driver' do
before { params.merge!(:backend_driver => 'powerdns') }
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

View File

@ -7,10 +7,10 @@ describe '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
should contain_package('python-designateclient').with(
is_expected.to contain_package('python-designateclient').with(
:ensure => 'present',
:name => platform_params[:client_package_name]
)

View File

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

View File

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

View File

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

View File

@ -8,11 +8,11 @@ describe 'designate::dns' do
shared_examples 'designate-dns' 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
it 'configures designate configuration file' do
should contain_file(params[:designatefile])
is_expected.to contain_file(params[:designatefile])
end
end

View File

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

View File

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

View File

@ -13,12 +13,12 @@ describe 'designate::sink' do
shared_examples 'designate-sink' do
context 'with default parameters' 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],
:ensure => 'running',
:enable => 'true'
)
should contain_package('designate-sink').with(
is_expected.to contain_package('designate-sink').with(
:name => platform_params[:sink_package_name],
:ensure => 'present'
)

View File

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