Skip to content

Commit

Permalink
Merge pull request #1 from xaque208/testing
Browse files Browse the repository at this point in the history
Begin testing the module
  • Loading branch information
zachfi authored and Zach Leslie committed Feb 5, 2015
2 parents f87c252 + 3d86cc7 commit 4c312e0
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.DS_Store
pkg/
*.swp
*.swo
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
language: ruby
bundler_args: --without development
before_install: rm Gemfile.lock || true
rvm:
- 1.9.3
- 2.0.0
- 2.1.0
script: bundle exec rake test
env:
- PUPPET_VERSION="~> 3.6.0" STRICT_VARIABLES=yes
- PUPPET_VERSION="~> 3.7.0" STRICT_VARIABLES=yes
22 changes: 22 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
source "https://rubygems.org"


group :test do
gem "rake"
gem "puppet", ENV['PUPPET_VERSION'] || '~> 3.6.0'
gem "puppet-lint"
gem 'rspec'
gem 'rspec-core'
gem 'rspec-mocks'
gem 'rspec-expectations'
gem "rspec-puppet", :git => 'https://github.com/rodjek/rspec-puppet.git'
gem "puppet-syntax"
gem "puppetlabs_spec_helper"
end

group :development do
gem "travis"
gem "travis-lint"
gem "puppet-blacksmith"
gem "metadata-json-lint"
end
50 changes: 50 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'
require 'puppet-syntax/tasks/puppet-syntax'

# These two gems aren't always present, for instance
# on Travis with --without development
begin
require 'puppet_blacksmith/rake_tasks'
rescue LoadError
end

PuppetLint.configuration.relative = true
PuppetLint.configuration.send("disable_80chars")
PuppetLint.configuration.log_format = "%{path}:%{linenumber}:%{check}:%{KIND}:%{message}"
PuppetLint.configuration.fail_on_warnings = true

# Forsake support for Puppet 2.6.2 for the benefit of cleaner code.
# http://puppet-lint.com/checks/class_parameter_defaults/
PuppetLint.configuration.send('disable_class_parameter_defaults')
# http://puppet-lint.com/checks/class_inherits_from_params_class/
PuppetLint.configuration.send('disable_class_inherits_from_params_class')

PuppetLint.configuration.send('disable_case_without_default')
#PuppetLint.configuration.send('disable_quoted_booleans')

exclude_paths = [
"pkg/**/*",
"vendor/**/*",
"spec/**/*",
]
PuppetLint.configuration.ignore_paths = exclude_paths
PuppetSyntax.exclude_paths = exclude_paths

desc "Run acceptance tests"
RSpec::Core::RakeTask.new(:acceptance) do |t|
t.pattern = 'spec/acceptance'
end

task :metadata do
sh "metadata-json-lint metadata.json"
end

desc "Run syntax, lint, and spec tests."
task :test => [
:syntax,
:lint,
:spec,
#:metadata,
]

12 changes: 12 additions & 0 deletions spec/classes/ssh_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
require 'spec_helper'

describe 'ssh' do
let(:facts) {
{
:operatingsystem => 'OpenBSD',
:concat_basedir => '/dne'
}
}
it { should contain_class('ssh') }
end

1 change: 1 addition & 0 deletions spec/fixtures/modules/ssh/files
1 change: 1 addition & 0 deletions spec/fixtures/modules/ssh/manifests
1 change: 1 addition & 0 deletions spec/fixtures/modules/ssh/templates
8 changes: 8 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require 'puppetlabs_spec_helper/module_spec_helper'

fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures'))

RSpec.configure do |c|
c.module_path = File.join(fixture_path, 'modules')
c.manifest_dir = File.join(fixture_path, 'manifests')
end

0 comments on commit 4c312e0

Please sign in to comment.