Skip to content

Commit

Permalink
Added tests and cleaned up the template
Browse files Browse the repository at this point in the history
  • Loading branch information
Morgan Haskel committed Feb 26, 2015
1 parent 7c6199c commit 0780062
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
24 changes: 19 additions & 5 deletions spec/defines/vhost_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,18 @@
'access_log_format' => '%h %l %u %t \"%r\" %>s %b',
'access_log_env_var' => '',
'aliases' => '/image',
'directories' => {
'path' => '/var/www/files',
'provider' => 'files',
},
'directories' => [
{
'path' => '/var/www/files',
'provider' => 'files',
'require' => [ 'valid-user', 'all denied', ],
},
{
'path' => '/var/www/files',
'provider' => 'files',
'require' => 'all granted',
},
],
'error_log' => false,
'error_log_file' => 'httpd_error_log',
'error_log_pipe' => '',
Expand Down Expand Up @@ -277,7 +285,7 @@
let :facts do
{
:osfamily => 'RedHat',
:operatingsystemrelease => '6',
:operatingsystemrelease => '7',
:concat_basedir => '/dne',
:operatingsystem => 'RedHat',
:id => 'root',
Expand Down Expand Up @@ -328,6 +336,12 @@
it { is_expected.to contain_concat__fragment('rspec.example.com-itk') }
it { is_expected.to contain_concat__fragment('rspec.example.com-fallbackresource') }
it { is_expected.to contain_concat__fragment('rspec.example.com-directories') }
it { is_expected.to contain_concat__fragment('rspec.example.com-directories').with(
:content => /^\s+Require valid-user$/ ) }
it { is_expected.to contain_concat__fragment('rspec.example.com-directories').with(
:content => /^\s+Require all denied$/ ) }
it { is_expected.to contain_concat__fragment('rspec.example.com-directories').with(
:content => /^\s+Require all granted$/ ) }
it { is_expected.to contain_concat__fragment('rspec.example.com-additional_includes') }
it { is_expected.to contain_concat__fragment('rspec.example.com-logging') }
it { is_expected.to contain_concat__fragment('rspec.example.com-serversignature') }
Expand Down
4 changes: 2 additions & 2 deletions templates/vhost/_directories.erb
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
<%- end -%>
<%- if scope.function_versioncmp([@apache_version, '2.4']) >= 0 -%>
<%- if directory['require'] and directory['require'] != '' -%>
<%- Array(directory['require']).each do |require| -%>
Require <%= require %>
<%- Array(directory['require']).each do |req| -%>
Require <%= req %>
<%- end -%>
<%- end -%>
<%- if directory['auth_require'] -%>
Expand Down

0 comments on commit 0780062

Please sign in to comment.