2013-10-29 14:39:46 +00:00
|
|
|
require "spec_helper"
|
|
|
|
|
2014-04-11 19:45:56 +00:00
|
|
|
describe API::API, api: true do
|
2013-10-29 14:39:46 +00:00
|
|
|
include ApiHelpers
|
|
|
|
let(:user) { create(:user) }
|
2014-01-22 19:03:52 +00:00
|
|
|
let(:project) {create(:project, creator_id: user.id, namespace: user.namespace) }
|
2013-10-29 14:39:46 +00: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
|