Sha256: 2efb7bb01bd6a4d63d90f16e21faa9c7b52bb72bbf1eb5612440c14d7fbbe974

Contents?: true

Size: 1017 Bytes

Versions: 3

Compression:

Stored size: 1017 Bytes

Contents

require 'spec_helper'

describe CASino::LoginAttemptsController do
  routes { CASino::Engine.routes }

  describe 'GET #index' do
    context 'with ticket granting ticket' do
      let(:ticket_granting_ticket) { FactoryGirl.create :ticket_granting_ticket }
      let(:login_attempt) { FactoryGirl.create :login_attempt, user: ticket_granting_ticket.user }
      let(:old_login_attempt) do
        FactoryGirl.create :login_attempt, user: ticket_granting_ticket.user, created_at: 10.weeks.ago
      end

      before do
        sign_in(ticket_granting_ticket)
        login_attempt.touch
        FactoryGirl.create :login_attempt
      end

      it 'assigns current users login attempts @login_attempts' do
        get :index

        expect(assigns(:login_attempts)).to eq([login_attempt, old_login_attempt])
      end
    end

    context 'without a ticket-granting ticket' do
      it 'redirects to the login page' do
        get :index

        response.should redirect_to(login_path)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
casino-4.1.2 spec/controllers/login_attempts_controller_spec.rb
casino-4.1.1 spec/controllers/login_attempts_controller_spec.rb
casino-4.1.0 spec/controllers/login_attempts_controller_spec.rb