summaryrefslogtreecommitdiff
path: root/ee/spec/controllers/ldap/omniauth_callbacks_controller_spec.rb
blob: 0835ff35846afd9a06e457c718d6ff0870ec5372 (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
require 'spec_helper'

describe Ldap::OmniauthCallbacksController do
  include_context 'Ldap::OmniauthCallbacksController'

  it "displays LDAP sync flash on first sign in" do
    post provider

    expect(flash[:notice]).to match(/LDAP sync in progress*/)
  end

  it "skips LDAP sync flash on subsequent sign ins" do
    user.update!(sign_in_count: 1)

    post provider

    expect(flash[:notice]).to eq nil
  end

  context 'access denied' do
    let(:valid_login?) { false }

    it 'logs a failure event' do
      stub_licensed_features(extended_audit_events: true)

      expect { post provider }.to change(SecurityEvent, :count).by(1)
    end
  end
end