module-nginx/spec/classes/nginx_spec.rb
Matthew Haughton 1898182c6d spec: cleanup
* Removed some tests that no longer apply and/or are redundant
* Only set OS facts when testing OS-specific behaviors. This simplifies the
  facts that must be set in the specs and saves running the same tests
  several times when the results wouldn't differ by OS anyway.
2014-12-09 19:47:05 -05:00

36 satır
1,7 KiB
Ruby

require 'spec_helper'
describe 'nginx' do
let :facts do
{
:osfamily => 'Gentoo',
}
end
let :params do
{
:nginx_upstreams => { 'upstream1' => { 'members' => ['localhost:3000']} },
:nginx_vhosts => { 'test2.local' => { 'www_root' => '/' } },
:nginx_vhosts_defaults => { 'listen_options' => 'default_server' },
:nginx_locations => { 'test2.local' => { 'vhost' => 'test2.local', 'www_root' => '/'} },
:nginx_mailhosts => { 'smtp.test2.local' => { 'auth_http' => 'server2.example/cgi-bin/auth', 'protocol' => 'smtp', 'listen_port' => 587} }
}
end
describe "with defaults" do
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_class('nginx') }
it { is_expected.to contain_anchor('nginx::begin') }
it { is_expected.to contain_nginx__package.that_requires('Anchor[nginx::begin]') }
it { is_expected.to contain_nginx__config.that_requires('Class[nginx::package]') }
it { is_expected.to contain_nginx__service.that_subscribes_to('Anchor[nginx::begin]') }
it { is_expected.to contain_nginx__service.that_subscribes_to('Class[nginx::package]') }
it { is_expected.to contain_nginx__service.that_subscribes_to('Class[nginx::config]') }
it { is_expected.to contain_anchor('nginx::end').that_requires('Class[nginx::service]') }
it { is_expected.to contain_nginx__resource__upstream("upstream1") }
it { is_expected.to contain_nginx__resource__vhost("test2.local") }
it { is_expected.to contain_nginx__resource__vhost("test2.local").with_listen_options('default_server') }
it { is_expected.to contain_nginx__resource__location("test2.local") }
it { is_expected.to contain_nginx__resource__mailhost("smtp.test2.local") }
end
end