Skip to content

Commit

Permalink
Merge pull request #251 from cmurphy/rspec-puppet-2
Browse files Browse the repository at this point in the history
Test updates and lint fixes
  • Loading branch information
Morgan Haskel committed Mar 24, 2015
2 parents c1eef64 + dffe18d commit b6d8f57
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 26 deletions.
6 changes: 6 additions & 0 deletions .sync.yml
@@ -1,3 +1,9 @@
---
.travis.yml:
extras:
- 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"
spec/spec_helper.rb:
unmanaged: true
19 changes: 15 additions & 4 deletions .travis.yml
@@ -1,17 +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.9.3
env: PUPPET_GEM_VERSION="~> 3.4.0"
- 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"
env: PUPPET_GEM_VERSION="~> 3.0"
- rvm: 1.9.3
env: PUPPET_GEM_VERSION="~> 3.0"
- rvm: 2.0.0
- rvm: 1.9.3
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
@@ -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
2 changes: 1 addition & 1 deletion Rakefile
@@ -1,7 +1,7 @@
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'

PuppetLint.configuration.fail_on_warnings
PuppetLint.configuration.fail_on_warnings = true
PuppetLint.configuration.send('relative')
PuppetLint.configuration.send('disable_80chars')
PuppetLint.configuration.send('disable_class_inherits_from_params_class')
Expand Down
16 changes: 8 additions & 8 deletions manifests/config.pp
@@ -1,22 +1,22 @@
#
class ntp::config inherits ntp {

if $keys_enable {
$directory = ntp_dirname($keys_file)
if $ntp::keys_enable {
$directory = ntp_dirname($ntp::keys_file)
file { $directory:
ensure => directory,
owner => 0,
group => 0,
mode => '0755',
ensure => directory,
owner => 0,
group => 0,
mode => '0755',
}
}

file { $config:
file { $ntp::config:
ensure => file,
owner => 0,
group => 0,
mode => '0644',
content => template($config_template),
content => template($ntp::config_template),
}

}
6 changes: 3 additions & 3 deletions manifests/install.pp
@@ -1,10 +1,10 @@
#
class ntp::install inherits ntp {

if $package_manage {
if $ntp::package_manage {

package { $package_name:
ensure => $package_ensure,
package { $ntp::package_name:
ensure => $ntp::package_ensure,
}

}
Expand Down
10 changes: 5 additions & 5 deletions manifests/service.pp
@@ -1,15 +1,15 @@
#
class ntp::service inherits ntp {

if ! ($service_ensure in [ 'running', 'stopped' ]) {
if ! ($ntp::service_ensure in [ 'running', 'stopped' ]) {
fail('service_ensure parameter must be running or stopped')
}

if $service_manage == true {
if $ntp::service_manage == true {
service { 'ntp':
ensure => $service_ensure,
enable => $service_enable,
name => $service_name,
ensure => $ntp::service_ensure,
enable => $ntp::service_enable,
name => $ntp::service_name,
hasstatus => true,
hasrestart => true,
}
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/ntp_spec.rb
Expand Up @@ -411,8 +411,8 @@
})
end

it { expect{ subject }.to raise_error(
/^The ntp module is not supported on an unsupported based system./
it { expect{ catalogue }.to raise_error(
/The ntp module is not supported on an unsupported based system./
)}
end
end
Expand Down

0 comments on commit b6d8f57

Please sign in to comment.