2013-10-29 10:39:46 -04:00
|
|
|
require "spec_helper"
|
|
|
|
|
2014-04-11 15:45:56 -04:00
|
|
|
describe API::API, api: true do
|
2013-10-29 10:39:46 -04:00
|
|
|
include ApiHelpers
|
|
|
|
let(:user) { create(:user) }
|
2014-01-22 14:03:52 -05:00
|
|
|
let(:project) {create(:project, creator_id: user.id, namespace: user.namespace) }
|
2013-10-29 10:39:46 -04:00
|
|
|
|
|
|
|
describe "POST /projects/:id/services/gitlab-ci" do
|
|
|
|
it "should update gitlab-ci settings" do
|
|
|
|
put api("/projects/#{project.id}/services/gitlab-ci", user), token: 'secret-token', project_url: "http://ci.example.com/projects/1"
|
|
|
|
|
|
|
|
response.status.should == 200
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should return if required fields missing" do
|
|
|
|
put api("/projects/#{project.id}/services/gitlab-ci", user), project_url: "http://ci.example.com/projects/1", active: true
|
|
|
|
|
|
|
|
response.status.should == 400
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "DELETE /projects/:id/services/gitlab-ci" do
|
|
|
|
it "should update gitlab-ci settings" do
|
|
|
|
delete api("/projects/#{project.id}/services/gitlab-ci", user)
|
|
|
|
|
|
|
|
response.status.should == 200
|
|
|
|
project.gitlab_ci_service.should be_nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|