Skip to content

Commit ea20a6d

Browse files
committed
Apply remaining rubocop fixes
1 parent 78d554a commit ea20a6d

14 files changed

+95
-94
lines changed

.rubocop.yml

+5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ AllCops:
1818
- "**/Puppetfile"
1919
- "**/Vagrantfile"
2020
- "**/Guardfile"
21+
inherit_from: ".rubocop_todo.yml"
2122
Layout/LineLength:
2223
Description: People have wide screens, use them.
2324
Max: 200
@@ -89,6 +90,8 @@ Performance/CaseWhenSplat:
8990
Performance/Casecmp:
9091
Enabled: true
9192
Performance/CollectionLiteralInLoop:
93+
Exclude:
94+
- spec/**/*
9295
Enabled: true
9396
Performance/CompareWithBlock:
9497
Enabled: true
@@ -308,6 +311,8 @@ Metrics/PerceivedComplexity:
308311
Enabled: false
309312
Migration/DepartmentName:
310313
Enabled: false
314+
Naming/AccessorMethodName:
315+
Enabled: false
311316
Naming/BlockParameterName:
312317
Enabled: false
313318
Naming/HeredocDelimiterCase:

.sync.yml

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
".gitlab-ci.yml":
33
delete: true
4+
".rubocop.yml":
5+
include_todos: true
46
".travis.yml":
57
global_env:
68
- HONEYCOMB_WRITEKEY="7f3c63a70eecc61d635917de46bea4e6",HONEYCOMB_DATASET="litmus tests"

spec/acceptance/apache_ssl_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class { 'apache':
2323

2424
describe file("#{apache_hash['mod_ssl_dir']}/ssl.conf") do
2525
it { is_expected.to be_file }
26-
if os[:family] =~ %r{redhat} && os[:release].to_i == 8
26+
if os[:family].include?(redhat) && os[:release].to_i == 8
2727
it { is_expected.to contain 'SSLProtocol all' }
2828
else
2929
it { is_expected.to contain 'SSLProtocol all -SSLv2 -SSLv3' }

spec/acceptance/mod_php_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ class { 'apache::mod::php': }
2525
end
2626

2727
if (os[:family] == 'ubuntu' && os[:release] == '16.04') ||
28-
(os[:family] == 'debian' && os[:release] =~ %r{9})
28+
(os[:family] == 'debian' && os[:release] =~ %r{^9\.})
2929
describe file("#{apache_hash['mod_dir']}/php7.0.conf") do
3030
it { is_expected.to contain 'DirectoryIndex index.php' }
3131
end
32-
elsif os[:family] == 'debian' && os[:release] =~ %r{10}
32+
elsif os[:family] == 'debian' && os[:release] =~ %r{^10\.}
3333
describe file("#{apache_hash['mod_dir']}/php7.3.conf") do
3434
it { is_expected.to contain 'DirectoryIndex index.php' }
3535
end
@@ -41,7 +41,7 @@ class { 'apache::mod::php': }
4141
describe file("#{apache_hash['mod_dir']}/php7.4.conf") do
4242
it { is_expected.to contain 'DirectoryIndex index.php' }
4343
end
44-
elsif os[:family] == 'redhat' && os[:release] =~ %r{^8}
44+
elsif os[:family] == 'redhat' && os[:release] =~ %r{^8\.}
4545
describe file("#{apache_hash['mod_dir']}/php7.conf") do
4646
it { is_expected.to contain 'DirectoryIndex index.php' }
4747
end

spec/acceptance/vhost_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class { 'apache': }
5151
end
5252
end
5353

54-
context 'default vhost with ssl', unless: (os[:family] =~ %r{redhat} && os[:release].to_i == 8) do
54+
context 'default vhost with ssl', unless: (os[:family].inclde?(redhat) && os[:release].to_i == 8) do
5555
pp = <<-MANIFEST
5656
file { '#{apache_hash['run_dir']}':
5757
ensure => 'directory',

spec/classes/mod/info_spec.rb

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
require 'spec_helper'
44

55
# This function is called inside the OS specific contexts
6-
def general_info_specs_22
6+
def general_info_specs_apache22
77
it { is_expected.to contain_apache__mod('info') }
88

99
context 'passing no parameters' do
@@ -64,7 +64,7 @@ def general_info_specs_22
6464
end
6565
end
6666

67-
def general_info_specs_24
67+
def general_info_specs_apache24
6868
it { is_expected.to contain_apache__mod('info') }
6969

7070
context 'passing no parameters' do
@@ -138,7 +138,7 @@ def general_info_specs_24
138138
end
139139

140140
# Load the more generic tests for this context
141-
general_info_specs_22
141+
general_info_specs_apache22
142142

143143
it {
144144
is_expected.to contain_file('info.conf').with(ensure: 'file',
@@ -164,7 +164,7 @@ def general_info_specs_24
164164
end
165165

166166
# Load the more generic tests for this context
167-
general_info_specs_22
167+
general_info_specs_apache22
168168

169169
it {
170170
is_expected.to contain_file('info.conf').with(ensure: 'file',
@@ -186,7 +186,7 @@ def general_info_specs_24
186186
end
187187

188188
# Load the more generic tests for this context
189-
general_info_specs_24
189+
general_info_specs_apache24
190190

191191
it {
192192
is_expected.to contain_file('info.conf').with(ensure: 'file',
@@ -208,7 +208,7 @@ def general_info_specs_24
208208
end
209209

210210
# Load the more generic tests for this context
211-
general_info_specs_24
211+
general_info_specs_apache24
212212

213213
it {
214214
is_expected.to contain_file('info.conf').with(ensure: 'file',

spec/classes/mod/security_spec.rb

+4-8
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,17 @@
2424
lib: 'mod_unique_id.so',
2525
)
2626
}
27+
2728
it { is_expected.to contain_package('mod_security_crs') }
28-
if facts[:os]['release']['major'].to_i > 6 && facts[:os]['release']['major'].to_i <= 7
29-
it {
30-
is_expected.to contain_file('security.conf').with(
31-
path: '/etc/httpd/conf.modules.d/security.conf',
32-
)
33-
}
34-
end
35-
if facts[:os]['release']['major'].to_i >= 8
29+
30+
if (facts[:os]['release']['major'].to_i > 6 && facts[:os]['release']['major'].to_i <= 7) || (facts[:os]['release']['major'].to_i >= 8)
3631
it {
3732
is_expected.to contain_file('security.conf').with(
3833
path: '/etc/httpd/conf.modules.d/security.conf',
3934
)
4035
}
4136
end
37+
4238
it {
4339
is_expected.to contain_file('security.conf')
4440
.with_content(%r{^\s+SecAuditLogRelevantStatus "\^\(\?:5\|4\(\?!04\)\)"$})

spec/classes/mod/status_spec.rb

+4-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def status_conf_spec(allow_from, extended_status, status_path)
1818
" # Show Proxy LoadBalancer status in mod_status\n"\
1919
" ProxyStatus On\n"\
2020
"</IfModule>\n"
21-
it do
21+
it('status conf') do
2222
is_expected.to contain_file('status.conf').with_content(expected)
2323
end
2424
end
@@ -59,7 +59,7 @@ def status_conf_spec_require(requires, extended_status, status_path)
5959
" # Show Proxy LoadBalancer status in mod_status\n"\
6060
" ProxyStatus On\n"\
6161
"</IfModule>\n"
62-
it do
62+
it('status conf require') do
6363
is_expected.to contain_file('status.conf').with_content(expected)
6464
end
6565
end
@@ -251,6 +251,8 @@ def status_conf_spec_require(requires, extended_status, status_path)
251251
}
252252
end
253253

254+
it { is_expected.to compile }
255+
254256
status_conf_spec(['10.10.10.10', '11.11.11.11'], 'Off', '/custom-status')
255257
end
256258

spec/defines/fastcgi_server_spec.rb

+1-8
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
path: "/etc/httpd/conf.d/fastcgi-pool-#{title}.conf",
2929
)
3030
}
31-
when 'Debian'
31+
when 'Debian', 'Gentoo'
3232
it {
3333
is_expected.to contain_file("fastcgi-pool-#{title}.conf").with(
3434
ensure: 'file',
@@ -42,13 +42,6 @@
4242
path: "/usr/local/etc/apache24/Includes/fastcgi-pool-#{title}.conf",
4343
)
4444
}
45-
when 'Gentoo'
46-
it {
47-
is_expected.to contain_file("fastcgi-pool-#{title}.conf").with(
48-
ensure: 'file',
49-
path: "/etc/apache2/conf.d/fastcgi-pool-#{title}.conf",
50-
)
51-
}
5245
end
5346

5447
describe 'os-independent items' do

spec/defines/vhost_custom_spec.rb

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
end
2828
let(:params) { default_params }
2929
let(:facts) { default_facts }
30+
31+
it { is_expected.to compile }
3032
end
3133
context 'on Debian based systems' do
3234
let :default_facts do

0 commit comments

Comments
 (0)