File: init_spec.rb

package info (click to toggle)
puppet 3.7.2-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 18,896 kB
  • sloc: ruby: 210,387; sh: 2,050; xml: 1,554; lisp: 300; makefile: 142; python: 108; sql: 103; yacc: 72
file content (46 lines) | stat: -rwxr-xr-x 1,238 bytes parent folder | download | duplicates (3)
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
38
39
40
41
42
43
44
45
46
#! /usr/bin/env ruby
require 'spec_helper'

provider = Puppet::Type.type(:service).provider(:init)

describe provider do
  describe "when running on FreeBSD" do
    before :each do
      Facter.stubs(:value).with(:operatingsystem).returns 'FreeBSD'
    end

    it "should set its default path to include /etc/rc.d and /usr/local/etc/rc.d" do
      provider.defpath.should == ["/etc/rc.d", "/usr/local/etc/rc.d"]
    end
  end

  describe "when running on HP-UX" do
    before :each do
      Facter.stubs(:value).with(:operatingsystem).returns 'HP-UX'
    end

    it "should set its default path to include /sbin/init.d" do
      provider.defpath.should == "/sbin/init.d"
    end
  end

  describe "when running on Archlinux" do
    before :each do
      Facter.stubs(:value).with(:operatingsystem).returns 'Archlinux'
    end

    it "should set its default path to include /etc/rc.d" do
      provider.defpath.should == "/etc/rc.d"
    end
  end

  describe "when not running on FreeBSD, HP-UX or Archlinux" do
    before :each do
      Facter.stubs(:value).with(:operatingsystem).returns 'RedHat'
    end

    it "should set its default path to include /etc/init.d" do
      provider.defpath.should == "/etc/init.d"
    end
  end
end