diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-19 23:18:09 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-19 23:18:09 +0000 |
commit | 6ed4ec3e0b1340f96b7c043ef51d1b33bbe85fde (patch) | |
tree | dc4d20fe6064752c0bd323187252c77e0a89144b /spec/lib/omni_auth/strategies/bitbucket_spec.rb | |
parent | 9868dae7fc0655bd7ce4a6887d4e6d487690eeed (diff) | |
download | gitlab-ce-6ed4ec3e0b1340f96b7c043ef51d1b33bbe85fde.tar.gz |
Add latest changes from gitlab-org/gitlab@15-4-stable-eev15.4.0-rc42
Diffstat (limited to 'spec/lib/omni_auth/strategies/bitbucket_spec.rb')
-rw-r--r-- | spec/lib/omni_auth/strategies/bitbucket_spec.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/lib/omni_auth/strategies/bitbucket_spec.rb b/spec/lib/omni_auth/strategies/bitbucket_spec.rb new file mode 100644 index 00000000000..d85ce71d60a --- /dev/null +++ b/spec/lib/omni_auth/strategies/bitbucket_spec.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe OmniAuth::Strategies::Bitbucket do + subject { described_class.new({}) } + + describe '#callback_url' do + let(:base_url) { 'https://example.com' } + + context 'when script name is not present' do + it 'has the correct default callback path' do + allow(subject).to receive(:full_host) { base_url } + allow(subject).to receive(:script_name).and_return('') + allow(subject).to receive(:query_string).and_return('') + expect(subject.callback_url).to eq("#{base_url}/users/auth/bitbucket/callback") + end + end + + context 'when script name is present' do + it 'sets the callback path with script_name' do + allow(subject).to receive(:full_host) { base_url } + allow(subject).to receive(:script_name).and_return('/v1') + allow(subject).to receive(:query_string).and_return('') + expect(subject.callback_url).to eq("#{base_url}/v1/users/auth/bitbucket/callback") + end + end + end +end |