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

integrations_controller_spec.rb « admin « requests « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 128aada09755a6e4605320f5000f7bb17cb9ff4c (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Admin::IntegrationsController, :enable_admin_mode do
  let_it_be(:admin) { create(:admin) }

  before do
    sign_in(admin)
  end

  describe 'GET #overrides' do
    let_it_be(:integration) { create(:jira_integration, :instance) }
    let_it_be(:overridden_integration) { create(:jira_integration) }
    let_it_be(:overridden_other_integration) { create(:confluence_integration) }

    let(:overrides_path) { overrides_admin_application_settings_integration_path(integration, format: format) }

    context 'format html' do
      let(:format) { :html }

      it 'renders' do
        get overrides_path

        expect(response).to have_gitlab_http_status(:ok)
        expect(response).to render_template('shared/integrations/overrides')
      end
    end

    context 'format json' do
      let(:format) { :json }
      let(:project) { overridden_integration.project }

      it 'returns the project overrides data' do
        get overrides_path

        expect(response).to have_gitlab_http_status(:ok)
        expect(response).to include_pagination_headers
        expect(json_response).to contain_exactly(
          {
            'id' => project.id,
            'avatar_url' => project.avatar_url,
            'full_name' => project.full_name,
            'name' => project.name,
            'full_path' => project_path(project)
          }
        )
      end
    end
  end
end