summaryrefslogtreecommitdiff
path: root/spec/models/jira_connect_installation_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/jira_connect_installation_spec.rb')
-rw-r--r--spec/models/jira_connect_installation_spec.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/models/jira_connect_installation_spec.rb b/spec/models/jira_connect_installation_spec.rb
index 3d1095845aa..9c1f7c678a9 100644
--- a/spec/models/jira_connect_installation_spec.rb
+++ b/spec/models/jira_connect_installation_spec.rb
@@ -45,4 +45,30 @@ RSpec.describe JiraConnectInstallation do
expect(subject).to contain_exactly(subscription.installation)
end
end
+
+ describe '#oauth_authorization_url' do
+ let_it_be(:installation) { create(:jira_connect_installation) }
+
+ subject { installation.oauth_authorization_url }
+
+ before do
+ allow(Gitlab).to receive_message_chain('config.gitlab.url') { 'http://test.host' }
+ end
+
+ it { is_expected.to eq('http://test.host') }
+
+ context 'with instance_url' do
+ let_it_be(:installation) { create(:jira_connect_installation, instance_url: 'https://gitlab.example.com') }
+
+ it { is_expected.to eq('https://gitlab.example.com') }
+
+ context 'and jira_connect_oauth_self_managed feature is disabled' do
+ before do
+ stub_feature_flags(jira_connect_oauth_self_managed: false)
+ end
+
+ it { is_expected.to eq('http://test.host') }
+ end
+ end
+ end
end