pass one of spec cleanup
This commit is contained in:
parent
678256fa3d
commit
4c5f1e3b2a
14 changed files with 39 additions and 65 deletions
|
@ -73,8 +73,7 @@ define nginx::resource::geo (
|
|||
if ($proxies != undef) { validate_array($proxies) }
|
||||
if ($proxy_recursive != undef) { validate_bool($proxy_recursive) }
|
||||
|
||||
include nginx::params
|
||||
$root_group = $nginx::params::root_group
|
||||
$root_group = $nginx::config::root_group
|
||||
|
||||
$ensure_real = $ensure ? {
|
||||
'absent' => 'absent',
|
||||
|
|
|
@ -172,8 +172,7 @@ define nginx::resource::location (
|
|||
$flv = false,
|
||||
) {
|
||||
|
||||
include nginx::params
|
||||
$root_group = $nginx::params::root_group
|
||||
$root_group = $nginx::config::root_group
|
||||
|
||||
File {
|
||||
owner => 'root',
|
||||
|
|
|
@ -61,8 +61,7 @@ define nginx::resource::mailhost (
|
|||
$server_name = [$name]
|
||||
) {
|
||||
|
||||
include nginx::params
|
||||
$root_group = $nginx::params::root_group
|
||||
$root_group = $nginx::config::root_group
|
||||
|
||||
File {
|
||||
owner => 'root',
|
||||
|
|
|
@ -57,8 +57,7 @@ define nginx::resource::map (
|
|||
"Invalid ensure value '${ensure}'. Expected 'present' or 'absent'")
|
||||
if ($default != undef) { validate_string($default) }
|
||||
|
||||
include nginx::params
|
||||
$root_group = $nginx::params::root_group
|
||||
$root_group = $nginx::config::root_group
|
||||
|
||||
$ensure_real = $ensure ? {
|
||||
'absent' => absent,
|
||||
|
|
|
@ -3,18 +3,18 @@ describe 'nginx::config' do
|
|||
|
||||
describe 'with defaults' do
|
||||
[
|
||||
{ :osfamily => 'debian', :operatingsystem => 'debian', },
|
||||
{ :osfamily => 'debian', :operatingsystem => 'ubuntu', },
|
||||
{ :osfamily => 'redhat', :operatingsystem => 'fedora', },
|
||||
{ :osfamily => 'redhat', :operatingsystem => 'rhel', },
|
||||
{ :osfamily => 'redhat', :operatingsystem => 'redhat', },
|
||||
{ :osfamily => 'redhat', :operatingsystem => 'centos', },
|
||||
{ :osfamily => 'redhat', :operatingsystem => 'scientific', },
|
||||
{ :osfamily => 'redhat', :operatingsystem => 'amazon', },
|
||||
{ :osfamily => 'suse', :operatingsystem => 'suse', },
|
||||
{ :osfamily => 'suse', :operatingsystem => 'opensuse', },
|
||||
{ :osfamily => 'gentoo', :operatingsystem => 'gentoo', },
|
||||
{ :osfamily => 'linux', :operatingsystem => 'gentoo', },
|
||||
{ :osfamily => 'Debian', :operatingsystem => 'Debian', },
|
||||
{ :osfamily => 'Debian', :operatingsystem => 'Ubuntu', },
|
||||
{ :osfamily => 'Redhat', :operatingsystem => 'Fedora', },
|
||||
{ :osfamily => 'Redhat', :operatingsystem => 'RedHat', },
|
||||
{ :osfamily => 'Redhat', :operatingsystem => 'OracleLinux', },
|
||||
{ :osfamily => 'Redhat', :operatingsystem => 'CentOS', },
|
||||
{ :osfamily => 'Redhat', :operatingsystem => 'Scientific', },
|
||||
{ :osfamily => 'Redhat', :operatingsystem => 'Amazon', },
|
||||
{ :osfamily => 'SuSE', :operatingsystem => 'SuSE', },
|
||||
{ :osfamily => 'SuSE', :operatingsystem => 'OpenSuSE', },
|
||||
{ :osfamily => 'Gentoo', :operatingsystem => 'Gentoo', },
|
||||
{ :osfamily => 'Linux', :operatingsystem => 'Gentoo', },
|
||||
].each do |facts|
|
||||
|
||||
context "when osfamily/operatingsystem is #{facts[:osfamily]}/#{facts[:operatingsystem]}" do
|
||||
|
@ -26,8 +26,6 @@ describe 'nginx::config' do
|
|||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_class("nginx::params") }
|
||||
|
||||
it { is_expected.to contain_file("/etc/nginx").only_with(
|
||||
:path => "/etc/nginx",
|
||||
:ensure => 'directory',
|
||||
|
@ -96,8 +94,8 @@ describe 'nginx::config' do
|
|||
|
||||
describe 'with defaults' do
|
||||
[
|
||||
{ :osfamily => 'debian', :operatingsystem => 'debian', },
|
||||
{ :osfamily => 'debian', :operatingsystem => 'ubuntu', },
|
||||
{ :osfamily => 'Debian', :operatingsystem => 'Debian', },
|
||||
{ :osfamily => 'Debian', :operatingsystem => 'Ubuntu', },
|
||||
].each do |facts|
|
||||
|
||||
context "when osfamily/operatingsystem is #{facts[:osfamily]}/#{facts[:operatingsystem]}" do
|
||||
|
@ -117,16 +115,16 @@ describe 'nginx::config' do
|
|||
|
||||
describe 'with defaults' do
|
||||
[
|
||||
{ :osfamily => 'redhat', :operatingsystem => 'fedora', },
|
||||
{ :osfamily => 'redhat', :operatingsystem => 'rhel', },
|
||||
{ :osfamily => 'redhat', :operatingsystem => 'redhat', },
|
||||
{ :osfamily => 'redhat', :operatingsystem => 'centos', },
|
||||
{ :osfamily => 'redhat', :operatingsystem => 'scientific', },
|
||||
{ :osfamily => 'redhat', :operatingsystem => 'amazon', },
|
||||
{ :osfamily => 'suse', :operatingsystem => 'suse', },
|
||||
{ :osfamily => 'suse', :operatingsystem => 'opensuse', },
|
||||
{ :osfamily => 'gentoo', :operatingsystem => 'gentoo', },
|
||||
{ :osfamily => 'linux', :operatingsystem => 'gentoo', },
|
||||
{ :osfamily => 'RedHat', :operatingsystem => 'Fedora', },
|
||||
{ :osfamily => 'RedHat', :operatingsystem => 'RedHat', },
|
||||
{ :osfamily => 'RedHat', :operatingsystem => 'OracleLinux', },
|
||||
{ :osfamily => 'RedHat', :operatingsystem => 'CentOS', },
|
||||
{ :osfamily => 'RedHat', :operatingsystem => 'Scientific', },
|
||||
{ :osfamily => 'RedHat', :operatingsystem => 'Amazon', },
|
||||
{ :osfamily => 'SuSE', :operatingsystem => 'SuSE', },
|
||||
{ :osfamily => 'SuSE', :operatingsystem => 'openSuSE', },
|
||||
{ :osfamily => 'Gentoo', :operatingsystem => 'Gentoo', },
|
||||
{ :osfamily => 'Linux', :operatingsystem => 'Gentoo', },
|
||||
].each do |facts|
|
||||
|
||||
context "when osfamily/operatingsystem is #{facts[:osfamily]}/#{facts[:operatingsystem]}" do
|
||||
|
@ -148,8 +146,8 @@ describe 'nginx::config' do
|
|||
|
||||
let :facts do
|
||||
{
|
||||
:osfamily => 'debian',
|
||||
:operatingsystem => 'debian',
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'Debian',
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ describe 'nginx::package' do
|
|||
|
||||
shared_examples 'redhat' do |operatingsystem|
|
||||
let(:facts) {{ :operatingsystem => operatingsystem, :osfamily => 'RedHat' }}
|
||||
|
||||
spec/classes/package_spec.rb
|
||||
context "using defaults" do
|
||||
it { is_expected.to contain_package('nginx') }
|
||||
it { is_expected.to contain_yumrepo('nginx-release').with(
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'nginx::params' do
|
||||
context "On a Debian OS" do
|
||||
let :facts do {
|
||||
:osfamily => 'debian',
|
||||
:operatingsystem => 'debian',
|
||||
} end
|
||||
|
||||
it { is_expected.to contain_nginx__params }
|
||||
it { is_expected.to have_class_count(1) } #only nginx::params itself
|
||||
it { is_expected.to have_resource_count(0) } #params class should never declare resources
|
||||
|
||||
end
|
||||
end
|
|
@ -3,14 +3,14 @@ describe 'nginx::service' do
|
|||
|
||||
let :facts do {
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'debian',
|
||||
:operatingsystem => 'Debian',
|
||||
} end
|
||||
|
||||
let :params do {
|
||||
:configtest_enable => false,
|
||||
:service_restart => '/etc/init.d/nginx configtest && /etc/init.d/nginx restart',
|
||||
:service_ensure => 'running',
|
||||
} end
|
||||
} end
|
||||
|
||||
context "using default parameters" do
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ describe 'nginx::resource::geo' do
|
|||
|
||||
let :pre_condition do
|
||||
[
|
||||
'include ::nginx::params',
|
||||
'include ::nginx::config',
|
||||
]
|
||||
end
|
||||
|
|
|
@ -8,12 +8,11 @@ describe 'nginx::resource::location' do
|
|||
let :facts do
|
||||
{
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'debian',
|
||||
:operatingsystem => 'Debian',
|
||||
}
|
||||
end
|
||||
let :pre_condition do
|
||||
[
|
||||
'include ::nginx::params',
|
||||
'include ::nginx::config',
|
||||
]
|
||||
end
|
||||
|
@ -26,7 +25,6 @@ describe 'nginx::resource::location' do
|
|||
:vhost => 'vhost1',
|
||||
} end
|
||||
|
||||
it { is_expected.to contain_class("nginx::params") }
|
||||
it { is_expected.to contain_class("nginx::config") }
|
||||
it { is_expected.to contain_concat__fragment("f25e14942fb58942ee13b1465a4e1719").with_content(/location rspec-test/) }
|
||||
it { is_expected.not_to contain_file('/etc/nginx/fastcgi_params') }
|
||||
|
|
|
@ -6,8 +6,8 @@ describe 'nginx::resource::mailhost' do
|
|||
end
|
||||
let :facts do
|
||||
{
|
||||
:osfamily => 'debian',
|
||||
:operatingsystem => 'debian',
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'Debian',
|
||||
:ipaddress6 => '::',
|
||||
}
|
||||
end
|
||||
|
|
|
@ -13,7 +13,6 @@ describe 'nginx::resource::upstream' do
|
|||
|
||||
let :pre_condition do
|
||||
[
|
||||
'include ::nginx::params',
|
||||
'include ::nginx::config',
|
||||
]
|
||||
end
|
||||
|
@ -28,7 +27,6 @@ describe 'nginx::resource::upstream' do
|
|||
|
||||
let :pre_condition do
|
||||
[
|
||||
'include ::nginx::params',
|
||||
'include ::nginx::config',
|
||||
]
|
||||
end
|
||||
|
@ -39,7 +37,6 @@ describe 'nginx::resource::upstream' do
|
|||
describe 'basic assumptions' do
|
||||
let :params do default_params end
|
||||
|
||||
it { is_expected.to contain_class("nginx::params") }
|
||||
it { is_expected.to contain_class('concat::setup') }
|
||||
it { is_expected.to contain_file("/etc/nginx/conf.d/#{title}-upstream.conf") }
|
||||
it { is_expected.to contain_concat__fragment("#{title}_upstream_header").with_content(/upstream #{title}/) }
|
||||
|
|
|
@ -19,7 +19,6 @@ describe 'nginx::resource::vhost' do
|
|||
end
|
||||
let :pre_condition do
|
||||
[
|
||||
'include ::nginx::params',
|
||||
'include ::nginx::config',
|
||||
]
|
||||
end
|
||||
|
@ -28,7 +27,6 @@ describe 'nginx::resource::vhost' do
|
|||
|
||||
describe 'basic assumptions' do
|
||||
let :params do default_params end
|
||||
it { is_expected.to contain_class("nginx::params") }
|
||||
it { is_expected.to contain_class("nginx::config") }
|
||||
it { is_expected.to contain_concat("/etc/nginx/sites-available/#{title}.conf").with({
|
||||
'owner' => 'root',
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
require 'puppetlabs_spec_helper/module_spec_helper'
|
||||
require 'fixtures/modules/module_data/lib/hiera/backend/module_data_backend.rb'
|
||||
|
||||
RSpec.configure do |c|
|
||||
c.hiera_config = File.join('spec', 'fixtures', 'hiera', 'hiera.yaml')
|
||||
|
||||
c.default_facts = {
|
||||
:kernel => 'Linux',
|
||||
:concat_basedir => '/var/lib/puppet/concat',
|
||||
|
|
Loading…
Reference in a new issue