Commit 816559d6 authored by Sean OMeara's avatar Sean OMeara

savegame: broken specs

parent 3db253d3
......@@ -42,7 +42,7 @@ def initialize(*args)
end
def self.validate_predefined_value(spec)
return true if spec == ''
return true if spec.nil?
# Several special predefined values can substitute in the cron expression
if ['@reboot', '@yearly', '@annually', '@monthly', '@weekly', '@daily', '@midnight', '@hourly'].include? spec.downcase
return true
......@@ -52,6 +52,7 @@ def self.validate_predefined_value(spec)
end
def self.validate_numeric(spec, min, max)
# binding.pry
if spec.is_a? Fixnum
return false unless spec >= min && spec <= max
return true
......
......@@ -6,7 +6,7 @@ describe 'cron_test::default' do
end
it 'creates cron_d[bizarrely-scheduled-usage-report]' do
expect(chef_run).to create_crond_d('bizarrely-scheduled-usage-report').with(
expect(chef_run).to create_cron_d('bizarrely-scheduled-usage-report').with(
:minute => '*/5',
:hour => '1,23',
:day => '2-5',
......@@ -14,4 +14,24 @@ describe 'cron_test::default' do
:user => 'appuser'
)
end
it 'creates cron_d[test-month-usage-report]' do
expect(chef_run).to create_cron_d('test-month-usage-report').with(
:minute => '0',
:hour => '6',
:day => '1',
:command => '/srv/app/scripts/generate_report',
:user => 'appuser'
)
end
it 'creates cron_d[test-month-usage-report]' do
expect(chef_run).to create_cron_d('test-weekday-usage-report').with(
:minute => '45',
:hour => '13',
:day => '7',
:command => '/srv/app/scripts/generate_report',
:user => 'appuser'
)
end
end
#
# Cookbook Name:: cron
# Cookbook Name:: cron_test
# Recipe:: test
#
# Copyright:: (c) 2012, Opscode, Inc.
# Copyright:: (c) 2008-2014, Chef Software, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
......@@ -28,18 +28,20 @@ cron_d 'bizarrely-scheduled-usage-report' do
action :create
end
cron_d "test-month-usage-report" do
minute "0"
hour "6"
month "1"
command "/srv/app/scripts/generate_report"
user "appuser"
cron_d 'test-month-usage-report' do
minute '0'
hour '6'
month '1'
command '/srv/app/scripts/generate_report'
user 'appuser'
action :create
end
cron_d "test-weekday-usage-report" do
minute "45"
hour "13"
weekday "7"
command "/srv/app/scripts/generate_report"
user "appuser"
cron_d 'test-weekday-usage-report' do
minute '45'
hour '13'
weekday '7'
command '/srv/app/scripts/generate_report'
user 'appuser'
action :create
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment