From 92e727c09ee3a08b605f1cb1ac49d1406fb3b6d2 Mon Sep 17 00:00:00 2001 From: Sam Ruby Date: Thu, 9 Jul 2009 22:57:14 +0800 Subject: [PATCH] Fixed a bug involving double quotes and runner Signed-off-by: Javan Makhmali --- lib/job_types/runner.rb | 2 +- test/output_runner_test.rb | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/job_types/runner.rb b/lib/job_types/runner.rb index ade9ea7..8b98bc8 100644 --- a/lib/job_types/runner.rb +++ b/lib/job_types/runner.rb @@ -4,7 +4,7 @@ module Whenever def output path_required - %Q(#{File.join(@path, 'script', 'runner')} -e #{@environment} "#{task}") + %Q(#{File.join(@path, 'script', 'runner')} -e #{@environment} #{task.inspect}) end end diff --git a/test/output_runner_test.rb b/test/output_runner_test.rb index 0142852..b0e352c 100644 --- a/test/output_runner_test.rb +++ b/test/output_runner_test.rb @@ -190,4 +190,20 @@ class OutputRunnerTest < Test::Unit::TestCase end end -end \ No newline at end of file + context "A runner which makes use of double quotes" do + setup do + @output = Whenever.cron \ + <<-file + set :path, '/my/path' + every 2.hours do + runner 'Product.import("http://example.com/product.xml")' + end + file + end + + should "output the runner using the original environmnet" do + assert_match two_hours + ' /my/path/script/runner -e production "Product.import(\"http://example.com/product.xml\")"', @output + end + end + +end