Sha256: 2926207b516099df574e5213301bb1567169ca520f453f2e141c8e5cdea9875b

Contents?: true

Size: 1.4 KB

Versions: 30

Compression:

Stored size: 1.4 KB

Contents

require File.dirname(__FILE__) + '/../../spec_helper'

include PoolParty::Resources

describe "Cron" do
  describe "instances" do
    before(:each) do
      @cloud = cloud :cron_resources do
        cron({:command => "/bin/logrotate"})
      end
      @cron = @cloud.resource(:cron).first
    end
    it "should turn the one hash instance into a string" do
      @cron.to_string.should =~ /'\/bin\/logrotate'/
    end
    it "should turn the two hash instance into a string" do
      @cron = cron({:name => "mail", :command => "/bin/mail -s \"letters\""})
      @cron.to_string.should =~ /"mail":/
    end
    describe "as included" do            
      before(:each) do
        reset_resources!
        @cron = cron({:rent => "low"}) do
          name "/www/conf/httpd.conf"
          hour 23
          minute 5
          weekday 1          
        end
      end
      it "should use default values" do
        @cron.name.should == "/www/conf/httpd.conf"
      end
      it "should keep the default values for the cron" do
        @cron.user.should == "root"
      end
      it "should also set options through a hash" do
        @cron.rent.should == "low"
      end
      it "should set the hour to 23" do
        @cron.hour.should == 23
      end
      it "should set the minute to 5" do
        @cron.minute.should == 5
      end
      it "should set the weekday to 1" do
        @cron.weekday.should == 1
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 2 rubygems

Version Path
auser-poolparty-0.2.62 spec/poolparty/pool/resources/cron_spec.rb
auser-poolparty-0.2.63 spec/poolparty/pool/resources/cron_spec.rb
auser-poolparty-0.2.64 spec/poolparty/pool/resources/cron_spec.rb
auser-poolparty-0.2.65 spec/poolparty/pool/resources/cron_spec.rb
auser-poolparty-0.2.66 spec/poolparty/pool/resources/cron_spec.rb
auser-poolparty-0.2.67 spec/poolparty/pool/resources/cron_spec.rb
auser-poolparty-0.2.68 spec/poolparty/pool/resources/cron_spec.rb
auser-poolparty-0.2.69 spec/poolparty/pool/resources/cron_spec.rb
auser-poolparty-0.2.70 spec/poolparty/pool/resources/cron_spec.rb
auser-poolparty-0.2.71 spec/poolparty/pool/resources/cron_spec.rb
auser-poolparty-0.2.72 spec/poolparty/pool/resources/cron_spec.rb
auser-poolparty-0.2.74 spec/poolparty/pool/resources/cron_spec.rb
auser-poolparty-0.2.76 spec/poolparty/pool/resources/cron_spec.rb
auser-poolparty-0.2.77 spec/poolparty/pool/resources/cron_spec.rb
auser-poolparty-0.2.78 spec/poolparty/pool/resources/cron_spec.rb
auser-poolparty-0.2.79 spec/poolparty/pool/resources/cron_spec.rb
auser-poolparty-0.2.80 spec/poolparty/poolparty/resources/cron_spec.rb
auser-poolparty-0.2.81 spec/poolparty/poolparty/resources/cron_spec.rb
auser-poolparty-0.2.84 spec/poolparty/poolparty/resources/cron_spec.rb
auser-poolparty-0.2.85 spec/poolparty/poolparty/resources/cron_spec.rb