From 9bdfe694bc6c60a48b45f8dd49c20c6da31445f7 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Sat, 11 Sep 2010 10:23:38 -0500 Subject: Fix for Bug #4756 - Providers no longer respect missing features Restored deleted lines from type.rb and reinstated unit tests --- spec/unit/type/service_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'spec') diff --git a/spec/unit/type/service_spec.rb b/spec/unit/type/service_spec.rb index 0f4a50750..0958a69fa 100755 --- a/spec/unit/type/service_spec.rb +++ b/spec/unit/type/service_spec.rb @@ -76,10 +76,18 @@ describe Puppet::Type.type(:service), "when validating attribute values" do it "should allow setting the :enable parameter if the provider has the :enableable feature" do Puppet::Type.type(:service).defaultprovider.stubs(:supports_parameter?).returns(true) + Puppet::Type.type(:service).defaultprovider.expects(:supports_parameter?).with(Puppet::Type.type(:service).attrclass(:enable)).returns(true) svc = Puppet::Type.type(:service).new(:name => "yay", :enable => true) svc.should(:enable).should == :true end + it "should not allow setting the :enable parameter if the provider is missing the :enableable feature" do + Puppet::Type.type(:service).defaultprovider.stubs(:supports_parameter?).returns(true) + Puppet::Type.type(:service).defaultprovider.expects(:supports_parameter?).with(Puppet::Type.type(:service).attrclass(:enable)).returns(false) + svc = Puppet::Type.type(:service).new(:name => "yay", :enable => true) + svc.should(:enable).should be_nil + end + it "should split paths on ':'" do FileTest.stubs(:exist?).returns(true) FileTest.stubs(:directory?).returns(true) -- cgit