From 8e8267b33134c60bb3a3f4e1f9c6c6c75922a937 Mon Sep 17 00:00:00 2001 From: Hiro Asari Date: Wed, 8 Apr 2020 14:02:58 -0400 Subject: [PATCH] Merge pull request #416 from mrerrormessage/master Update restart for Travis API --- lib/travis/client/methods.rb | 2 +- spec/cli/restart_spec.rb | 10 +++++----- spec/support/fake_api.rb | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/travis/client/methods.rb b/lib/travis/client/methods.rb index b898fd09..5f20b650 100644 --- a/lib/travis/client/methods.rb +++ b/lib/travis/client/methods.rb @@ -74,7 +74,7 @@ def restart(entity) # btw, internally we call this reset, not restart, as it resets the state machine # but we thought that would be too confusing raise Error, "cannot restart a #{entity.class.one}" unless entity.restartable? - session.post_raw('/requests', "#{entity.class.one}_id" => entity.id) + session.post_raw("/#{entity.class.many}/#{entity.id}/restart") entity.reload end diff --git a/spec/cli/restart_spec.rb b/spec/cli/restart_spec.rb index c33e0d14..e1e17aef 100644 --- a/spec/cli/restart_spec.rb +++ b/spec/cli/restart_spec.rb @@ -3,13 +3,13 @@ describe Travis::CLI::Restart do example 'travis restart' do run_cli('restart', '-t', 'token').should be_success - $params['build_id'].should be == "4125095" - $params['job_id'].should be_nil + $params['id'].should be == "4125095" + $params['entity'].should be == "builds" end example 'travis restart 6180.1' do run_cli('restart', '6180.1', '-t', 'token').should be_success - $params['build_id'].should be_nil - $params['job_id'].should be == "4125096" + $params['entity'].should be == "jobs" + $params['id'].should be == "4125096" end -end \ No newline at end of file +end diff --git a/spec/support/fake_api.rb b/spec/support/fake_api.rb index d8a7c64d..b1a1a8d6 100644 --- a/spec/support/fake_api.rb +++ b/spec/support/fake_api.rb @@ -771,9 +771,9 @@ def authorized? }.to_json end - post '/requests' do + post '/:entity/:id/restart' do $params = params - "{}" + {} end post '/:entity/:id/cancel' do