services_spec.rb 981 字节
Newer Older
1 2
require "spec_helper"

J
Jeroen van Baarsen 已提交
3
describe API::API, api: true  do
4 5
  include ApiHelpers
  let(:user) { create(:user) }
D
Dmitriy Zaporozhets 已提交
6
  let(:project) {create(:project, creator_id: user.id, namespace: user.namespace) }
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

  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