|
9 | 9 | it { is_expected.to contain_class('apache::params') }
|
10 | 10 |
|
11 | 11 | it {
|
12 |
| - is_expected.to contain_package('httpd').with( |
| 12 | + expect(subject).to contain_package('httpd').with( |
13 | 13 | 'notify' => 'Class[Apache::Service]',
|
14 | 14 | 'ensure' => 'installed',
|
15 | 15 | )
|
|
20 | 20 | it { is_expected.to contain_class('apache::service') }
|
21 | 21 |
|
22 | 22 | it {
|
23 |
| - is_expected.to contain_file('/var/www/html').with( |
| 23 | + expect(subject).to contain_file('/var/www/html').with( |
24 | 24 | 'ensure' => 'directory',
|
25 | 25 | )
|
26 | 26 | }
|
27 | 27 |
|
28 | 28 | it {
|
29 |
| - is_expected.to contain_file('/etc/apache2/sites-enabled').with( |
| 29 | + expect(subject).to contain_file('/etc/apache2/sites-enabled').with( |
30 | 30 | 'ensure' => 'directory', 'recurse' => 'true',
|
31 | 31 | 'purge' => 'true'
|
32 | 32 | ).that_notifies('Class[Apache::Service]').that_requires('Package[httpd]')
|
33 | 33 | }
|
34 | 34 |
|
35 | 35 | it {
|
36 |
| - is_expected.to contain_file('/etc/apache2/mods-enabled').with( |
| 36 | + expect(subject).to contain_file('/etc/apache2/mods-enabled').with( |
37 | 37 | 'ensure' => 'directory', 'recurse' => 'true',
|
38 | 38 | 'purge' => 'true'
|
39 | 39 | ).that_notifies('Class[Apache::Service]').that_requires('Package[httpd]')
|
40 | 40 | }
|
41 | 41 |
|
42 | 42 | it {
|
43 |
| - is_expected.to contain_file('/etc/apache2/mods-available').with( |
| 43 | + expect(subject).to contain_file('/etc/apache2/mods-available').with( |
44 | 44 | 'ensure' => 'directory', 'recurse' => 'true',
|
45 | 45 | 'purge' => 'false'
|
46 | 46 | ).that_notifies('Class[Apache::Service]').that_requires('Package[httpd]')
|
|
49 | 49 | it { is_expected.to contain_file('/etc/apache2/apache2.conf').without_content(%r{ServerAdmin}) }
|
50 | 50 |
|
51 | 51 | it {
|
52 |
| - is_expected.to contain_concat('/etc/apache2/ports.conf').with( |
| 52 | + expect(subject).to contain_concat('/etc/apache2/ports.conf').with( |
53 | 53 | 'owner' => 'root', 'group' => 'root',
|
54 | 54 | 'mode' => '0644'
|
55 | 55 | ).that_notifies('Class[Apache::Service]')
|
|
58 | 58 | # Assert that load files are placed and symlinked for these mods, but no conf file.
|
59 | 59 | ['auth_basic', 'authn_file', 'authz_groupfile', 'authz_host', 'authz_user', 'dav', 'env'].each do |modname|
|
60 | 60 | it {
|
61 |
| - is_expected.to contain_file("#{modname}.load").with( |
| 61 | + expect(subject).to contain_file("#{modname}.load").with( |
62 | 62 | 'path' => "/etc/apache2/mods-available/#{modname}.load",
|
63 | 63 | 'ensure' => 'file',
|
64 | 64 | )
|
65 | 65 | }
|
66 | 66 |
|
67 | 67 | it {
|
68 |
| - is_expected.to contain_file("#{modname}.load symlink").with( |
| 68 | + expect(subject).to contain_file("#{modname}.load symlink").with( |
69 | 69 | 'path' => "/etc/apache2/mods-enabled/#{modname}.load",
|
70 | 70 | 'ensure' => 'link',
|
71 | 71 | 'target' => "/etc/apache2/mods-available/#{modname}.load",
|
|
131 | 131 | # Assert that both load files and conf files are placed and symlinked for these mods
|
132 | 132 | ['alias', 'autoindex', 'dav_fs', 'deflate', 'dir', 'mime', 'negotiation', 'setenvif'].each do |modname|
|
133 | 133 | it {
|
134 |
| - is_expected.to contain_file("#{modname}.load").with( |
| 134 | + expect(subject).to contain_file("#{modname}.load").with( |
135 | 135 | 'path' => "/etc/apache2/mods-available/#{modname}.load",
|
136 | 136 | 'ensure' => 'file',
|
137 | 137 | )
|
138 | 138 | }
|
139 | 139 |
|
140 | 140 | it {
|
141 |
| - is_expected.to contain_file("#{modname}.load symlink").with( |
| 141 | + expect(subject).to contain_file("#{modname}.load symlink").with( |
142 | 142 | 'path' => "/etc/apache2/mods-enabled/#{modname}.load",
|
143 | 143 | 'ensure' => 'link',
|
144 | 144 | 'target' => "/etc/apache2/mods-available/#{modname}.load",
|
145 | 145 | )
|
146 | 146 | }
|
147 | 147 |
|
148 | 148 | it {
|
149 |
| - is_expected.to contain_file("#{modname}.conf").with( |
| 149 | + expect(subject).to contain_file("#{modname}.conf").with( |
150 | 150 | 'path' => "/etc/apache2/mods-available/#{modname}.conf",
|
151 | 151 | 'ensure' => 'file',
|
152 | 152 | )
|
153 | 153 | }
|
154 | 154 |
|
155 | 155 | it {
|
156 |
| - is_expected.to contain_file("#{modname}.conf symlink").with( |
| 156 | + expect(subject).to contain_file("#{modname}.conf symlink").with( |
157 | 157 | 'path' => "/etc/apache2/mods-enabled/#{modname}.conf",
|
158 | 158 | 'ensure' => 'link',
|
159 | 159 | 'target' => "/etc/apache2/mods-available/#{modname}.conf",
|
|
210 | 210 | ]
|
211 | 211 | it 'Expected to contain' do
|
212 | 212 | expected.each do |reg|
|
213 |
| - is_expected.to contain_file('/etc/apache2/apache2.conf').with_content reg |
| 213 | + expect(subject).to contain_file('/etc/apache2/apache2.conf').with_content reg |
214 | 214 | end
|
215 | 215 | end
|
216 | 216 |
|
217 | 217 | it 'Not expected to contain' do
|
218 | 218 | unexpected.each do |reg|
|
219 |
| - is_expected.to contain_file('/etc/apache2/apache2.conf').without_content reg |
| 219 | + expect(subject).to contain_file('/etc/apache2/apache2.conf').without_content reg |
220 | 220 | end
|
221 | 221 | end
|
222 | 222 | end
|
|
234 | 234 | include_examples 'Ubuntu 18.04'
|
235 | 235 |
|
236 | 236 | it {
|
237 |
| - is_expected.to contain_file('/var/www/html').with( |
| 237 | + expect(subject).to contain_file('/var/www/html').with( |
238 | 238 | 'ensure' => 'directory',
|
239 | 239 | )
|
240 | 240 | }
|
|
247 | 247 | it { is_expected.to contain_class('apache::params') }
|
248 | 248 |
|
249 | 249 | it {
|
250 |
| - is_expected.to contain_package('httpd').with( |
| 250 | + expect(subject).to contain_package('httpd').with( |
251 | 251 | 'notify' => 'Class[Apache::Service]',
|
252 | 252 | 'ensure' => 'installed',
|
253 | 253 | )
|
|
258 | 258 | it { is_expected.to contain_class('apache::service') }
|
259 | 259 |
|
260 | 260 | it {
|
261 |
| - is_expected.to contain_file('/var/www/html').with( |
| 261 | + expect(subject).to contain_file('/var/www/html').with( |
262 | 262 | 'ensure' => 'directory',
|
263 | 263 | )
|
264 | 264 | }
|
265 | 265 |
|
266 | 266 | it {
|
267 |
| - is_expected.to contain_file('/etc/httpd/conf.d').with( |
| 267 | + expect(subject).to contain_file('/etc/httpd/conf.d').with( |
268 | 268 | 'ensure' => 'directory', 'recurse' => 'true',
|
269 | 269 | 'purge' => 'true'
|
270 | 270 | ).that_notifies('Class[Apache::Service]').that_requires('Package[httpd]')
|
271 | 271 | }
|
272 | 272 |
|
273 | 273 | it {
|
274 |
| - is_expected.to contain_concat('/etc/httpd/conf/ports.conf').with( |
| 274 | + expect(subject).to contain_concat('/etc/httpd/conf/ports.conf').with( |
275 | 275 | 'owner' => 'root', 'group' => 'root',
|
276 | 276 | 'mode' => '0644'
|
277 | 277 | ).that_notifies('Class[Apache::Service]')
|
|
288 | 288 |
|
289 | 289 | ['mod.d', 'site.d', 'conf.d'].each do |dir|
|
290 | 290 | it {
|
291 |
| - is_expected.to contain_file("/etc/httpd/#{dir}").with( |
| 291 | + expect(subject).to contain_file("/etc/httpd/#{dir}").with( |
292 | 292 | 'ensure' => 'directory', 'recurse' => 'true',
|
293 | 293 | 'purge' => 'true'
|
294 | 294 | ).that_notifies('Class[Apache::Service]').that_requires('Package[httpd]')
|
|
298 | 298 | # Assert that load files are placed for these mods, but no conf file.
|
299 | 299 | ['auth_basic', 'authn_file', 'authz_groupfile', 'authz_host', 'authz_user', 'dav', 'env'].each do |modname|
|
300 | 300 | it {
|
301 |
| - is_expected.to contain_file("#{modname}.load").with_path( |
| 301 | + expect(subject).to contain_file("#{modname}.load").with_path( |
302 | 302 | "/etc/httpd/mod.d/#{modname}.load",
|
303 | 303 | )
|
304 | 304 | }
|
305 | 305 |
|
306 | 306 | it {
|
307 |
| - is_expected.not_to contain_file("#{modname}.conf").with_path( |
| 307 | + expect(subject).not_to contain_file("#{modname}.conf").with_path( |
308 | 308 | "/etc/httpd/mod.d/#{modname}.conf",
|
309 | 309 | )
|
310 | 310 | }
|
|
313 | 313 | # Assert that both load files and conf files are placed for these mods
|
314 | 314 | ['alias', 'autoindex', 'dav_fs', 'deflate', 'dir', 'mime', 'negotiation', 'setenvif'].each do |modname|
|
315 | 315 | it {
|
316 |
| - is_expected.to contain_file("#{modname}.load").with_path( |
| 316 | + expect(subject).to contain_file("#{modname}.load").with_path( |
317 | 317 | "/etc/httpd/mod.d/#{modname}.load",
|
318 | 318 | )
|
319 | 319 | }
|
320 | 320 |
|
321 | 321 | it {
|
322 |
| - is_expected.to contain_file("#{modname}.conf").with_path( |
| 322 | + expect(subject).to contain_file("#{modname}.conf").with_path( |
323 | 323 | "/etc/httpd/mod.d/#{modname}.conf",
|
324 | 324 | )
|
325 | 325 | }
|
|
375 | 375 | end
|
376 | 376 |
|
377 | 377 | it {
|
378 |
| - is_expected.to contain_file('/opt/rh/root/etc/httpd/conf/httpd.conf').with( |
| 378 | + expect(subject).to contain_file('/opt/rh/root/etc/httpd/conf/httpd.conf').with( |
379 | 379 | 'ensure' => 'file',
|
380 | 380 | ).that_notifies('Class[Apache::Service]').that_requires(['Package[httpd]', 'Concat[/etc/httpd/conf/ports.conf]'])
|
381 | 381 | }
|
|
387 | 387 | end
|
388 | 388 |
|
389 | 389 | it {
|
390 |
| - is_expected.to contain_file('/etc/httpd/special_conf.d').with( |
| 390 | + expect(subject).to contain_file('/etc/httpd/special_conf.d').with( |
391 | 391 | 'ensure' => 'directory', 'recurse' => 'true',
|
392 | 392 | 'purge' => 'true'
|
393 | 393 | ).that_notifies('Class[Apache::Service]').that_requires('Package[httpd]')
|
|
402 | 402 | unexpected = ['apache::mod::event', 'apache::mod::itk', 'apache::mod::peruser', 'apache::mod::prefork', 'apache::mod::worker']
|
403 | 403 | it 'does not declare mpm modules' do
|
404 | 404 | unexpected.each do |not_expect|
|
405 |
| - is_expected.not_to contain_class(not_expect) |
| 405 | + expect(subject).not_to contain_class(not_expect) |
406 | 406 | end
|
407 | 407 | end
|
408 | 408 | end
|
|
560 | 560 | it { is_expected.to contain_class('apache::service') }
|
561 | 561 |
|
562 | 562 | it {
|
563 |
| - is_expected.to contain_file('/usr/local/www/apache24/data').with( |
| 563 | + expect(subject).to contain_file('/usr/local/www/apache24/data').with( |
564 | 564 | 'ensure' => 'directory',
|
565 | 565 | )
|
566 | 566 | }
|
567 | 567 |
|
568 | 568 | it {
|
569 |
| - is_expected.to contain_file('/usr/local/etc/apache24/Vhosts').with( |
| 569 | + expect(subject).to contain_file('/usr/local/etc/apache24/Vhosts').with( |
570 | 570 | 'ensure' => 'directory', 'recurse' => 'true',
|
571 | 571 | 'purge' => 'true'
|
572 | 572 | ).that_notifies('Class[Apache::Service]').that_requires('Package[httpd]')
|
573 | 573 | }
|
574 | 574 |
|
575 | 575 | it {
|
576 |
| - is_expected.to contain_file('/usr/local/etc/apache24/Modules').with( |
| 576 | + expect(subject).to contain_file('/usr/local/etc/apache24/Modules').with( |
577 | 577 | 'ensure' => 'directory', 'recurse' => 'true',
|
578 | 578 | 'purge' => 'true'
|
579 | 579 | ).that_notifies('Class[Apache::Service]').that_requires('Package[httpd]')
|
580 | 580 | }
|
581 | 581 |
|
582 | 582 | it {
|
583 |
| - is_expected.to contain_concat('/usr/local/etc/apache24/ports.conf').with( |
| 583 | + expect(subject).to contain_concat('/usr/local/etc/apache24/ports.conf').with( |
584 | 584 | 'owner' => 'root', 'group' => 'wheel',
|
585 | 585 | 'mode' => '0644'
|
586 | 586 | ).that_notifies('Class[Apache::Service]')
|
|
589 | 589 | # Assert that load files are placed for these mods, but no conf file.
|
590 | 590 | ['auth_basic', 'authn_core', 'authn_file', 'authz_groupfile', 'authz_host', 'authz_user', 'dav', 'env'].each do |modname|
|
591 | 591 | it {
|
592 |
| - is_expected.to contain_file("#{modname}.load").with( |
| 592 | + expect(subject).to contain_file("#{modname}.load").with( |
593 | 593 | 'path' => "/usr/local/etc/apache24/Modules/#{modname}.load",
|
594 | 594 | 'ensure' => 'file',
|
595 | 595 | )
|
|
601 | 601 | # Assert that both load files and conf files are placed for these mods
|
602 | 602 | ['alias', 'autoindex', 'dav_fs', 'deflate', 'dir', 'mime', 'negotiation', 'setenvif'].each do |modname|
|
603 | 603 | it {
|
604 |
| - is_expected.to contain_file("#{modname}.load").with( |
| 604 | + expect(subject).to contain_file("#{modname}.load").with( |
605 | 605 | 'path' => "/usr/local/etc/apache24/Modules/#{modname}.load",
|
606 | 606 | 'ensure' => 'file',
|
607 | 607 | )
|
608 | 608 | }
|
609 | 609 |
|
610 | 610 | it {
|
611 |
| - is_expected.to contain_file("#{modname}.conf").with( |
| 611 | + expect(subject).to contain_file("#{modname}.conf").with( |
612 | 612 | 'path' => "/usr/local/etc/apache24/Modules/#{modname}.conf",
|
613 | 613 | 'ensure' => 'file',
|
614 | 614 | )
|
|
625 | 625 | it { is_expected.to contain_class('apache::service') }
|
626 | 626 |
|
627 | 627 | it {
|
628 |
| - is_expected.to contain_file('/var/www/localhost/htdocs').with( |
| 628 | + expect(subject).to contain_file('/var/www/localhost/htdocs').with( |
629 | 629 | 'ensure' => 'directory',
|
630 | 630 | )
|
631 | 631 | }
|
632 | 632 |
|
633 | 633 | it {
|
634 |
| - is_expected.to contain_file('/etc/apache2/vhosts.d').with( |
| 634 | + expect(subject).to contain_file('/etc/apache2/vhosts.d').with( |
635 | 635 | 'ensure' => 'directory', 'recurse' => 'true',
|
636 | 636 | 'purge' => 'true'
|
637 | 637 | ).that_notifies('Class[Apache::Service]').that_requires('Package[httpd]')
|
638 | 638 | }
|
639 | 639 |
|
640 | 640 | it {
|
641 |
| - is_expected.to contain_file('/etc/apache2/modules.d').with( |
| 641 | + expect(subject).to contain_file('/etc/apache2/modules.d').with( |
642 | 642 | 'ensure' => 'directory', 'recurse' => 'true',
|
643 | 643 | 'purge' => 'true'
|
644 | 644 | ).that_notifies('Class[Apache::Service]').that_requires('Package[httpd]')
|
645 | 645 | }
|
646 | 646 |
|
647 | 647 | it {
|
648 |
| - is_expected.to contain_concat('/etc/apache2/ports.conf').with( |
| 648 | + expect(subject).to contain_concat('/etc/apache2/ports.conf').with( |
649 | 649 | 'owner' => 'root', 'group' => 'wheel',
|
650 | 650 | 'mode' => '0644'
|
651 | 651 | ).that_notifies('Class[Apache::Service]')
|
|
663 | 663 | end
|
664 | 664 |
|
665 | 665 | it {
|
666 |
| - is_expected.to contain_package('httpd').with( |
| 666 | + expect(subject).to contain_package('httpd').with( |
667 | 667 | 'ensure' => 'installed',
|
668 | 668 | 'name' => 'httpd24-httpd',
|
669 | 669 | ).that_notifies('Class[Apache::Service]')
|
|
678 | 678 | end
|
679 | 679 |
|
680 | 680 | it {
|
681 |
| - is_expected.to contain_concat('/etc/httpd/conf/ports.conf').with( |
| 681 | + expect(subject).to contain_concat('/etc/httpd/conf/ports.conf').with( |
682 | 682 | 'mode' => '0640',
|
683 | 683 | )
|
684 | 684 | }
|
|
0 commit comments