Project

General

Profile

« Previous | Next » 

Revision 6f42d22e

Added by Ewoud Kohl van Wijngaarden about 4 years ago

Modulesync: use voxpupuli helper gems

View differences:

spec/spec_helper.rb
# This file is managed centrally by modulesync
# https://github.com/theforeman/foreman-installer-modulesync
RSpec.configure do |c|
c.mock_with :rspec
end
require 'puppetlabs_spec_helper/module_spec_helper'
require 'rspec-puppet-facts'
include RspecPuppetFacts
require 'voxpupuli/test/spec_helper'
# Original fact sources:
add_custom_fact :puppet_environmentpath, '/etc/puppetlabs/code/environments' # puppetlabs-stdlib
add_custom_fact :root_home, '/root' # puppetlabs-stdlib
add_custom_fact :systemd, true # puppet-systemd
# Workaround for no method in rspec-puppet to pass undef through :params
class Undef
def inspect; 'undef'; end
end
# Running tests with the ONLY_OS environment variable set
# limits the tested platforms to the specified values.
# Example: ONLY_OS=centos-7-x86_64,ubuntu-14-x86_64
def only_test_os
if ENV.key?('ONLY_OS')
ENV['ONLY_OS'].split(',')
end
end
# Running tests with the EXCLUDE_OS environment variable set
# limits the tested platforms to all but the specified values.
# Example: EXCLUDE_OS=centos-7-x86_64,ubuntu-14-x86_64
def exclude_test_os
if ENV.key?('EXCLUDE_OS')
ENV['EXCLUDE_OS'].split(',')
end
end
# Use the above environment variables to limit the platforms under test
def on_os_under_test
on_supported_os.reject do |os, facts|
(only_test_os() && !only_test_os.include?(os)) ||
(exclude_test_os() && exclude_test_os.include?(os))
end
end
def get_content(subject, title)
is_expected.to contain_file(title)
content = subject.resource('file', title).send(:parameters)[:content]

Also available in: Unified diff