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