summaryrefslogtreecommitdiffstats
path: root/spec/unit/provider.rb
blob: 9d781540b770f345957d03c997f9de64a9baafe8 (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
#!/usr/bin/env ruby

require File.dirname(__FILE__) + '/../spec_helper'

describe Puppet::Provider do
    it "should have a specifity class method" do
        Puppet::Provider.should respond_to(:specificity)
    end

    it "should consider two defaults to be higher specificity than one default" do
        one = Class.new(Puppet::Provider)
        one.initvars
        one.defaultfor :operatingsystem => "solaris"

        two = Class.new(Puppet::Provider)
        two.initvars
        two.defaultfor :operatingsystem => "solaris", :operatingsystemrelease => "5.10"

        two.specificity.should > one.specificity
    end

    it "should consider a subclass more specific than its parent class" do
        one = Class.new(Puppet::Provider)
        one.initvars

        two = Class.new(one)
        two.initvars

        two.specificity.should > one.specificity
    end
end