summaryrefslogtreecommitdiff
path: root/spec/views/profiles/audit_log.html.haml_spec.rb
blob: d5f6a2d64e78e77c0786a79594121f3f274bba5b (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'profiles/audit_log' do
  let(:user) { create(:user) }

  before do
    assign(:user, user)
    assign(:events, AuthenticationEvent.all.page(params[:page]))
    allow(controller).to receive(:current_user).and_return(user)
  end

  context 'when user has successful and failure events' do
    before do
      create(:authentication_event, :successful, user: user)
      create(:authentication_event, :failed, user: user)
    end

    it 'only shows successful events' do
      render

      expect(rendered).to have_text('Signed in with standard authentication', count: 1)
    end
  end
end