diff --git a/lib/kumade/heroku.rb b/lib/kumade/heroku.rb index ef47d5b..f01e1db 100644 --- a/lib/kumade/heroku.rb +++ b/lib/kumade/heroku.rb @@ -32,7 +32,7 @@ def delete_deploy_branch end def heroku(command) - full_heroku_command = "#{bundle_exec_heroku} #{command} --remote #{Kumade.configuration.environment}" + full_heroku_command = "#{bundle_exec_heroku(command)} --remote #{Kumade.configuration.environment}" command_line = CommandLine.new(full_heroku_command) command_line.run_or_error("Failed to run #{command} on Heroku") end @@ -49,11 +49,11 @@ def cedar? private - def bundle_exec_heroku - if cedar? - "bundle exec heroku run" + def bundle_exec_heroku(command) + if cedar? and command != 'restart' + "bundle exec heroku run #{command}" else - "bundle exec heroku" + "bundle exec heroku #{command}" end end end diff --git a/spec/kumade/heroku_spec.rb b/spec/kumade/heroku_spec.rb index ded43bf..5493161 100644 --- a/spec/kumade/heroku_spec.rb +++ b/spec/kumade/heroku_spec.rb @@ -105,6 +105,13 @@ Kumade::CommandLine.should have_received(:new).with(regexp_matches(/bundle exec heroku run rake/)).once command_instance.should have_received(:run_or_error).once end + + it "runs restart command without `run`" do + subject.heroku("restart") + + Kumade::CommandLine.should have_received(:new).with(regexp_matches(/bundle exec heroku restart/)).once + command_instance.should have_received(:run_or_error).once + end end context "when not on Cedar" do