From 0b90333d2ca6fb2fa8ff77618851cfb30bd9eead Mon Sep 17 00:00:00 2001 From: luke Date: Tue, 18 Jul 2006 15:35:15 +0000 Subject: Fixing #191. I was only testing for parsed cron instances, not for created ones. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1402 980ebf18-57e1-0310-9a29-db15c13687c0 --- test/types/cron.rb | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'test') diff --git a/test/types/cron.rb b/test/types/cron.rb index 3b6384d59..fee09b360 100755 --- a/test/types/cron.rb +++ b/test/types/cron.rb @@ -35,6 +35,7 @@ class TestCron < Test::Unit::TestCase def teardown @crontype.filetype = @oldfiletype + Puppet::FileType.filetype(:ram).clear super end @@ -677,6 +678,41 @@ class TestCron < Test::Unit::TestCase assert(list.include?(cron.name), "Did not match cron %s" % name) end end + + # Make sure we can create a cron in an empty tab + def test_mkcron_if_empty + @crontype.filetype = @oldfiletype + + @crontype.retrieve(@me) + + # Backup our tab + text = @crontype.tabobj(@me).read + + cleanup do + if text == "" + @crontype.tabobj(@me).remove + else + @crontype.tabobj(@me).write(text) + end + end + + # Now get rid of it + @crontype.tabobj(@me).remove + @crontype.clear + + cron = mkcron("emptycron") + + assert_apply(cron) + + # Clear the type, but don't clear the filetype + @crontype.clear + + # Get the stuff again + @crontype.retrieve(@me) + + assert(@crontype["emptycron"], + "Did not retrieve cron") + end end # $Id$ -- cgit