pass one of spec cleanup

This commit is contained in:
James Fryman 2014-09-20 18:25:24 -05:00
parent 678256fa3d
commit 4c5f1e3b2a
14 changed files with 39 additions and 65 deletions

View file

@ -73,8 +73,7 @@ define nginx::resource::geo (
if ($proxies != undef) { validate_array($proxies) } if ($proxies != undef) { validate_array($proxies) }
if ($proxy_recursive != undef) { validate_bool($proxy_recursive) } if ($proxy_recursive != undef) { validate_bool($proxy_recursive) }
include nginx::params $root_group = $nginx::config::root_group
$root_group = $nginx::params::root_group
$ensure_real = $ensure ? { $ensure_real = $ensure ? {
'absent' => 'absent', 'absent' => 'absent',

View file

@ -172,8 +172,7 @@ define nginx::resource::location (
$flv = false, $flv = false,
) { ) {
include nginx::params $root_group = $nginx::config::root_group
$root_group = $nginx::params::root_group
File { File {
owner => 'root', owner => 'root',

View file

@ -61,8 +61,7 @@ define nginx::resource::mailhost (
$server_name = [$name] $server_name = [$name]
) { ) {
include nginx::params $root_group = $nginx::config::root_group
$root_group = $nginx::params::root_group
File { File {
owner => 'root', owner => 'root',

View file

@ -57,8 +57,7 @@ define nginx::resource::map (
"Invalid ensure value '${ensure}'. Expected 'present' or 'absent'") "Invalid ensure value '${ensure}'. Expected 'present' or 'absent'")
if ($default != undef) { validate_string($default) } if ($default != undef) { validate_string($default) }
include nginx::params $root_group = $nginx::config::root_group
$root_group = $nginx::params::root_group
$ensure_real = $ensure ? { $ensure_real = $ensure ? {
'absent' => absent, 'absent' => absent,

View file

@ -3,18 +3,18 @@ describe 'nginx::config' do
describe 'with defaults' do describe 'with defaults' do
[ [
{ :osfamily => 'debian', :operatingsystem => 'debian', }, { :osfamily => 'Debian', :operatingsystem => 'Debian', },
{ :osfamily => 'debian', :operatingsystem => 'ubuntu', }, { :osfamily => 'Debian', :operatingsystem => 'Ubuntu', },
{ :osfamily => 'redhat', :operatingsystem => 'fedora', }, { :osfamily => 'Redhat', :operatingsystem => 'Fedora', },
{ :osfamily => 'redhat', :operatingsystem => 'rhel', }, { :osfamily => 'Redhat', :operatingsystem => 'RedHat', },
{ :osfamily => 'redhat', :operatingsystem => 'redhat', }, { :osfamily => 'Redhat', :operatingsystem => 'OracleLinux', },
{ :osfamily => 'redhat', :operatingsystem => 'centos', }, { :osfamily => 'Redhat', :operatingsystem => 'CentOS', },
{ :osfamily => 'redhat', :operatingsystem => 'scientific', }, { :osfamily => 'Redhat', :operatingsystem => 'Scientific', },
{ :osfamily => 'redhat', :operatingsystem => 'amazon', }, { :osfamily => 'Redhat', :operatingsystem => 'Amazon', },
{ :osfamily => 'suse', :operatingsystem => 'suse', }, { :osfamily => 'SuSE', :operatingsystem => 'SuSE', },
{ :osfamily => 'suse', :operatingsystem => 'opensuse', }, { :osfamily => 'SuSE', :operatingsystem => 'OpenSuSE', },
{ :osfamily => 'gentoo', :operatingsystem => 'gentoo', }, { :osfamily => 'Gentoo', :operatingsystem => 'Gentoo', },
{ :osfamily => 'linux', :operatingsystem => 'gentoo', }, { :osfamily => 'Linux', :operatingsystem => 'Gentoo', },
].each do |facts| ].each do |facts|
context "when osfamily/operatingsystem is #{facts[:osfamily]}/#{facts[:operatingsystem]}" do context "when osfamily/operatingsystem is #{facts[:osfamily]}/#{facts[:operatingsystem]}" do
@ -26,8 +26,6 @@ describe 'nginx::config' do
} }
end end
it { is_expected.to contain_class("nginx::params") }
it { is_expected.to contain_file("/etc/nginx").only_with( it { is_expected.to contain_file("/etc/nginx").only_with(
:path => "/etc/nginx", :path => "/etc/nginx",
:ensure => 'directory', :ensure => 'directory',
@ -96,8 +94,8 @@ describe 'nginx::config' do
describe 'with defaults' do describe 'with defaults' do
[ [
{ :osfamily => 'debian', :operatingsystem => 'debian', }, { :osfamily => 'Debian', :operatingsystem => 'Debian', },
{ :osfamily => 'debian', :operatingsystem => 'ubuntu', }, { :osfamily => 'Debian', :operatingsystem => 'Ubuntu', },
].each do |facts| ].each do |facts|
context "when osfamily/operatingsystem is #{facts[:osfamily]}/#{facts[:operatingsystem]}" do context "when osfamily/operatingsystem is #{facts[:osfamily]}/#{facts[:operatingsystem]}" do
@ -117,16 +115,16 @@ describe 'nginx::config' do
describe 'with defaults' do describe 'with defaults' do
[ [
{ :osfamily => 'redhat', :operatingsystem => 'fedora', }, { :osfamily => 'RedHat', :operatingsystem => 'Fedora', },
{ :osfamily => 'redhat', :operatingsystem => 'rhel', }, { :osfamily => 'RedHat', :operatingsystem => 'RedHat', },
{ :osfamily => 'redhat', :operatingsystem => 'redhat', }, { :osfamily => 'RedHat', :operatingsystem => 'OracleLinux', },
{ :osfamily => 'redhat', :operatingsystem => 'centos', }, { :osfamily => 'RedHat', :operatingsystem => 'CentOS', },
{ :osfamily => 'redhat', :operatingsystem => 'scientific', }, { :osfamily => 'RedHat', :operatingsystem => 'Scientific', },
{ :osfamily => 'redhat', :operatingsystem => 'amazon', }, { :osfamily => 'RedHat', :operatingsystem => 'Amazon', },
{ :osfamily => 'suse', :operatingsystem => 'suse', }, { :osfamily => 'SuSE', :operatingsystem => 'SuSE', },
{ :osfamily => 'suse', :operatingsystem => 'opensuse', }, { :osfamily => 'SuSE', :operatingsystem => 'openSuSE', },
{ :osfamily => 'gentoo', :operatingsystem => 'gentoo', }, { :osfamily => 'Gentoo', :operatingsystem => 'Gentoo', },
{ :osfamily => 'linux', :operatingsystem => 'gentoo', }, { :osfamily => 'Linux', :operatingsystem => 'Gentoo', },
].each do |facts| ].each do |facts|
context "when osfamily/operatingsystem is #{facts[:osfamily]}/#{facts[:operatingsystem]}" do context "when osfamily/operatingsystem is #{facts[:osfamily]}/#{facts[:operatingsystem]}" do
@ -148,8 +146,8 @@ describe 'nginx::config' do
let :facts do let :facts do
{ {
:osfamily => 'debian', :osfamily => 'Debian',
:operatingsystem => 'debian', :operatingsystem => 'Debian',
} }
end end

View file

@ -4,7 +4,7 @@ describe 'nginx::package' do
shared_examples 'redhat' do |operatingsystem| shared_examples 'redhat' do |operatingsystem|
let(:facts) {{ :operatingsystem => operatingsystem, :osfamily => 'RedHat' }} let(:facts) {{ :operatingsystem => operatingsystem, :osfamily => 'RedHat' }}
spec/classes/package_spec.rb
context "using defaults" do context "using defaults" do
it { is_expected.to contain_package('nginx') } it { is_expected.to contain_package('nginx') }
it { is_expected.to contain_yumrepo('nginx-release').with( it { is_expected.to contain_yumrepo('nginx-release').with(

View file

@ -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

View file

@ -3,7 +3,7 @@ describe 'nginx::service' do
let :facts do { let :facts do {
:osfamily => 'Debian', :osfamily => 'Debian',
:operatingsystem => 'debian', :operatingsystem => 'Debian',
} end } end
let :params do { let :params do {

View file

@ -26,7 +26,6 @@ describe 'nginx::resource::geo' do
let :pre_condition do let :pre_condition do
[ [
'include ::nginx::params',
'include ::nginx::config', 'include ::nginx::config',
] ]
end end

View file

@ -8,12 +8,11 @@ describe 'nginx::resource::location' do
let :facts do let :facts do
{ {
:osfamily => 'Debian', :osfamily => 'Debian',
:operatingsystem => 'debian', :operatingsystem => 'Debian',
} }
end end
let :pre_condition do let :pre_condition do
[ [
'include ::nginx::params',
'include ::nginx::config', 'include ::nginx::config',
] ]
end end
@ -26,7 +25,6 @@ describe 'nginx::resource::location' do
:vhost => 'vhost1', :vhost => 'vhost1',
} end } end
it { is_expected.to contain_class("nginx::params") }
it { is_expected.to contain_class("nginx::config") } it { is_expected.to contain_class("nginx::config") }
it { is_expected.to contain_concat__fragment("f25e14942fb58942ee13b1465a4e1719").with_content(/location rspec-test/) } it { is_expected.to contain_concat__fragment("f25e14942fb58942ee13b1465a4e1719").with_content(/location rspec-test/) }
it { is_expected.not_to contain_file('/etc/nginx/fastcgi_params') } it { is_expected.not_to contain_file('/etc/nginx/fastcgi_params') }

View file

@ -6,8 +6,8 @@ describe 'nginx::resource::mailhost' do
end end
let :facts do let :facts do
{ {
:osfamily => 'debian', :osfamily => 'Debian',
:operatingsystem => 'debian', :operatingsystem => 'Debian',
:ipaddress6 => '::', :ipaddress6 => '::',
} }
end end

View file

@ -13,7 +13,6 @@ describe 'nginx::resource::upstream' do
let :pre_condition do let :pre_condition do
[ [
'include ::nginx::params',
'include ::nginx::config', 'include ::nginx::config',
] ]
end end
@ -28,7 +27,6 @@ describe 'nginx::resource::upstream' do
let :pre_condition do let :pre_condition do
[ [
'include ::nginx::params',
'include ::nginx::config', 'include ::nginx::config',
] ]
end end
@ -39,7 +37,6 @@ describe 'nginx::resource::upstream' do
describe 'basic assumptions' do describe 'basic assumptions' do
let :params do default_params end 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_class('concat::setup') }
it { is_expected.to contain_file("/etc/nginx/conf.d/#{title}-upstream.conf") } 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}/) } it { is_expected.to contain_concat__fragment("#{title}_upstream_header").with_content(/upstream #{title}/) }

View file

@ -19,7 +19,6 @@ describe 'nginx::resource::vhost' do
end end
let :pre_condition do let :pre_condition do
[ [
'include ::nginx::params',
'include ::nginx::config', 'include ::nginx::config',
] ]
end end
@ -28,7 +27,6 @@ describe 'nginx::resource::vhost' do
describe 'basic assumptions' do describe 'basic assumptions' do
let :params do default_params end 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_class("nginx::config") }
it { is_expected.to contain_concat("/etc/nginx/sites-available/#{title}.conf").with({ it { is_expected.to contain_concat("/etc/nginx/sites-available/#{title}.conf").with({
'owner' => 'root', 'owner' => 'root',

View file

@ -1,6 +1,9 @@
require 'puppetlabs_spec_helper/module_spec_helper' require 'puppetlabs_spec_helper/module_spec_helper'
require 'fixtures/modules/module_data/lib/hiera/backend/module_data_backend.rb'
RSpec.configure do |c| RSpec.configure do |c|
c.hiera_config = File.join('spec', 'fixtures', 'hiera', 'hiera.yaml')
c.default_facts = { c.default_facts = {
:kernel => 'Linux', :kernel => 'Linux',
:concat_basedir => '/var/lib/puppet/concat', :concat_basedir => '/var/lib/puppet/concat',