Welcome to mirror list, hosted at ThFree Co, Russian Federation.

services_spec.rb « api « requests « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 51c543578df747fec3bb0a5e5d3a7103248137a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
require "spec_helper"

describe API::API, api: true  do
  include ApiHelpers
  let(:user) { create(:user) }
  let(:project) {create(:project, creator_id: user.id, namespace: user.namespace) }

  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"

      expect(response.status).to eq(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

      expect(response.status).to eq(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)

      expect(response.status).to eq(200)
      expect(project.gitlab_ci_service).to be_nil
    end
  end

  describe 'PUT /projects/:id/services/hipchat' do
    it 'should update hipchat settings' do
      put api("/projects/#{project.id}/services/hipchat", user),
          token: 'secret-token', room: 'test'

      expect(response.status).to eq(200)
      expect(project.hipchat_service).not_to be_nil
    end

    it 'should return if required fields missing' do
      put api("/projects/#{project.id}/services/gitlab-ci", user),
          token: 'secret-token', active: true

      expect(response.status).to eq(400)
    end
  end

  describe 'DELETE /projects/:id/services/hipchat' do
    it 'should delete hipchat settings' do
      delete api("/projects/#{project.id}/services/hipchat", user)

      expect(response.status).to eq(200)
      expect(project.hipchat_service).to be_nil
    end
  end
end