Skip to content

Commit

Permalink
Merge pull request #1084 from cmurphy/rspec-puppet-2
Browse files Browse the repository at this point in the history
Test and future parser updates
  • Loading branch information
Morgan Haskel committed Mar 24, 2015
2 parents 0cba390 + 4182dcf commit 0cf9df0
Show file tree
Hide file tree
Showing 13 changed files with 38 additions and 37 deletions.
8 changes: 4 additions & 4 deletions .sync.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
.travis.yml:
extras:
- rvm: 1.9.3
env: PUPPET_GEM_VERSION="~> 3.5.0" STRICT_VARIABLES="yes"
- rvm: 2.0.0
env: PUPPET_GEM_VERSION="~> 3.5.0" STRICT_VARIABLES="yes"
- rvm: 1.8.7
env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.6.0"
- rvm: 1.8.7
env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0"
Rakefile:
extra_disabled_lint_checks:
- 'disable_only_variable_string'
Expand Down
23 changes: 15 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
---
sudo: false
language: ruby
bundler_args: --without system_tests
script: "bundle exec rake validate && bundle exec rake lint && bundle exec rake spec SPEC_OPTS='--format documentation'"
matrix:
fast_finish: true
include:
- rvm: 1.8.7
env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.6.0"
- rvm: 1.8.7
env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0"
- rvm: 1.9.3
env: PUPPET_GEM_VERSION="~> 3.4.0"
- rvm: 1.8.7
env: PUPPET_GEM_VERSION="~> 3.0"
- rvm: 2.0.0
- rvm: 1.9.3
env: PUPPET_GEM_VERSION="~> 3.0"
- rvm: 1.9.3
env: PUPPET_GEM_VERSION="~> 3.5.0" STRICT_VARIABLES="yes"
- rvm: 2.0.0
env: PUPPET_GEM_VERSION="~> 3.5.0" STRICT_VARIABLES="yes"
env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes"
- rvm: 2.1.5
env: PUPPET_GEM_VERSION="~> 3.0"
- rvm: 2.1.5
env: PUPPET_GEM_VERSION="~> 3.4.0"
- rvm: 2.1.5
env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes"
- rvm: 1.8.7
env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.6.0"
- rvm: 1.8.7
env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0"
notifications:
email: false
3 changes: 0 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
source ENV['GEM_SOURCE'] || "https://rubygems.org"

group :development, :unit_tests do
gem 'rake', :require => false
gem 'rspec-core', '3.1.7', :require => false
gem 'rspec-puppet', '~> 1.0', :require => false
gem 'puppetlabs_spec_helper', :require => false
gem 'puppet-lint', :require => false
gem 'simplecov', :require => false
gem 'puppet_facts', :require => false
gem 'json', :require => false
Expand Down
8 changes: 5 additions & 3 deletions manifests/dev.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
}
include ::apache::params
$packages = $::apache::params::dev_packages
package { $packages:
ensure => present,
require => Package['httpd'],
if $packages { # FreeBSD doesn't have dev packages to install
package { $packages:
ensure => present,
require => Package['httpd'],
}
}
}
6 changes: 3 additions & 3 deletions spec/classes/apache_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@
let :params do
{ :mpm_module => 'breakme' }
end
it { expect { subject }.to raise_error Puppet::Error, /does not match/ }
it { expect { catalogue }.to raise_error Puppet::Error, /does not match/ }
end
end

Expand Down Expand Up @@ -561,7 +561,7 @@
end
it "should fail" do
expect do
subject
catalogue
end.to raise_error(Puppet::Error, /"foo" does not match/)
end
end
Expand Down Expand Up @@ -794,7 +794,7 @@

it do
expect {
should compile
catalogue
}.to raise_error(Puppet::Error, /Unsupported osfamily/)
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/mod/fcgid_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
} end

it 'should contain the correct config' do
content = subject.resource('file', 'fcgid.conf').send(:parameters)[:content]
content = catalogue.resource('file', 'fcgid.conf').send(:parameters)[:content]
expect(content.split("\n").reject { |c| c =~ /(^#|^$)/ }).to eq([
'<IfModule mod_fcgid.c>',
' AddHandler fcgid-script .fcgi',
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/mod/peruser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
end
it do
expect {
should compile
catalogue
}.to raise_error(Puppet::Error, /Unsupported osfamily FreeBSD/)
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/mod/ssl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
:is_pe => false,
}
end
it { expect { subject }.to raise_error(Puppet::Error, /Unsupported osfamily:/) }
it { expect { catalogue }.to raise_error(Puppet::Error, /Unsupported osfamily:/) }
end

context 'on a RedHat OS' do
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/mod/wsgi_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,15 @@
:mod_path => '/foo/bar/baz',
}
end
it { expect { subject }.to raise_error Puppet::Error, /apache::mod::wsgi - both package_name and mod_path must be specified!/ }
it { expect { catalogue }.to raise_error Puppet::Error, /apache::mod::wsgi - both package_name and mod_path must be specified!/ }
end
describe "with mod_path but no package_name" do
let :params do
{
:package_name => '/foo/bar/baz',
}
end
it { expect { subject }.to raise_error Puppet::Error, /apache::mod::wsgi - both package_name and mod_path must be specified!/ }
it { expect { catalogue }.to raise_error Puppet::Error, /apache::mod::wsgi - both package_name and mod_path must be specified!/ }
end
end
context "on a FreeBSD OS" do
Expand Down
5 changes: 1 addition & 4 deletions spec/classes/params_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@
end
it { is_expected.to contain_apache__params }

# There are 4 resources in this class currently
# there should not be any more resources because it is a params class
# The resources are class[apache::version], class[apache::params], class[main], class[settings], stage[main]
it "Should not contain any resources" do
expect(subject.resources.size).to eq(5)
should have_resource_count(0)
end
end
end
4 changes: 2 additions & 2 deletions spec/classes/service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@
let (:params) {{ :service_enable => 'not-a-boolean' }}

it 'should fail' do
expect { subject }.to raise_error(Puppet::Error, /is not a boolean/)
expect { catalogue }.to raise_error(Puppet::Error, /is not a boolean/)
end
end

context "$service_manage must be a bool" do
let (:params) {{ :service_manage => 'not-a-boolean' }}

it 'should fail' do
expect { subject }.to raise_error(Puppet::Error, /is not a boolean/)
expect { catalogue }.to raise_error(Puppet::Error, /is not a boolean/)
end
end

Expand Down
6 changes: 3 additions & 3 deletions spec/defines/custom_config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@
end
it do
expect {
should compile
catalogue
}.to raise_error(Puppet::Error, /Only one of \$content and \$source can be specified\./)
end
end
context 'neither content nor source' do
it do
expect {
should compile
catalogue
}.to raise_error(Puppet::Error, /One of \$content and \$source must be specified\./)
end
end
Expand All @@ -130,7 +130,7 @@
end
it do
expect {
should compile
catalogue
}.to raise_error(Puppet::Error, /is not supported for ensure/)
end
end
Expand Down
2 changes: 0 additions & 2 deletions spec/defines/vhost_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@
'log_level' => 'crit',
'access_log' => false,
'access_log_file' => 'httpd_access_log',
'access_log_pipe' => '',
'access_log_syslog' => true,
'access_log_format' => '%h %l %u %t \"%r\" %>s %b',
'access_log_env_var' => '',
Expand All @@ -187,7 +186,6 @@
],
'error_log' => false,
'error_log_file' => 'httpd_error_log',
'error_log_pipe' => '',
'error_log_syslog' => true,
'error_documents' => 'true',
'fallbackresource' => '/index.php',
Expand Down

0 comments on commit 0cf9df0

Please sign in to comment.