summaryrefslogtreecommitdiffstats
path: root/spec/unit/provider_spec.rb
blob: 4eb5e12de94a0ef7241a4ee0345b07eb71528433 (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
#!/usr/bin/env rspec
require '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