From 4aa993d4355ef7637a1a217db15d6ab1fc3af4ed Mon Sep 17 00:00:00 2001 From: Sebastien Badia Date: Tue, 28 Apr 2015 03:33:03 +0200 Subject: [PATCH] Fix spec tests for RSpec 3.x and Puppet 4.x Rix resource array, according[1]. [1]https://github.com/puppetlabs/puppet/blob/3.7.5/lib/puppet/resource.rb#L446-L453 This patch also update RSpec 3.x matcher in order to remove deprecation warnings (in units). Change-Id: I562072a2169ada204616b86e0033ac4905579ed6 Closes-bug: #1447620 --- spec/classes/trove_keystone_auth_spec.rb | 2 +- spec/unit/provider/trove_config/ini_setting_spec.rb | 8 ++++---- spec/unit/provider/trove_datastore/trove_spec.rb | 4 ++-- spec/unit/provider/trove_datastore_version/trove_spec.rb | 2 +- spec/unit/type/trove_config_spec.rb | 8 ++++---- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/spec/classes/trove_keystone_auth_spec.rb b/spec/classes/trove_keystone_auth_spec.rb index 281fe6ad..312fa61c 100644 --- a/spec/classes/trove_keystone_auth_spec.rb +++ b/spec/classes/trove_keystone_auth_spec.rb @@ -40,7 +40,7 @@ describe 'trove::keystone::auth' do it { is_expected.to contain_keystone_user_role('trove@foobar').with( :ensure => 'present', - :roles => 'admin' + :roles => ['admin'] )} it { is_expected.to contain_keystone_service('trove').with( diff --git a/spec/unit/provider/trove_config/ini_setting_spec.rb b/spec/unit/provider/trove_config/ini_setting_spec.rb index dc18f463..239dc6f5 100644 --- a/spec/unit/provider/trove_config/ini_setting_spec.rb +++ b/spec/unit/provider/trove_config/ini_setting_spec.rb @@ -22,8 +22,8 @@ describe provider_class do {:name => 'DEFAULT/foo', :value => 'bar'} ) provider = provider_class.new(resource) - provider.section.should == 'DEFAULT' - provider.setting.should == 'foo' + expect(provider.section).to eq('DEFAULT') + expect(provider.setting).to eq('foo') end it 'should allow setting to be set explicitly' do @@ -31,7 +31,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 diff --git a/spec/unit/provider/trove_datastore/trove_spec.rb b/spec/unit/provider/trove_datastore/trove_spec.rb index 3c059057..8fff66f5 100644 --- a/spec/unit/provider/trove_datastore/trove_spec.rb +++ b/spec/unit/provider/trove_datastore/trove_spec.rb @@ -30,12 +30,12 @@ describe provider_class do describe "self.instances" do it "should have an instances method" do - provider.class.should respond_to(:instances) + expect(provider.class).to respond_to(:instances) end it "should list instances" do datastores = described_class.instances - datastores.size.should == 1 + expect(datastores.size).to eq(1) datastores.map {|provider| provider.name} == datastore_name end end diff --git a/spec/unit/provider/trove_datastore_version/trove_spec.rb b/spec/unit/provider/trove_datastore_version/trove_spec.rb index 3a2c6c29..cce3720f 100644 --- a/spec/unit/provider/trove_datastore_version/trove_spec.rb +++ b/spec/unit/provider/trove_datastore_version/trove_spec.rb @@ -32,7 +32,7 @@ describe provider_class do describe "self.instances" do it "should have an instances method" do - provider.class.should respond_to(:instances) + expect(provider.class).to respond_to(:instances) end end diff --git a/spec/unit/type/trove_config_spec.rb b/spec/unit/type/trove_config_spec.rb index 71feea7c..486d5176 100644 --- a/spec/unit/type/trove_config_spec.rb +++ b/spec/unit/type/trove_config_spec.rb @@ -29,19 +29,19 @@ describe 'Puppet::Type.type(:trove_config)' do it 'should accept a valid value' do @trove_config[:value] = 'bar' - @trove_config[:value].should == 'bar' + expect(@trove_config[:value]).to eq('bar') end it 'should not accept a value with whitespace' do @trove_config[:value] = 'b ar' - @trove_config[:value].should == 'b ar' + expect(@trove_config[:value]).to eq('b ar') end it 'should accept valid ensure values' do @trove_config[:ensure] = :present - @trove_config[:ensure].should == :present + expect(@trove_config[:ensure]).to eq(:present) @trove_config[:ensure] = :absent - @trove_config[:ensure].should == :absent + expect(@trove_config[:ensure]).to eq(:absent) end it 'should not accept invalid ensure values' do