summaryrefslogtreecommitdiffstats
path: root/spec/unit/provider.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/provider.rb')
-rwxr-xr-xspec/unit/provider.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/unit/provider.rb b/spec/unit/provider.rb
new file mode 100755
index 000000000..9d781540b
--- /dev/null
+++ b/spec/unit/provider.rb
@@ -0,0 +1,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