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

jira_connect_spec.rb « atlassian « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 14bf13b8fe6f6fde3030a53e262c45ef164fec60 (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
# frozen_string_literal: true

require 'fast_spec_helper'

RSpec.describe Atlassian::JiraConnect, feature_category: :integrations do
  describe '.app_name' do
    subject { described_class.app_name }

    it { is_expected.to eq('GitLab for Jira (localhost)') }
  end

  describe '.app_key' do
    subject(:app_key) { described_class.app_key }

    it { is_expected.to eq('gitlab-jira-connect-localhost') }

    context 'host name is too long' do
      before do
        hostname = 'x' * 100

        stub_config(gitlab: { host: hostname })
      end

      it 'truncates the key to be no longer than 64 characters', :aggregate_failures do
        expect(app_key).to eq('gitlab-jira-connect-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
      end
    end

    context 'with jira_connect_proxy_url setting' do
      before do
        stub_application_setting(jira_connect_proxy_url: 'https://example.com')
      end

      it { is_expected.to eq('gitlab-jira-connect-example.com') }
    end
  end
end