File tree Expand file tree Collapse file tree 4 files changed +11
-30
lines changed
lib/puppet/provider/apt_key Expand file tree Collapse file tree 4 files changed +11
-30
lines changed Original file line number Diff line number Diff line change 66# Note that changes in the inspected code, or installation of new
77# versions of RuboCop, may require this file to be generated again.
88
9- # Offense count: 1
10- # This cop supports unsafe autocorrection (--autocorrect-all).
11- Lint/BooleanSymbol :
12- Exclude :
13- - ' spec/unit/puppet/type/apt_key_spec.rb'
14-
159# Offense count: 3
1610# Configuration parameters: AllowedMethods.
1711# AllowedMethods: enums
@@ -53,13 +47,6 @@ Performance/CollectionLiteralInLoop:
5347 Exclude :
5448 - ' spec/classes/apt_update_spec.rb'
5549
56- # Offense count: 6
57- # This cop supports unsafe autocorrection (--autocorrect-all).
58- RSpec/BeEq :
59- Exclude :
60- - ' spec/unit/facter/apt_reboot_required_spec.rb'
61- - ' spec/unit/puppet/type/apt_key_spec.rb'
62-
6350# Offense count: 6
6451# Configuration parameters: Prefixes, AllowedPatterns.
6552# Prefixes: when, with, without
@@ -141,13 +128,6 @@ Security/Open:
141128 Exclude :
142129 - ' lib/puppet/provider/apt_key/apt_key.rb'
143130
144- # Offense count: 1
145- # This cop supports unsafe autocorrection (--autocorrect-all).
146- # Configuration parameters: MinBranchesCount.
147- Style/CaseLikeIf :
148- Exclude :
149- - ' lib/puppet/provider/apt_key/apt_key.rb'
150-
151131# Offense count: 1
152132# This cop supports unsafe autocorrection (--autocorrect-all).
153133Style/GlobalStdStream :
Original file line number Diff line number Diff line change @@ -71,13 +71,14 @@ def self.instances
7171 def self . prefetch ( resources )
7272 apt_keys = instances
7373 resources . each_key do |name |
74- if name . length == 40
74+ case name . length
75+ when 40
7576 provider = apt_keys . find { |key | key . fingerprint == name }
7677 resources [ name ] . provider = provider if provider
77- elsif name . length == 16
78+ when 16
7879 provider = apt_keys . find { |key | key . long == name }
7980 resources [ name ] . provider = provider if provider
80- elsif name . length == 8
81+ when 8
8182 provider = apt_keys . find { |key | key . short == name }
8283 resources [ name ] . provider = provider if provider
8384 end
Original file line number Diff line number Diff line change 1414 allow ( File ) . to receive ( :file? ) . once . with ( '/var/run/reboot-required' ) . and_return ( true )
1515 end
1616
17- it { is_expected . to eq true }
17+ it { is_expected . to be true }
1818 end
1919
2020 describe 'if a reboot is not required' do
2424 allow ( File ) . to receive ( :file? ) . once . with ( '/var/run/reboot-required' ) . and_return ( false )
2525 end
2626
27- it { is_expected . to eq false }
27+ it { is_expected . to be false }
2828 end
2929end
Original file line number Diff line number Diff line change 2424 end
2525
2626 it 'source is not set' do
27- expect ( resource [ :source ] ) . to eq nil
27+ expect ( resource [ :source ] ) . to be_nil
2828 end
2929
3030 it 'content is not set' do
31- expect ( resource [ :content ] ) . to eq nil
31+ expect ( resource [ :content ] ) . to be_nil
3232 end
3333
3434 it 'refresh is not set' do
35- expect ( resource [ :refresh ] ) . to eq nil
35+ expect ( resource [ :refresh ] ) . to be_nil
3636 end
3737
3838 it 'weak_ssl is not set' do
39- expect ( resource [ :weak_ssl ] ) . to eq nil
39+ expect ( resource [ :weak_ssl ] ) . to be_nil
4040 end
4141 end
4242
167167 Puppet ::Type . type ( :apt_key ) . new ( id : 'EF8D349F' ,
168168 source : 'http://apt.puppetlabs.com/pubkey.gpg' ,
169169 ensure : :absent ,
170- refresh : : true)
170+ refresh : true )
171171 } . to raise_error ( %r{ensure => absent and refresh => true are mutually exclusive} )
172172 end
173173
You can’t perform that action at this time.
0 commit comments