summaryrefslogtreecommitdiff
path: root/spec/initializers/omniauth_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/initializers/omniauth_spec.rb')
-rw-r--r--spec/initializers/omniauth_spec.rb46
1 files changed, 46 insertions, 0 deletions
diff --git a/spec/initializers/omniauth_spec.rb b/spec/initializers/omniauth_spec.rb
new file mode 100644
index 00000000000..928eac8c533
--- /dev/null
+++ b/spec/initializers/omniauth_spec.rb
@@ -0,0 +1,46 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe 'OmniAuth initializer for GitLab' do
+ let(:load_omniauth_initializer) do
+ 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')
+ end
+
+ context 'with feature flags not available' do
+ before do
+ expect(Feature).to receive(:feature_flags_available?).and_return(false)
+ load_omniauth_initializer
+ end
+
+ it { is_expected.to eq(base_url) }
+ end
+
+ context 'with the omniauth_initializer_fullhost_proc FF disabled' do
+ before do
+ stub_feature_flags(omniauth_initializer_fullhost_proc: false)
+ load_omniauth_initializer
+ end
+
+ it { is_expected.to eq(base_url) }
+ end
+
+ context 'with the omniauth_initializer_fullhost_proc FF disabled' do
+ before do
+ load_omniauth_initializer
+ end
+
+ it { is_expected.to eq('proc') }
+ end
+ end
+end