3
3
require 'spec_helper'
5
5
describe Puppet::Type.type(:cron), :unless => Puppet.features.microsoft_windows? do
7
7
@provider_class = described_class.provide(:simple) { mk_resource_methods }
8
8
@provider_class.stubs(:suitable?).returns true
9
9
described_class.stubs(:defaultprovider).returns @provider_class
13
described_class.unprovide(:simple)
12
16
it "should have :name be its namevar" do
13
17
described_class.key_attributes.should == [:name]
448
describe "special" do
449
%w(reboot yearly annually monthly weekly daily midnight hourly).each do |value|
450
it "should support the value '#{value}'" do
451
expect { described_class.new(:name => 'foo', :special => value ) }.to_not raise_error(Puppet::Error, /cannot specify both a special schedule and a value/)
455
context "when combined with numeric schedule fields" do
456
context "which are 'absent'" do
457
[ %w(reboot yearly annually monthly weekly daily midnight hourly), :absent ].flatten.each { |value|
458
it "should accept the value '#{value}' for special" do
460
described_class.new(:name => 'foo', :minute => :absent, :special => value )
461
}.to_not raise_error(Puppet::Error, /cannot specify both a special schedule and a value/)
465
context "which are not absent" do
466
%w(reboot yearly annually monthly weekly daily midnight hourly).each { |value|
467
it "should not accept the value '#{value}' for special" do
469
described_class.new(:name => 'foo', :minute => "1", :special => value )
470
}.to raise_error(Puppet::Error, /cannot specify both a special schedule and a value/)
473
it "should accept the 'absent' value for special" do
475
described_class.new(:name => 'foo', :minute => "1", :special => :absent )
476
}.to_not raise_error(Puppet::Error, /cannot specify both a special schedule and a value/)
444
482
describe "environment" do
445
483
it "it should accept an :environment that looks like a path" do