# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.
-# Offense count: 1
-# This cop supports unsafe autocorrection (--autocorrect-all).
-Lint/BooleanSymbol:
- Exclude:
- - 'spec/unit/puppet/type/apt_key_spec.rb'
-
# Offense count: 3
# Configuration parameters: AllowedMethods.
# AllowedMethods: enums
Exclude:
- 'spec/classes/apt_update_spec.rb'
-# Offense count: 6
-# This cop supports unsafe autocorrection (--autocorrect-all).
-RSpec/BeEq:
- Exclude:
- - 'spec/unit/facter/apt_reboot_required_spec.rb'
- - 'spec/unit/puppet/type/apt_key_spec.rb'
-
# Offense count: 6
# Configuration parameters: Prefixes, AllowedPatterns.
# Prefixes: when, with, without
Exclude:
- 'lib/puppet/provider/apt_key/apt_key.rb'
-# Offense count: 1
-# This cop supports unsafe autocorrection (--autocorrect-all).
-# Configuration parameters: MinBranchesCount.
-Style/CaseLikeIf:
- Exclude:
- - 'lib/puppet/provider/apt_key/apt_key.rb'
-
# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/GlobalStdStream:
def self.prefetch(resources)
apt_keys = instances
resources.each_key do |name|
- if name.length == 40
+ case name.length
+ when 40
provider = apt_keys.find { |key| key.fingerprint == name }
resources[name].provider = provider if provider
- elsif name.length == 16
+ when 16
provider = apt_keys.find { |key| key.long == name }
resources[name].provider = provider if provider
- elsif name.length == 8
+ when 8
provider = apt_keys.find { |key| key.short == name }
resources[name].provider = provider if provider
end
allow(File).to receive(:file?).once.with('/var/run/reboot-required').and_return(true)
end
- it { is_expected.to eq true }
+ it { is_expected.to be true }
end
describe 'if a reboot is not required' do
allow(File).to receive(:file?).once.with('/var/run/reboot-required').and_return(false)
end
- it { is_expected.to eq false }
+ it { is_expected.to be false }
end
end
end
it 'source is not set' do
- expect(resource[:source]).to eq nil
+ expect(resource[:source]).to be_nil
end
it 'content is not set' do
- expect(resource[:content]).to eq nil
+ expect(resource[:content]).to be_nil
end
it 'refresh is not set' do
- expect(resource[:refresh]).to eq nil
+ expect(resource[:refresh]).to be_nil
end
it 'weak_ssl is not set' do
- expect(resource[:weak_ssl]).to eq nil
+ expect(resource[:weak_ssl]).to be_nil
end
end
Puppet::Type.type(:apt_key).new(id: 'EF8D349F',
source: 'http://apt.puppetlabs.com/pubkey.gpg',
ensure: :absent,
- refresh: :true)
+ refresh: true)
}.to raise_error(%r{ensure => absent and refresh => true are mutually exclusive})
end