summaryrefslogtreecommitdiff
path: root/spec/unit/facter/service_provider_spec.rb
blob: ad8a5fc5368bbac28bf6dcb38cf74c1d0e5ebcc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#! /usr/bin/env ruby -S rspec
require 'spec_helper'
require 'puppet/type'
require 'puppet/type/service'

describe 'service_provider', :type => :fact do
  before { Facter.clear }
  after { Facter.clear }

  context "macosx" do
    it "should return launchd" do
      provider = Puppet::Type.type(:service).provider(:launchd)
      Puppet::Type.type(:service).stubs(:defaultprovider).returns provider

      expect(Facter.fact(:service_provider).value).to eq('launchd')
    end
  end

  context "systemd" do
    it "should return systemd" do
      provider = Puppet::Type.type(:service).provider(:systemd)
      Puppet::Type.type(:service).stubs(:defaultprovider).returns provider

      expect(Facter.fact(:service_provider).value).to eq('systemd')
    end
  end

  context "redhat" do
    it "should return redhat" do
      provider = Puppet::Type.type(:service).provider(:redhat)
      Puppet::Type.type(:service).stubs(:defaultprovider).returns provider

      expect(Facter.fact(:service_provider).value).to eq('redhat')
    end
  end

end