Skip to content

Commit d39da27

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

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+270
-11
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,6 @@ RSpec/ContextWording:
7373
RSpec/DescribeClass:
7474
Enabled: false
7575

76-
# Offense count: 239
77-
# This cop supports safe autocorrection (--autocorrect).
78-
# Configuration parameters: AllowConsecutiveOneLiners.
79-
# RSpec/EmptyLineAfterExample:
80-
# Enabled: false
81-
82-
# Offense count: 270
83-
# This cop supports safe autocorrection (--autocorrect).
84-
RSpec/EmptyLineAfterExampleGroup:
85-
Enabled: false
86-
8776
# Offense count: 25
8877
# Configuration parameters: CountAsOne.
8978
RSpec/ExampleLength:

spec/acceptance/apache_parameters_spec.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
end
1717
end
1818
end
19+
1920
describe 'default_confd_files => true' do
2021
it 'copies conf.d files' do
2122
pp = "class { 'apache': default_confd_files => true }"
@@ -137,6 +138,7 @@ class { 'apache':
137138
describe file("#{apache_hash['confd_dir']}/test.conf") do
138139
it { is_expected.to be_file }
139140
end
141+
140142
describe file("#{apache_hash['confd_dir']}.vhosts/test.conf") do
141143
it { is_expected.to be_file }
142144
end
@@ -161,6 +163,7 @@ class { 'apache':
161163
describe file("#{apache_hash['confd_dir']}/test.conf") do
162164
it { is_expected.not_to be_file }
163165
end
166+
164167
describe file("#{apache_hash['confd_dir']}.vhosts/test.conf") do
165168
it { is_expected.not_to be_file }
166169
end

spec/acceptance/vhost_spec.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,7 @@ class { 'apache': }
653653
it { is_expected.to be_file }
654654
it { is_expected.not_to contain 'NameVirtualHost test.server' }
655655
end
656+
656657
describe file("#{apache_hash['vhost_dir']}/25-test.server.conf") do
657658
it { is_expected.to be_file }
658659
it { is_expected.to contain 'ServerName test.server' }
@@ -677,6 +678,7 @@ class { 'apache': }
677678
it { is_expected.to be_file }
678679
it { is_expected.not_to contain 'NameVirtualHost test.server' }
679680
end
681+
680682
describe file("#{apache_hash['vhost_dir']}/25-test.server.conf") do
681683
it { is_expected.to be_file }
682684
it { is_expected.not_to contain 'ServerName' }
@@ -872,87 +874,106 @@ class { 'apache': }
872874
it { is_expected.to be_file }
873875
it { is_expected.to contain 'AssignUserId nobody nobody' }
874876
end
877+
875878
describe file("#{apache_hash['vhost_dir']}/25-test.custom_fragment.conf") do
876879
it { is_expected.to be_file }
877880
it { is_expected.to contain '#weird test string' }
878881
end
882+
879883
describe file("#{apache_hash['vhost_dir']}/test.without_priority_prefix.conf") do
880884
it { is_expected.to be_file }
881885
end
886+
882887
describe file("#{apache_hash['vhost_dir']}/25-test.ssl_protocol.conf") do
883888
it { is_expected.to be_file }
884889
it { is_expected.to contain 'SSLProtocol *All -SSLv2' }
885890
it { is_expected.to contain 'SSLUserName *SSL_CLIENT_S_DN_CN' }
886891
end
892+
887893
describe file("#{apache_hash['vhost_dir']}/25-test.block.conf") do
888894
it { is_expected.to be_file }
889895
it { is_expected.to contain '<DirectoryMatch .*\.(svn|git|bzr|hg|ht)/.*>' }
890896
end
897+
891898
describe file("#{apache_hash['vhost_dir']}/25-test.setenv_setenvif.conf") do
892899
it { is_expected.to be_file }
893900
it { is_expected.to contain 'SetEnv TEST /test' }
894901
it { is_expected.to contain 'SetEnvIf Request_URI "\.gif$" object_is_image=gif' }
895902
end
903+
896904
describe file("#{apache_hash['vhost_dir']}/25-test.rewrite.conf") do
897905
it { is_expected.to be_file }
898906
it { is_expected.to contain '#test' }
899907
it { is_expected.to contain 'RewriteCond %{HTTP_USER_AGENT} ^Lynx/ [OR]' }
900908
it { is_expected.to contain 'RewriteRule ^index.html$ welcome.html' }
901909
it { is_expected.to contain 'RewriteMap lc int:tolower' }
902910
end
911+
903912
describe file("#{apache_hash['vhost_dir']}/25-test.request_headers.conf") do
904913
it { is_expected.to be_file }
905914
it { is_expected.to contain 'append MirrorID "mirror 12"' }
906915
end
916+
907917
describe file("#{apache_hash['vhost_dir']}/25-test.redirect.conf") do
908918
it { is_expected.to be_file }
909919
it { is_expected.to contain 'Redirect permanent /images http://test.server/' }
910920
end
921+
911922
describe file("#{apache_hash['vhost_dir']}/25-test.no_proxy_uris.conf") do
912923
it { is_expected.to be_file }
913924
it { is_expected.to contain 'ProxyPass http://test2/test !' }
914925
it { is_expected.to contain 'ProxyPass / http://test2/' }
915926
end
927+
916928
describe file("#{apache_hash['vhost_dir']}/25-test.proxy.conf") do
917929
it { is_expected.to be_file }
918930
it { is_expected.to contain 'ProxyPass / http://testproxy/' }
919931
end
932+
920933
describe file("#{apache_hash['vhost_dir']}/25-test.scriptaliases.conf") do
921934
it { is_expected.to be_file }
922935
it { is_expected.to contain 'ScriptAlias /myscript "/usr/share/myscript"' }
923936
end
937+
924938
describe file("#{apache_hash['vhost_dir']}/25-test.aliases.conf") do
925939
it { is_expected.to be_file }
926940
it { is_expected.to contain 'Alias /image "/ftp/pub/image"' }
927941
it { is_expected.to contain 'ScriptAlias /myscript "/usr/share/myscript"' }
928942
end
943+
929944
describe file("#{apache_hash['vhost_dir']}/25-test.access_logs.conf") do
930945
it { is_expected.to be_file }
931946
it { is_expected.to contain 'CustomLog "/tmp/log1" combined' }
932947
it { is_expected.to contain 'CustomLog "/tmp/log2" combined env=admin' }
933948
it { is_expected.to contain 'CustomLog "/var/tmp/log3" "%h %l"' }
934949
it { is_expected.to contain 'CustomLog "syslog" combined' }
935950
end
951+
936952
describe file("#{apache_hash['vhost_dir']}/25-test.access_log_env_var.conf") do
937953
it { is_expected.to be_file }
938954
it { is_expected.to contain 'CustomLog "syslog" combined env=admin' }
939955
end
956+
940957
describe file("#{apache_hash['vhost_dir']}/25-test.access_log_format.conf") do
941958
it { is_expected.to be_file }
942959
it { is_expected.to contain 'CustomLog "syslog" "%h %l"' }
943960
end
961+
944962
describe file("#{apache_hash['vhost_dir']}/25-test.logroot.conf") do
945963
it { is_expected.to be_file }
946964
it { is_expected.to contain ' CustomLog "/tmp' }
947965
end
966+
948967
describe file("#{apache_hash['vhost_dir']}/25-test.override.conf") do
949968
it { is_expected.to be_file }
950969
it { is_expected.to contain 'AllowOverride All' }
951970
end
971+
952972
describe file("#{apache_hash['vhost_dir']}/25-test.options.conf") do
953973
it { is_expected.to be_file }
954974
it { is_expected.to contain 'Options Indexes FollowSymLinks ExecCGI' }
955975
end
976+
956977
describe file("#{apache_hash['vhost_dir']}/25-test.empty_options.conf") do
957978
it { is_expected.to be_file }
958979
it { is_expected.not_to contain 'Options' }
@@ -981,6 +1002,7 @@ class { 'apache': }
9811002
it { is_expected.to contain ' CustomLog "/tmp/test.servername_access.log' }
9821003
end
9831004
end
1005+
9841006
describe 'when the $use_servername_for_filenames parameter is NOT defined' do
9851007
pp = <<-MANIFEST
9861008
class { 'apache': }

spec/classes/apache_spec.rb

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@
169169
it { is_expected.not_to contain_user('www-data') }
170170
it { is_expected.to contain_file('/etc/apache2/apache2.conf').with_content %r{^User www-data\n} }
171171
end
172+
172173
describe "Don't create group resource when parameter manage_group is false" do
173174
let :params do
174175
{ manage_group: false }
@@ -328,6 +329,7 @@
328329
it { is_expected.to contain_file('/etc/httpd/conf/httpd.conf').with_content %r{^Include "/etc/httpd/mod\.d/\*\.conf"$} }
329330
it { is_expected.to contain_file('/etc/httpd/conf/httpd.conf').with_content %r{^Include "/etc/httpd/mod\.d/\*\.load"$} }
330331
end
332+
331333
describe 'Alternate confd/mod/vhosts directory' do
332334
let :params do
333335
{
@@ -340,6 +342,7 @@
340342

341343
it { is_expected.to contain_file('/etc/httpd/conf/httpd.conf').with_content %r{^IncludeOptional "/etc/httpd/conf\.d/\*\.conf"$} }
342344
end
345+
343346
describe 'Alternate confd/mod/vhosts directory when specifying slash encoding behaviour' do
344347
let :params do
345348
{
@@ -403,6 +406,7 @@
403406
end
404407
end
405408
end
409+
406410
describe 'Alternate mpm_modules when declaring mpm_module => prefork' do
407411
let :params do
408412
{ mpm_module: 'prefork' }
@@ -414,6 +418,7 @@
414418
it { is_expected.not_to contain_class('apache::mod::peruser') }
415419
it { is_expected.not_to contain_class('apache::mod::worker') }
416420
end
421+
417422
describe 'Alternate mpm_modules when declaring mpm_module => worker' do
418423
let :params do
419424
{ mpm_module: 'worker' }
@@ -433,6 +438,7 @@
433438

434439
it { is_expected.to contain_file('/etc/httpd/conf/httpd.conf').with_content %r{^# Security\n} }
435440
end
441+
436442
describe 'different templates for httpd.conf with non-default' do
437443
let :params do
438444
{ conf_template: 'site_apache/fake.conf.erb' }
@@ -449,6 +455,7 @@
449455
it { is_expected.to contain_apache__mod('authz_host') }
450456
it { is_expected.not_to contain_apache__mod('env') }
451457
end
458+
452459
describe 'default mods custom' do
453460
let :params do
454461
{ default_mods: ['info', 'alias', 'mime', 'env', 'setenv', 'expires'] }
@@ -459,6 +466,7 @@
459466
it { is_expected.to contain_class('apache::mod::info') }
460467
it { is_expected.to contain_class('apache::mod::mime') }
461468
end
469+
462470
describe "Don't create user resource when parameter manage_user is false" do
463471
let :params do
464472
{ manage_user: false }
@@ -467,6 +475,7 @@
467475
it { is_expected.not_to contain_user('apache') }
468476
it { is_expected.to contain_file('/etc/httpd/conf/httpd.conf').with_content %r{^User apache\n} }
469477
end
478+
470479
describe "Don't create group resource when parameter manage_group is false" do
471480
let :params do
472481
{ manage_group: false }
@@ -487,13 +496,15 @@
487496
}.to raise_error(Puppet::PreformattedError, %r{Evaluation Error: Error while evaluating a Resource Statement, Class\[Apache\]: parameter 'sendfile' expects a match for Enum\['Off', 'On', 'off', 'on'\]}) # rubocop:disable Layout/LineLength
488497
end
489498
end
499+
490500
describe 'sendfile On' do
491501
let :params do
492502
{ sendfile: 'On' }
493503
end
494504

495505
it { is_expected.to contain_file('/etc/httpd/conf/httpd.conf').with_content %r{^EnableSendfile On\n} }
496506
end
507+
497508
describe 'sendfile Off' do
498509
let :params do
499510
{ sendfile: 'Off' }
@@ -513,13 +524,15 @@
513524
}.to raise_error(Puppet::Error, %r{Evaluation Error})
514525
end
515526
end
527+
516528
describe 'hostname_lookups On' do
517529
let :params do
518530
{ hostname_lookups: 'On' }
519531
end
520532

521533
it { is_expected.to contain_file('/etc/httpd/conf/httpd.conf').with_content %r{^HostnameLookups On\n} }
522534
end
535+
523536
describe 'hostname_lookups Off' do
524537
let :params do
525538
{ hostname_lookups: 'Off' }
@@ -536,6 +549,7 @@
536549
it { is_expected.to contain_file('/etc/httpd/conf/httpd.conf').with_content %r{^HostnameLookups Double\n} }
537550
end
538551
end
552+
539553
context 'on a FreeBSD OS' do
540554
include_examples 'FreeBSD 10'
541555

@@ -601,6 +615,7 @@
601615
}
602616
end
603617
end
618+
604619
context 'on a Gentoo OS' do
605620
include_examples 'Gentoo'
606621

@@ -636,6 +651,7 @@
636651
).that_notifies('Class[Apache::Service]')
637652
}
638653
end
654+
639655
context 'on all OSes' do
640656
include_examples 'RedHat 8'
641657

@@ -653,6 +669,7 @@
653669
).that_notifies('Class[Apache::Service]')
654670
}
655671
end
672+
656673
context 'with a custom file_mode parameter' do
657674
let :params do
658675
{
@@ -666,6 +683,7 @@
666683
)
667684
}
668685
end
686+
669687
context 'with a custom root_directory_options parameter' do
670688
let :params do
671689
{
@@ -675,6 +693,7 @@
675693

676694
it { is_expected.to contain_file('/etc/httpd/conf/httpd.conf').with_content %r{Options -Indexes -FollowSymLinks} }
677695
end
696+
678697
context 'with a custom root_directory_secured parameter' do
679698
let :params do
680699
{
@@ -684,11 +703,13 @@
684703

685704
it { is_expected.to contain_file('/etc/httpd/conf/httpd.conf').with_content %r{Options FollowSymLinks\n\s+AllowOverride None\n\s+Require all denied} }
686705
end
706+
687707
context 'default vhost defaults' do
688708
it { is_expected.to contain_apache__vhost('default').with_ensure('present') }
689709
it { is_expected.to contain_apache__vhost('default-ssl').with_ensure('absent') }
690710
it { is_expected.to contain_file('/etc/httpd/conf/httpd.conf').with_content %r{Options FollowSymLinks} }
691711
end
712+
692713
context 'without default non-ssl vhost' do
693714
let :params do
694715
{
@@ -699,6 +720,7 @@
699720
it { is_expected.to contain_apache__vhost('default').with_ensure('absent') }
700721
it { is_expected.not_to contain_file('/var/www/html') }
701722
end
723+
702724
context 'with default ssl vhost' do
703725
let :params do
704726
{
@@ -710,6 +732,7 @@
710732
it { is_expected.to contain_file('/var/www/html') }
711733
end
712734
end
735+
713736
context 'with unsupported osfamily' do
714737
include_examples 'Darwin'
715738

0 commit comments

Comments
 (0)