Fix rspec 3.x syntax

- Convert 'should' keyword to 'is_expected.to'
- The old ':should' syntax in rspec 3.x is deprecated in favor of
  ':expect' syntax.
- Operator matchers:
  '1.should == 1' into 'expect(1).to eq(1)'

Change-Id: I84b993065a00f5b5c55bd6834c6d54bc57c249e0
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
This commit is contained in:
Gael Chamoulaud 2015-07-20 15:57:55 +02:00
parent 7cd0ca3ba1
commit 1896040791
5 changed files with 8 additions and 8 deletions

View File

@ -129,7 +129,7 @@ describe 'basic keystone server with resources' do
end
describe cron do
it { should have_entry('1 0 * * * keystone-manage token_flush >>/var/log/keystone/keystone-tokenflush.log 2>&1').with_user('keystone') }
it { is_expected.to have_entry('1 0 * * * keystone-manage token_flush >>/var/log/keystone/keystone-tokenflush.log 2>&1').with_user('keystone') }
end
shared_examples_for 'keystone user/tenant/service/role/endpoint resources using v2 API' do |auth_creds|

View File

@ -135,7 +135,7 @@ describe 'keystone server running with Apache/WSGI with resources' do
end
describe cron do
it { should have_entry('1 0 * * * keystone-manage token_flush >>/var/log/keystone/keystone-tokenflush.log 2>&1').with_user('keystone') }
it { is_expected.to have_entry('1 0 * * * keystone-manage token_flush >>/var/log/keystone/keystone-tokenflush.log 2>&1').with_user('keystone') }
end
shared_examples_for 'keystone user/tenant/service/role/endpoint resources using v2 API' do |auth_creds|

View File

@ -180,7 +180,7 @@ describe 'keystone' do
end
it 'should contain correct revoke driver' do
should contain_keystone_config('revoke/driver').with_value(param_hash['revoke_driver'])
is_expected.to contain_keystone_config('revoke/driver').with_value(param_hash['revoke_driver'])
end
it 'should ensure proper setting of admin_endpoint and public_endpoint' do
@ -261,11 +261,11 @@ describe 'keystone' do
it do
expect {
should contain_service(platform_parameters[:service_name]).with('ensure' => 'running')
is_expected.to contain_service(platform_parameters[:service_name]).with('ensure' => 'running')
}.to raise_error(RSpec::Expectations::ExpectationNotMetError, /expected that the catalogue would contain Service\[#{platform_parameters[:service_name]}\]/)
end
it { should contain_class('keystone::service').with(
it { is_expected.to contain_class('keystone::service').with(
'ensure' => 'stopped',
'service_name' => platform_parameters[:service_name],
'enable' => false,

View File

@ -23,7 +23,7 @@ describe provider_class do
{:name => 'dude/foo', :value => 'bar'}
)
provider = provider_class.new(resource)
provider.section.should == 'dude'
provider.setting.should == 'foo'
expect(provider.section).to eq('dude')
expect(provider.setting).to eq('foo')
end
end

View File

@ -18,6 +18,6 @@ describe 'Puppet::Type.type(:keystone_paste_ini)' do
end
it 'should accept a valid value' do
@keystone_paste_ini[:value] = 'bar'
@keystone_paste_ini[:value].should == 'bar'
expect(@keystone_paste_ini[:value]).to eq('bar')
end
end