2022-04-18 23:09:43 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
RSpec.describe 'OmniAuth initializer for GitLab' do
|
2022-05-26 14:08:09 -04:00
|
|
|
def load_omniauth_initializer
|
2022-04-18 23:09:43 -04:00
|
|
|
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-05-26 14:08:09 -04:00
|
|
|
load_omniauth_initializer
|
2022-04-18 23:09:43 -04:00
|
|
|
end
|
|
|
|
|
2022-05-26 14:08:09 -04:00
|
|
|
# to clear existing mocks and prevent order-dependent failures
|
|
|
|
after(:all) do
|
|
|
|
load_omniauth_initializer
|
2022-04-18 23:09:43 -04:00
|
|
|
end
|
|
|
|
|
2022-05-26 14:08:09 -04:00
|
|
|
it { is_expected.to eq('proc') }
|
2022-04-18 23:09:43 -04:00
|
|
|
end
|
|
|
|
end
|