Merge "Add rspec-puppet-facts to the spec_helper"
This commit is contained in:
commit
223614fa50
1
Gemfile
1
Gemfile
@ -3,6 +3,7 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org"
|
||||
group :development, :test do
|
||||
gem 'puppetlabs_spec_helper', :require => 'false'
|
||||
gem 'rspec-puppet', '~> 2.2.0', :require => 'false'
|
||||
gem 'rspec-puppet-facts', :require => 'false'
|
||||
gem 'metadata-json-lint', :require => 'false'
|
||||
gem 'puppet-lint-param-docs', :require => 'false'
|
||||
gem 'puppet-lint-absolute_classname-check', :require => 'false'
|
||||
|
44
spec/defaults.rb
Normal file
44
spec/defaults.rb
Normal file
@ -0,0 +1,44 @@
|
||||
# This file contains a module to return a default set of facts and supported
|
||||
# operating systems for the tests in this module.
|
||||
module OSDefaults
|
||||
def self.get_facts(extra_facts={})
|
||||
{ :os_service_default => '<SERVICE DEFAULT>' }.merge(extra_facts)
|
||||
end
|
||||
|
||||
def self.get_supported_os
|
||||
[
|
||||
{
|
||||
"operatingsystem" => "CentOS",
|
||||
"operatingsystemrelease" => [
|
||||
"7.0"
|
||||
]
|
||||
},
|
||||
{
|
||||
"operatingsystem" => "RedHat",
|
||||
"operatingsystemrelease" => [
|
||||
"7.0"
|
||||
]
|
||||
},
|
||||
{
|
||||
"operatingsystem" => "Fedora",
|
||||
"operatingsystemrelease" => [
|
||||
"21",
|
||||
"22"
|
||||
]
|
||||
},
|
||||
{
|
||||
"operatingsystem" => "Ubuntu",
|
||||
"operatingsystemrelease" => [
|
||||
"14.04"
|
||||
]
|
||||
},
|
||||
{
|
||||
"operatingsystem" => "Debian",
|
||||
"operatingsystemrelease" => [
|
||||
"7",
|
||||
"8"
|
||||
]
|
||||
}
|
||||
]
|
||||
end
|
||||
end
|
@ -2,11 +2,17 @@ require 'puppetlabs_spec_helper/module_spec_helper'
|
||||
require 'shared_examples'
|
||||
require 'webmock/rspec'
|
||||
|
||||
require 'rspec-puppet-facts'
|
||||
include RspecPuppetFacts
|
||||
require 'defaults.rb'
|
||||
|
||||
RSpec.configure do |c|
|
||||
c.alias_it_should_behave_like_to :it_configures, 'configures'
|
||||
c.alias_it_should_behave_like_to :it_raises, 'raises'
|
||||
# TODO(aschultz): remove this after all tests converted to use OSDefaults
|
||||
# instead of referencing @default_facts
|
||||
c.before :each do
|
||||
@default_facts = { :os_service_default => '<SERVICE DEFAULT>' }
|
||||
@default_facts = OSDefaults.get_facts
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user