Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -714,9 +714,9 @@ def authorized?
}]}.to_json
end

post '/requests' do
post '/:entity/:id/restart' do
$params = params
"{}"
{}
end

post '/:entity/:id/cancel' do
Expand Down