summaryrefslogtreecommitdiff
path: root/spec/helpers/registrations_helper_spec.rb
blob: 00d0a0850cd9ccc41f2e4528ce991536828e72c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe RegistrationsHelper do
  using RSpec::Parameterized::TableSyntax

  describe '#social_signin_enabled?' do
    before do
      allow(::Gitlab).to receive(:dev_env_or_com?).and_return(com)
      allow(view).to receive(:omniauth_enabled?).and_return(omniauth_enabled)
      allow(view).to receive(:button_based_providers_enabled?).and_return(button_based_providers_enabled)
      allow(view).to receive(:devise_mapping).and_return(double(omniauthable?: omniauthable))
    end

    subject { helper.social_signin_enabled? }

    where com: [true, false],
          omniauth_enabled: [true, false],
          omniauthable: [true, false],
          button_based_providers_enabled: [true, false]

    with_them do
      let(:result) { com && omniauth_enabled && button_based_providers_enabled && omniauthable }

      it { is_expected.to eq(result) }
    end
  end
end