nginx_spec.rb 1.8 KB

123456789101112131415161718192021222324252627282930313233343536
  1. require 'spec_helper'
  2. describe 'nginx' do
  3. let :facts do
  4. {
  5. :osfamily => 'Gentoo',
  6. }
  7. end
  8. let :params do
  9. {
  10. :nginx_upstreams => { 'upstream1' => { 'members' => ['localhost:3000']} },
  11. :nginx_vhosts => { 'test2.local' => { 'www_root' => '/' } },
  12. :nginx_vhosts_defaults => { 'listen_options' => 'default_server' },
  13. :nginx_locations => { 'test2.local' => { 'vhost' => 'test2.local', 'www_root' => '/'} },
  14. :nginx_mailhosts => { 'smtp.test2.local' => { 'auth_http' => 'server2.example/cgi-bin/auth', 'protocol' => 'smtp', 'listen_port' => 587} }
  15. }
  16. end
  17. describe "with defaults" do
  18. it { is_expected.to compile.with_all_deps }
  19. it { is_expected.to contain_class('nginx') }
  20. it { is_expected.to contain_anchor('nginx::begin') }
  21. it { is_expected.to contain_class('nginx::package').that_requires('Anchor[nginx::begin]') }
  22. it { is_expected.to contain_class('nginx::config').that_requires('Class[nginx::package]') }
  23. it { is_expected.to contain_class('nginx::service').that_subscribes_to('Anchor[nginx::begin]') }
  24. it { is_expected.to contain_class('nginx::service').that_subscribes_to('Class[nginx::package]') }
  25. it { is_expected.to contain_class('nginx::service').that_subscribes_to('Class[nginx::config]') }
  26. it { is_expected.to contain_anchor('nginx::end').that_requires('Class[nginx::service]') }
  27. it { is_expected.to contain_nginx__resource__upstream("upstream1") }
  28. it { is_expected.to contain_nginx__resource__vhost("test2.local") }
  29. it { is_expected.to contain_nginx__resource__vhost("test2.local").with_listen_options('default_server') }
  30. it { is_expected.to contain_nginx__resource__location("test2.local") }
  31. it { is_expected.to contain_nginx__resource__mailhost("smtp.test2.local") }
  32. end
  33. end