if cron is not installed the specs will throw errors abould not finding
a default provider. Because the spec doesn't test provider features it
shouldn't depend on any providers.

Add stubs to let cron_spec work with no suitable provider

Signed-off-by: Stefan Schulte <[email protected]>
---
 spec/unit/type/cron_spec.rb |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/spec/unit/type/cron_spec.rb b/spec/unit/type/cron_spec.rb
index 03817d2..1fe654d 100755
--- a/spec/unit/type/cron_spec.rb
+++ b/spec/unit/type/cron_spec.rb
@@ -4,7 +4,18 @@ Dir.chdir(File.dirname(__FILE__)) { (s = lambda { |f| 
File.exist?(f) ? require(f
 
 describe Puppet::Type.type(:cron) do
   before do
-    @cron = Puppet::Type.type(:cron).new( :name => "foo" )
+    @class = Puppet::Type.type(:cron)
+
+    # Init a fake provider
+    @provider_class = stub 'provider_class', :ancestors => [], :name => 
'fake', :suitable? => true, :supports_parameter? => true
+    @class.stubs(:defaultprovider).returns @provider_class
+    @class.stubs(:provider).returns @provider_class
+
+    @provider = stub 'provider', :class => @provider_class, :clean => nil
+    @provider.stubs(:is_a?).returns false
+    @provider_class.stubs(:new).returns @provider
+
+    @cron = @class.new( :name => "foo" )
   end
 
   it "it should accept an :environment that looks like a path" do
-- 
1.7.4.rc1

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to