Skip to content

Commit

Permalink
Move test for symlinks to unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Morgan Haskel committed Feb 12, 2015
1 parent daf88c5 commit 3c43cf6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 34 deletions.
33 changes: 0 additions & 33 deletions spec/acceptance/vhost_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,39 +92,6 @@ class { 'apache': }
end
end

context 'new vhost with enable symlink' do
it 'should configure an apache vhost and symlink it from $vhost_enable_dir' do
pp = <<-EOS
class { 'apache':
vhost_enable_dir => "#{$httpd_dir}/sites-enabled",
}
file { '#{$run_dir}':
ensure => 'directory',
recurse => true,
}
apache::vhost { 'first.example.com':
port => '80',
docroot => '/var/www/first',
require => File['#{$run_dir}'],
}
EOS
apply_manifest(pp, :catch_failures => true)
end

describe file("#{$vhost_dir}/25-first.example.com.conf") do
it { is_expected.to contain '<VirtualHost \*:80>' }
it { is_expected.to contain "ServerName first.example.com" }
end
describe file("#{$httpd_dir}/sites-enabled") do
it { is_expected.to contain_file("25-first.example.com.conf").with(
:ensure => 'link',
:path => "#{$httpd_dir}/sites-enabled/25-first.example.com.conf",
:target => "#{$vhost_dir}/25-first.example.com.conf"
) }
end
end

context 'new proxy vhost on port 80' do
it 'should configure an apache proxy vhost' do
pp = <<-EOS
Expand Down
7 changes: 6 additions & 1 deletion spec/defines/vhost_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

describe 'apache::vhost', :type => :define do
let :pre_condition do
'class { "apache": default_vhost => false, default_mods => false, }'
'class { "apache": default_vhost => false, default_mods => false, vhost_enable_dir => "/etc/apache2/sites-enabled"}'
end
let :title do
'rspec.example.com'
Expand Down Expand Up @@ -294,6 +294,11 @@
'notify' => 'Class[Apache::Service]',
})
}
it { is_expected.to contain_file('30-rspec.example.com.conf symlink').with({
'ensure' => 'link',
'path' => '/etc/apache2/sites-enabled/30-rspec.example.com.conf',
})
}
it { is_expected.to contain_concat__fragment('rspec.example.com-apache-header') }
it { is_expected.to contain_concat__fragment('rspec.example.com-docroot') }
it { is_expected.to contain_concat__fragment('rspec.example.com-aliases') }
Expand Down

0 comments on commit 3c43cf6

Please sign in to comment.