diff options
author | Hunter Haugen <hunter@puppetlabs.com> | 2015-09-24 10:55:39 -0700 |
---|---|---|
committer | Hunter Haugen <hunter@puppetlabs.com> | 2015-09-24 10:55:39 -0700 |
commit | 4d1bca3359519e6303d9b3543c56426606c8eba3 (patch) | |
tree | 191c693fe813e56c678ee0cdb0454cf45335bf4f /spec/unit | |
parent | 6bb1c27b99e9ae783afda652c454664c83bbfa61 (diff) | |
parent | 66e118a92aa480739f62e4675ed80c79ef80619c (diff) | |
download | puppet-stdlib-4d1bca3359519e6303d9b3543c56426606c8eba3.tar.gz puppet-stdlib-4d1bca3359519e6303d9b3543c56426606c8eba3.tar.bz2 |
Merge pull request #506 from binford2k/feature/service_provider_fact
Add a service_provider fact
Diffstat (limited to 'spec/unit')
-rw-r--r-- | spec/unit/facter/service_provider_spec.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/unit/facter/service_provider_spec.rb b/spec/unit/facter/service_provider_spec.rb new file mode 100644 index 0000000..ad8a5fc --- /dev/null +++ b/spec/unit/facter/service_provider_spec.rb @@ -0,0 +1,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 |