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

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

require 'spec_helper'

RSpec.describe 'JIRA OAuth Provider', feature_category: :integrations do
  describe 'JIRA DVCS OAuth Authorization' do
    let_it_be(:application) do
      create(:oauth_application, redirect_uri: oauth_jira_dvcs_callback_url, scopes: 'read_user')
    end

    let(:authorize_path) do
      oauth_jira_dvcs_authorize_path(client_id: application.uid,
        redirect_uri: oauth_jira_dvcs_callback_url,
        response_type: 'code',
        state: 'my_state',
        scope: 'read_user')
    end

    before do
      sign_in(user)
    end

    it_behaves_like 'Secure OAuth Authorizations' do
      before do
        visit authorize_path
      end
    end

    context 'when the flag is disabled' do
      let_it_be(:user) { create(:user) }

      before do
        stub_feature_flags(jira_dvcs_end_of_life_amnesty: false)
        visit authorize_path
      end

      it 'presents as an endpoint that does not exist' do
        expect(page).to have_gitlab_http_status(:not_found)
      end
    end
  end
end