File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ include RspecPuppetFacts
4
+
5
+ Dir [ './spec/support/unit/**/*.rb' ] . sort . each { |f | require f }
6
+
7
+ RSpec . configure do |c |
8
+ c . fail_if_no_examples = true
9
+ c . silence_filter_announcements = true
10
+
11
+ c . expect_with :rspec do |expectations |
12
+ expectations . include_chain_clauses_in_custom_matcher_descriptions = true
13
+ end
14
+ end
Original file line number Diff line number Diff line change
1
+ # Rough conversion of grepping in the puppet source:
2
+ # grep defaultfor lib/puppet/provider/service/*.rb
3
+ # Source https://github.com/voxpupuli/voxpupuli-test/blob/master/lib/voxpupuli/test/facts.rb
4
+ add_custom_fact :service_provider , -> ( _os , facts ) do
5
+ os = RSpec . configuration . facterdb_string_keys ? facts [ 'os' ] : facts [ :os ]
6
+ case os [ 'family' ] . downcase
7
+ when 'archlinux'
8
+ 'systemd'
9
+ when 'darwin'
10
+ 'launchd'
11
+ when 'debian'
12
+ 'systemd'
13
+ when 'freebsd'
14
+ 'freebsd'
15
+ when 'gentoo'
16
+ 'openrc'
17
+ when 'openbsd'
18
+ 'openbsd'
19
+ when 'redhat'
20
+ ( os [ 'release' ] [ 'major' ] . to_i >= 7 ) ? 'systemd' : 'redhat'
21
+ when 'suse'
22
+ ( os [ 'release' ] [ 'major' ] . to_i >= 12 ) ? 'systemd' : 'redhat'
23
+ when 'windows'
24
+ 'windows'
25
+ else
26
+ 'init'
27
+ end
28
+ end
You can’t perform that action at this time.
0 commit comments