File tree Expand file tree Collapse file tree 4 files changed +23
-51
lines changed Expand file tree Collapse file tree 4 files changed +23
-51
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: 3
10- # Configuration parameters: AllowedMethods.
11- # AllowedMethods: enums
12- Lint/ConstantDefinitionInBlock :
13- Exclude :
14- - ' spec/defines/key_compat_spec.rb'
15- - ' spec/defines/source_compat_spec.rb'
16- - ' spec/defines/source_spec.rb'
17-
189# Offense count: 6
1910# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
2011Metrics/AbcSize :
Original file line number Diff line number Diff line change @@ -21,8 +21,8 @@ def apt_key_example(title)
2121end
2222
2323describe 'apt::key' , type : :define do
24- GPG_KEY_ID = '6F6B15509CF8E59E6E469F327F438280EF8D349F'
25-
24+ let ( :title ) { '6F6B15509CF8E59E6E469F327F438280EF8D349F' }
25+ let ( :pre_condition ) { 'include apt' }
2626 let ( :facts ) do
2727 {
2828 os : {
@@ -40,14 +40,6 @@ def apt_key_example(title)
4040 }
4141 end
4242
43- let :title do
44- GPG_KEY_ID
45- end
46-
47- let :pre_condition do
48- 'include apt'
49- end
50-
5143 describe 'normal operation' do
5244 describe 'default options' do
5345 it {
@@ -70,20 +62,20 @@ def apt_key_example(title)
7062
7163 let :params do
7264 {
73- id : GPG_KEY_ID
65+ id : title
7466 }
7567 end
7668
7769 it 'contains the apt_key' do
78- expect ( subject ) . to contain_apt_key ( title ) . with ( id : GPG_KEY_ID ,
70+ expect ( subject ) . to contain_apt_key ( title ) . with ( id : title ,
7971 ensure : 'present' ,
8072 source : nil ,
8173 server : 'keyserver.ubuntu.com' ,
8274 content : nil )
8375 end
8476
8577 it 'contains the apt_key present anchor' do
86- expect ( subject ) . to contain_anchor ( "apt_key #{ GPG_KEY_ID } present" )
78+ expect ( subject ) . to contain_anchor ( "apt_key #{ title } present" )
8779 end
8880 end
8981
Original file line number Diff line number Diff line change 33require 'spec_helper'
44
55describe 'apt::source' , type : :define do
6- GPG_KEY_ID = '6F6B15509CF8E59E6E469F327F438280EF8D349F'
7-
8- let :title do
9- 'my_source'
10- end
11-
6+ let ( :id ) { '6F6B15509CF8E59E6E469F327F438280EF8D349F' }
7+ let ( :title ) { 'my_source' }
128 let :facts do
139 {
1410 os : {
4743 'release' => 'sid' ,
4844 'repos' => 'testing' ,
4945 'include' => { 'src' => false } ,
50- 'key' => GPG_KEY_ID ,
46+ 'key' => id ,
5147 'pin' => '10' ,
5248 'architecture' => 'x86_64' ,
5349 'allow_unsigned' => true
6662 }
6763
6864 it {
69- expect ( subject ) . to contain_apt__key ( "Add key: #{ GPG_KEY_ID } from Apt::Source my_source" ) . that_comes_before ( 'Apt::Setting[list-my_source]' ) . with ( 'ensure' => 'present' ,
70- 'id' => GPG_KEY_ID )
65+ expect ( subject ) . to contain_apt__key ( "Add key: #{ id } from Apt::Source my_source" ) . that_comes_before ( 'Apt::Setting[list-my_source]' ) . with ( 'ensure' => 'present' ,
66+ 'id' => id )
7167 }
7268 end
7369
Original file line number Diff line number Diff line change 33require 'spec_helper'
44
55describe 'apt::source' do
6- GPG_KEY_ID = '6F6B15509CF8E59E6E469F327F438280EF8D349F'
7-
8- let :pre_condition do
9- 'class { "apt": }'
10- end
11-
12- let :title do
13- 'my_source'
14- end
15-
6+ let ( :id ) { '6F6B15509CF8E59E6E469F327F438280EF8D349F' }
7+ let ( :title ) { 'my_source' }
8+ let ( :pre_condition ) { 'class { "apt": }' }
169 let :facts do
1710 {
1811 os : {
7972 location : 'http://debian.mirror.iweb.ca/debian/' ,
8073 release : 'sid' ,
8174 repos : 'testing' ,
82- key : GPG_KEY_ID ,
75+ key : id ,
8376 pin : '10' ,
8477 architecture : 'x86_64' ,
8578 allow_unsigned : true
9891 }
9992
10093 it {
101- expect ( subject ) . to contain_apt__key ( "Add key: #{ GPG_KEY_ID } from Apt::Source my_source" ) . that_comes_before ( 'Apt::Setting[list-my_source]' ) . with ( ensure : 'present' ,
102- id : GPG_KEY_ID )
94+ expect ( subject ) . to contain_apt__key ( "Add key: #{ id } from Apt::Source my_source" ) . that_comes_before ( 'Apt::Setting[list-my_source]' ) . with ( ensure : 'present' ,
95+ id : id )
10396 }
10497 end
10598
112105 repos : 'testing' ,
113106 key : {
114107 'ensure' => 'refreshed' ,
115- 'id' => GPG_KEY_ID ,
108+ 'id' => id ,
116109 'server' => 'pgp.mit.edu' ,
117110 'content' => 'GPG key content' ,
118111 'source' => 'http://apt.puppetlabs.com/pubkey.gpg' ,
136129 }
137130
138131 it {
139- expect ( subject ) . to contain_apt__key ( "Add key: #{ GPG_KEY_ID } from Apt::Source my_source" ) . that_comes_before ( 'Apt::Setting[list-my_source]' ) . with ( ensure : 'refreshed' ,
140- id : GPG_KEY_ID ,
141- server : 'pgp.mit.edu' ,
142- content : 'GPG key content' ,
143- source : 'http://apt.puppetlabs.com/pubkey.gpg' ,
144- weak_ssl : true )
132+ expect ( subject ) . to contain_apt__key ( "Add key: #{ id } from Apt::Source my_source" ) . that_comes_before ( 'Apt::Setting[list-my_source]' ) . with ( ensure : 'refreshed' ,
133+ id : GPG_KEY_ID ,
134+ server : 'pgp.mit.edu' ,
135+ content : 'GPG key content' ,
136+ source : 'http://apt.puppetlabs.com/pubkey.gpg' ,
137+ weak_ssl : true )
145138 }
146139 end
147140 end
You can’t perform that action at this time.
0 commit comments