Revision c89523ca
Added by Ewoud Kohl van Wijngaarden about 4 years ago
spec/spec_helper.rb | ||
---|---|---|
|
||
require 'voxpupuli/test/spec_helper'
|
||
|
||
# Rough conversion of grepping in the puppet source:
|
||
# grep defaultfor lib/puppet/provider/service/*.rb
|
||
add_custom_fact :service_provider, ->(os, facts) do
|
||
case facts[:osfamily].downcase
|
||
when 'archlinux'
|
||
'systemd'
|
||
when 'darwin'
|
||
'launchd'
|
||
when 'debian'
|
||
'systemd'
|
||
when 'freebsd'
|
||
'freebsd'
|
||
when 'gentoo'
|
||
'openrc'
|
||
when 'openbsd'
|
||
'openbsd'
|
||
when 'redhat'
|
||
facts[:operatingsystemrelease].to_i >= 7 ? 'systemd' : 'redhat'
|
||
when 'suse'
|
||
facts[:operatingsystemmajrelease].to_i >= 12 ? 'systemd' : 'redhat'
|
||
when 'windows'
|
||
'windows'
|
||
else
|
||
'init'
|
||
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
Move custom facts to their own file
This is makes it compatible with modulesync