This repository has been archived by the owner on Jul 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from adamcrews/fix_spec
Cleanup some spec tests, added coverage report
- Loading branch information
Showing
7 changed files
with
75 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,28 @@ | ||
source ENV['GEM_SOURCE'] || "https://rubygems.org" | ||
rspecversion = ENV.key?('RSPEC_VERSION') ? "= #{ENV['RSPEC_VERSION']}" : ['>= 2.9 ', '< 3.0.0'] | ||
|
||
group :development, :test do | ||
gem 'rake', :require => false | ||
gem 'rspec-puppet', :require => false | ||
gem 'puppetlabs_spec_helper', :require => false | ||
gem 'serverspec', :require => false | ||
gem 'puppet-lint', :require => false | ||
gem 'rspec', '< 2.99', :require => false | ||
end | ||
gem 'rake' | ||
gem 'rspec', rspecversion | ||
gem 'rspec-puppet', :git => 'https://github.com/rodjek/rspec-puppet.git' | ||
gem 'rspec-puppet-utils' | ||
gem 'parallel_tests' | ||
gem 'puppet-lint' | ||
|
||
gem 'puppetlabs_spec_helper' | ||
|
||
#gem 'pry' | ||
#gem 'serverspec' | ||
|
||
if facterversion = ENV['FACTER_GEM_VERSION'] | ||
gem 'facter', facterversion, :require => false | ||
gem 'facter', facterversion | ||
else | ||
gem 'facter', :require => false | ||
gem 'facter', '< 2.0.0' | ||
end | ||
|
||
if puppetversion = ENV['PUPPET_GEM_VERSION'] | ||
gem 'puppet', puppetversion, :require => false | ||
gem 'puppet', puppetversion | ||
else | ||
gem 'puppet', :require => false | ||
gem 'puppet', '~> 3.6.0' | ||
end | ||
|
||
# vim:ft=ruby |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
require 'puppet-lint' | ||
require 'puppetlabs_spec_helper/rake_tasks' | ||
require 'puppet-lint/tasks/puppet-lint' | ||
|
||
PuppetLint.configuration.fail_on_warnings | ||
PuppetLint.configuration.send('disable_80chars') | ||
PuppetLint.configuration.send('disable_class_inherits_from_params_class') | ||
PuppetLint.configuration.send('disable_class_parameter_defaults') | ||
PuppetLint.configuration.send('disable_documentation') | ||
PuppetLint.configuration.send('disable_single_quote_string_with_variables') | ||
PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
at_exit { RSpec::Puppet::Coverage.report! } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,19 @@ | ||
require 'puppetlabs_spec_helper/module_spec_helper' | ||
require 'rspec-puppet-utils' | ||
|
||
FIXTURES_PATH = File.expand_path(File.dirname(__FILE__) + '/fixtures') | ||
# Set up our $LOAD_PATH to properly include custom provider code from modules | ||
# in spec/fixtures | ||
$LOAD_PATH.unshift(*Dir["#{FIXTURES_PATH}/modules/*/lib"]) | ||
|
||
Dir[File.absolute_path(File.dirname(__FILE__) + '/support/*.rb')].each do |f| | ||
require f | ||
end | ||
|
||
RSpec.configure do |c| | ||
c.mock_with :rspec | ||
c.formatter = :documentation | ||
c.default_facts = PathDefender::CentOS.centos_facts.merge({:fqdn => 'pd.example.com'}) | ||
c.hiera_config = File.join(FIXTURES_PATH, 'hiera.yaml') | ||
c.treat_symbols_as_metadata_keys_with_true_values = true | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# common utilities for CentOS servers | ||
# | ||
require 'rspec/core/shared_context' | ||
|
||
# we need a module to have a default shared_context, we can't use include_contest from RSpec.configure | ||
module PathDefender | ||
module CentOS | ||
extend RSpec::Core::SharedContext | ||
|
||
def self.centos_facts | ||
{ | ||
:ipaddress => '192.168.1.1', | ||
:kernel => 'Linux', | ||
:operatingsystem => 'CentOS', | ||
:operatingsystemrelease => '6.5', | ||
:osfamily => 'RedHat', | ||
:architecture => 'x86_64', | ||
:concat_basedir => "/tmp/concat", # Until we can upgrade rspec-puppet and supply this via default_facts | ||
} | ||
end | ||
|
||
let(:centos_facts) {centos_facts} | ||
let(:facts) { centos_facts } | ||
end | ||
end | ||
|
||
shared_context :centos do | ||
extend PathDefender::CentOS | ||
end | ||
|