Skip to content

Commit

Permalink
Merge pull request #416 from mrerrormessage/master
Browse files Browse the repository at this point in the history
Update restart for Travis API
  • Loading branch information
BanzaiMan committed Apr 8, 2020
2 parents ec5e473 + bcb147e commit 803d6c1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/travis/client/methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 5 additions & 5 deletions spec/cli/restart_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
end
4 changes: 2 additions & 2 deletions spec/support/fake_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 803d6c1

Please sign in to comment.