2022-06-21 17:19:12 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
RSpec.describe 'OmniAuth initializer for GitLab' do
|
2022-07-23 23:45:48 +05:30
|
|
|
def load_omniauth_initializer
|
2022-06-21 17:19:12 +05:30
|
|
|
load Rails.root.join('config/initializers/omniauth.rb')
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#full_host' do
|
|
|
|
subject { OmniAuth.config.full_host }
|
|
|
|
|
|
|
|
let(:base_url) { 'http://localhost/test' }
|
|
|
|
|
|
|
|
before do
|
|
|
|
allow(Settings).to receive(:gitlab).and_return({ 'base_url' => base_url })
|
|
|
|
allow(Gitlab::OmniauthInitializer).to receive(:full_host).and_return('proc')
|
|
|
|
|
2022-07-23 23:45:48 +05:30
|
|
|
load_omniauth_initializer
|
2022-06-21 17:19:12 +05:30
|
|
|
end
|
|
|
|
|
2022-07-23 23:45:48 +05:30
|
|
|
# to clear existing mocks and prevent order-dependent failures
|
|
|
|
after(:all) do
|
|
|
|
load_omniauth_initializer
|
2022-06-21 17:19:12 +05:30
|
|
|
end
|
|
|
|
|
2022-07-23 23:45:48 +05:30
|
|
|
it { is_expected.to eq('proc') }
|
2022-06-21 17:19:12 +05:30
|
|
|
end
|
|
|
|
end
|