From d0a7a8600eb02f8103d40eb0a76f112525345c27 Mon Sep 17 00:00:00 2001 From: Rich Meyers Date: Tue, 2 Nov 2010 12:32:45 -0400 Subject: [PATCH] Test for issue #95 - terminating newlines should be preserved when updating crontab files --- test/functional/command_line_test.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/functional/command_line_test.rb b/test/functional/command_line_test.rb index fe18400..48f1e9e 100644 --- a/test/functional/command_line_test.rb +++ b/test/functional/command_line_test.rb @@ -303,6 +303,20 @@ NEW_CRON assert_equal new_cron, @command.send(:prepare, existing) end + + should "preserve terminating newlines in files" do + @command = Whenever::CommandLine.new(:update => true, :identifier => 'My identifier') + existing = <<-EXISTING_CRON +# Begin Whenever generated tasks for: My identifier +My whenever job that was already here +# End Whenever generated tasks for: My identifier + +# A non-Whenever task +My non-whenever job that was already here +EXISTING_CRON + + assert_equal existing, @command.send(:prepare, existing) + end end end