Skip to content

Commit 156539a

Browse files
committed
(CONT-772) Correct RSpec/EmptyLineAfterExample
1 parent aace5a8 commit 156539a

38 files changed

+241
-2
lines changed

.rubocop_todo.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ RSpec/DescribeClass:
7676
# Offense count: 239
7777
# This cop supports safe autocorrection (--autocorrect).
7878
# Configuration parameters: AllowConsecutiveOneLiners.
79-
RSpec/EmptyLineAfterExample:
80-
Enabled: false
79+
# RSpec/EmptyLineAfterExample:
80+
# Enabled: false
8181

8282
# Offense count: 270
8383
# This cop supports safe autocorrection (--autocorrect).

spec/acceptance/apache_ssl_spec.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class { 'apache':
2323

2424
describe file("#{apache_hash['mod_ssl_dir']}/ssl.conf") do
2525
it { is_expected.to be_file }
26+
2627
if os[:family].include?('redhat') && os[:release].to_i >= 8
2728
it { is_expected.not_to contain 'SSLProtocol' }
2829
elsif ['debian', 'ubuntu'].include?(os[:family])
@@ -40,6 +41,7 @@ class { 'apache':
4041
it { is_expected.to contain 'SSLCACertificateFile "/tmp/ssl_ca"' }
4142
it { is_expected.to contain 'SSLCARevocationPath "/tmp/ssl_crl_path"' }
4243
it { is_expected.to contain 'SSLCARevocationFile "/tmp/ssl_crl"' }
44+
4345
if apache_hash['version'] == '2.4'
4446
it { is_expected.to contain 'SSLCARevocationCheck chain' }
4547
else
@@ -107,6 +109,7 @@ class { 'apache':
107109
it { is_expected.to contain 'SSLVerifyClient require' }
108110
it { is_expected.to contain 'SSLVerifyDepth 1' }
109111
it { is_expected.to contain 'SSLOptions test test1' }
112+
110113
if apache_hash['version'] == '2.4'
111114
it { is_expected.to contain 'SSLCARevocationCheck chain flag' }
112115
else

spec/acceptance/vhost_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ class { 'apache': }
315315
it 'answers to files.example.net #stdout' do
316316
expect(run_shell('/usr/bin/curl -sSf files.example.net:80/index.html').stdout).to eq("Hello World\n")
317317
end
318+
318319
it 'answers to files.example.net #stderr' do
319320
result = run_shell('/usr/bin/curl -sSf files.example.net:80/index.html.bak', expect_failures: true)
320321
expect(result.stderr).to match(%r{curl: \(22\) The requested URL returned error: 403})
@@ -369,14 +370,17 @@ class { 'apache': }
369370
it 'answers to files.example.net #stdout' do
370371
expect(run_shell('/usr/bin/curl -sSf files.example.net:80/').stdout).to eq("Hello World\n")
371372
end
373+
372374
it 'answers to files.example.net #stdout foo' do
373375
expect(run_shell('/usr/bin/curl -sSf files.example.net:80/foo/').stdout).to eq("Hello Foo\n")
374376
end
377+
375378
it 'answers to files.example.net #stderr' do
376379
result = run_shell('/usr/bin/curl -sSf files.example.net:80/private.html', expect_failures: true)
377380
expect(result.stderr).to match(%r{curl: \(22\) The requested URL returned error: 403})
378381
expect(result.exit_code).to eq 22
379382
end
383+
380384
it 'answers to files.example.net #stdout bar' do
381385
expect(run_shell('/usr/bin/curl -sSf files.example.net:80/bar/bar.html').stdout).to eq("Hello Bar\n")
382386
end
@@ -411,6 +415,7 @@ class { 'apache': }
411415
it 'answers to files.example.net #stdout' do
412416
expect(run_shell('/usr/bin/curl -sSf files.example.net:80/index.html').stdout).to eq("Hello World\n")
413417
end
418+
414419
it 'answers to files.example.net #stdout regex' do
415420
expect(run_shell('/usr/bin/curl -sSf files.example.net:80/server-status?auto').stdout).to match(%r{Scoreboard: })
416421
end
@@ -576,6 +581,7 @@ class { 'apache': default_vhost => false, }
576581
expect(r.stdout).to eq("Hello from localhost\n")
577582
end
578583
end
584+
579585
it 'gets a response from the back end #exit_code' do
580586
run_shell('/usr/bin/curl --max-redirs 0 proxy.example.com:80') do |r|
581587
expect(r.exit_code).to eq(0)
@@ -621,6 +627,7 @@ class { 'apache': default_vhost => false, }
621627
expect(r.stdout).to eq("Hello from localhost\n")
622628
end
623629
end
630+
624631
it 'gets a response from the back end #exit_code' do
625632
run_shell('/usr/bin/curl --max-redirs 0 proxy.example.com:80') do |r|
626633
expect(r.exit_code).to eq(0)
@@ -967,6 +974,7 @@ class { 'apache': }
967974
it 'applies cleanly' do
968975
_result = apply_manifest(pp, catch_failures: true)
969976
end
977+
970978
describe file("#{apache_hash['vhost_dir']}/25-test.servername.conf") do
971979
it { is_expected.to be_file }
972980
it { is_expected.to contain ' ErrorLog "/tmp/test.servername_error.log' }
@@ -986,6 +994,7 @@ class { 'apache': }
986994
it 'applies cleanly' do
987995
_result = apply_manifest(pp, catch_failures: true)
988996
end
997+
989998
describe file("#{apache_hash['vhost_dir']}/25-test.server.conf") do
990999
it { is_expected.to be_file }
9911000
it { is_expected.to contain ' ErrorLog "/tmp/test.server_error.log' }
@@ -1147,6 +1156,7 @@ class { 'apache::mod::wsgi': }
11471156
it 'import_script applies cleanly' do
11481157
apply_manifest(pp, catch_failures: true)
11491158
end
1159+
11501160
describe file("#{apache_hash['vhost_dir']}/25-test.server.conf") do
11511161
it { is_expected.to be_file }
11521162
it { is_expected.to contain 'WSGIApplicationGroup %{GLOBAL}' }
@@ -1212,6 +1222,7 @@ class { 'apache::mod::shib': }
12121222
it 'applies cleanly' do
12131223
apply_manifest(pp, catch_failures: true)
12141224
end
1225+
12151226
describe file("#{apache_hash['vhost_dir']}/25-test.server.conf") do
12161227
it { is_expected.to be_file }
12171228
it { is_expected.to contain 'ShibCompatValidUser On' }
@@ -1241,6 +1252,7 @@ class { 'apache': }
12411252
it 'applys cleanly' do
12421253
apply_manifest(pp, catch_failures: true)
12431254
end
1255+
12441256
describe file("#{apache_hash['vhost_dir']}/25-test.server.conf") do
12451257
it { is_expected.to be_file }
12461258
it { is_expected.to contain 'OIDCProviderMetadataURL https://login.example.com/.well-known/openid-configuration' }

spec/classes/apache_spec.rb

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,45 +7,54 @@
77
include_examples 'Debian 11'
88

99
it { is_expected.to contain_class('apache::params') }
10+
1011
it {
1112
is_expected.to contain_package('httpd').with(
1213
'notify' => 'Class[Apache::Service]',
1314
'ensure' => 'installed',
1415
)
1516
}
17+
1618
it { is_expected.to contain_user('www-data') }
1719
it { is_expected.to contain_group('www-data') }
1820
it { is_expected.to contain_class('apache::service') }
21+
1922
it {
2023
is_expected.to contain_file('/var/www/html').with(
2124
'ensure' => 'directory',
2225
)
2326
}
27+
2428
it {
2529
is_expected.to contain_file('/etc/apache2/sites-enabled').with(
2630
'ensure' => 'directory', 'recurse' => 'true',
2731
'purge' => 'true'
2832
).that_notifies('Class[Apache::Service]').that_requires('Package[httpd]')
2933
}
34+
3035
it {
3136
is_expected.to contain_file('/etc/apache2/mods-enabled').with(
3237
'ensure' => 'directory', 'recurse' => 'true',
3338
'purge' => 'true'
3439
).that_notifies('Class[Apache::Service]').that_requires('Package[httpd]')
3540
}
41+
3642
it {
3743
is_expected.to contain_file('/etc/apache2/mods-available').with(
3844
'ensure' => 'directory', 'recurse' => 'true',
3945
'purge' => 'false'
4046
).that_notifies('Class[Apache::Service]').that_requires('Package[httpd]')
4147
}
48+
4249
it { is_expected.to contain_file('/etc/apache2/apache2.conf').without_content(%r{ServerAdmin}) }
50+
4351
it {
4452
is_expected.to contain_concat('/etc/apache2/ports.conf').with(
4553
'owner' => 'root', 'group' => 'root',
4654
'mode' => '0644'
4755
).that_notifies('Class[Apache::Service]')
4856
}
57+
4958
# Assert that load files are placed and symlinked for these mods, but no conf file.
5059
['auth_basic', 'authn_file', 'authz_groupfile', 'authz_host', 'authz_user', 'dav', 'env'].each do |modname|
5160
it {
@@ -54,13 +63,15 @@
5463
'ensure' => 'file',
5564
)
5665
}
66+
5767
it {
5868
is_expected.to contain_file("#{modname}.load symlink").with(
5969
'path' => "/etc/apache2/mods-enabled/#{modname}.load",
6070
'ensure' => 'link',
6171
'target' => "/etc/apache2/mods-available/#{modname}.load",
6272
)
6373
}
74+
6475
it { is_expected.not_to contain_file("#{modname}.conf") }
6576
it { is_expected.not_to contain_file("#{modname}.conf symlink") }
6677
end
@@ -125,19 +136,22 @@
125136
'ensure' => 'file',
126137
)
127138
}
139+
128140
it {
129141
is_expected.to contain_file("#{modname}.load symlink").with(
130142
'path' => "/etc/apache2/mods-enabled/#{modname}.load",
131143
'ensure' => 'link',
132144
'target' => "/etc/apache2/mods-available/#{modname}.load",
133145
)
134146
}
147+
135148
it {
136149
is_expected.to contain_file("#{modname}.conf").with(
137150
'path' => "/etc/apache2/mods-available/#{modname}.conf",
138151
'ensure' => 'file',
139152
)
140153
}
154+
141155
it {
142156
is_expected.to contain_file("#{modname}.conf symlink").with(
143157
'path' => "/etc/apache2/mods-enabled/#{modname}.conf",
@@ -198,6 +212,7 @@
198212
is_expected.to contain_file('/etc/apache2/apache2.conf').with_content reg
199213
end
200214
end
215+
201216
it 'Not expected to contain' do
202217
unexpected.each do |reg|
203218
is_expected.to contain_file('/etc/apache2/apache2.conf').without_content reg
@@ -229,32 +244,38 @@
229244
include_examples 'RedHat 8'
230245

231246
it { is_expected.to contain_class('apache::params') }
247+
232248
it {
233249
is_expected.to contain_package('httpd').with(
234250
'notify' => 'Class[Apache::Service]',
235251
'ensure' => 'installed',
236252
)
237253
}
254+
238255
it { is_expected.to contain_user('apache') }
239256
it { is_expected.to contain_group('apache') }
240257
it { is_expected.to contain_class('apache::service') }
258+
241259
it {
242260
is_expected.to contain_file('/var/www/html').with(
243261
'ensure' => 'directory',
244262
)
245263
}
264+
246265
it {
247266
is_expected.to contain_file('/etc/httpd/conf.d').with(
248267
'ensure' => 'directory', 'recurse' => 'true',
249268
'purge' => 'true'
250269
).that_notifies('Class[Apache::Service]').that_requires('Package[httpd]')
251270
}
271+
252272
it {
253273
is_expected.to contain_concat('/etc/httpd/conf/ports.conf').with(
254274
'owner' => 'root', 'group' => 'root',
255275
'mode' => '0644'
256276
).that_notifies('Class[Apache::Service]')
257277
}
278+
258279
describe 'Alternate confd/mod/vhosts directory' do
259280
let :params do
260281
{
@@ -280,6 +301,7 @@
280301
"/etc/httpd/mod.d/#{modname}.load",
281302
)
282303
}
304+
283305
it {
284306
is_expected.not_to contain_file("#{modname}.conf").with_path(
285307
"/etc/httpd/mod.d/#{modname}.conf",
@@ -294,6 +316,7 @@
294316
"/etc/httpd/mod.d/#{modname}.load",
295317
)
296318
}
319+
297320
it {
298321
is_expected.to contain_file("#{modname}.conf").with_path(
299322
"/etc/httpd/mod.d/#{modname}.conf",
@@ -521,29 +544,34 @@
521544
it { is_expected.to contain_user('www') }
522545
it { is_expected.to contain_group('www') }
523546
it { is_expected.to contain_class('apache::service') }
547+
524548
it {
525549
is_expected.to contain_file('/usr/local/www/apache24/data').with(
526550
'ensure' => 'directory',
527551
)
528552
}
553+
529554
it {
530555
is_expected.to contain_file('/usr/local/etc/apache24/Vhosts').with(
531556
'ensure' => 'directory', 'recurse' => 'true',
532557
'purge' => 'true'
533558
).that_notifies('Class[Apache::Service]').that_requires('Package[httpd]')
534559
}
560+
535561
it {
536562
is_expected.to contain_file('/usr/local/etc/apache24/Modules').with(
537563
'ensure' => 'directory', 'recurse' => 'true',
538564
'purge' => 'true'
539565
).that_notifies('Class[Apache::Service]').that_requires('Package[httpd]')
540566
}
567+
541568
it {
542569
is_expected.to contain_concat('/usr/local/etc/apache24/ports.conf').with(
543570
'owner' => 'root', 'group' => 'wheel',
544571
'mode' => '0644'
545572
).that_notifies('Class[Apache::Service]')
546573
}
574+
547575
# Assert that load files are placed for these mods, but no conf file.
548576
['auth_basic', 'authn_core', 'authn_file', 'authz_groupfile', 'authz_host', 'authz_user', 'dav', 'env'].each do |modname|
549577
it {
@@ -552,6 +580,7 @@
552580
'ensure' => 'file',
553581
)
554582
}
583+
555584
it { is_expected.not_to contain_file("#{modname}.conf") }
556585
end
557586

@@ -563,6 +592,7 @@
563592
'ensure' => 'file',
564593
)
565594
}
595+
566596
it {
567597
is_expected.to contain_file("#{modname}.conf").with(
568598
'path' => "/usr/local/etc/apache24/Modules/#{modname}.conf",
@@ -578,23 +608,27 @@
578608
it { is_expected.to contain_user('apache') }
579609
it { is_expected.to contain_group('apache') }
580610
it { is_expected.to contain_class('apache::service') }
611+
581612
it {
582613
is_expected.to contain_file('/var/www/localhost/htdocs').with(
583614
'ensure' => 'directory',
584615
)
585616
}
617+
586618
it {
587619
is_expected.to contain_file('/etc/apache2/vhosts.d').with(
588620
'ensure' => 'directory', 'recurse' => 'true',
589621
'purge' => 'true'
590622
).that_notifies('Class[Apache::Service]').that_requires('Package[httpd]')
591623
}
624+
592625
it {
593626
is_expected.to contain_file('/etc/apache2/modules.d').with(
594627
'ensure' => 'directory', 'recurse' => 'true',
595628
'purge' => 'true'
596629
).that_notifies('Class[Apache::Service]').that_requires('Package[httpd]')
597630
}
631+
598632
it {
599633
is_expected.to contain_concat('/etc/apache2/ports.conf').with(
600634
'owner' => 'root', 'group' => 'wheel',

spec/classes/dev_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@
1818

1919
it { is_expected.to compile.with_all_deps }
2020
it { is_expected.to contain_class('apache::params') }
21+
2122
case facts[:os]['name']
2223
when 'Debian'
2324
it { is_expected.to contain_package('libaprutil1-dev') }
2425
it { is_expected.to contain_package('libapr1-dev') }
26+
2527
it { is_expected.to contain_package('apache2-prefork-dev') } if facts[:os]['release']['major'].to_i < 8
2628
when 'Ubuntu'
2729
it { is_expected.to contain_package('apache2-dev') }

spec/classes/mod/auth_cas_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
it { is_expected.to contain_package('mod_auth_cas') }
6464
it { is_expected.to contain_file('auth_cas.conf').with_path('/etc/httpd/conf.modules.d/auth_cas.conf') }
6565
it { is_expected.to contain_file('/var/cache/mod_auth_cas/').with_owner('apache') }
66+
6667
it {
6768
is_expected.to contain_concat__fragment('test.server-auth_cas').with(content: %r{^\s+CASRootProxiedAs http://test.server$})
6869
is_expected.to contain_concat__fragment('test.server-auth_cas').with(content: %r{^\s+CASCookiePath /my/cas/path$})

spec/classes/mod/auth_openidc_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
it { is_expected.to contain_class('apache::mod::authz_user') }
3232
it { is_expected.to contain_apache__mod('auth_openidc') }
3333
it { is_expected.to contain_package('mod_auth_openidc') }
34+
3435
it do
3536
is_expected.to contain_package('dnf-module-mod_auth_openidc')
3637
.with_ensure('present')

0 commit comments

Comments
 (0)