Sha256: 1a7fb7a09cd4155a119a99f66738176ef640049d3298c9b74df8a55d93b75aba

Contents?: true

Size: 844 Bytes

Versions: 7

Compression:

Stored size: 844 Bytes

Contents

require 'spec_helper'

describe CASino::Listener::TwoFactorAuthenticatorRegistrator do
  include CASino::Engine.routes.url_helpers
  let(:controller) { Struct.new(:cookies).new(cookies: {}) }
  let(:listener) { described_class.new(controller) }

  before(:each) do
    controller.stub(:redirect_to)
  end

  describe '#user_not_logged_in' do
    it 'redirects to the login page' do
      controller.should_receive(:redirect_to).with(login_path)
      listener.user_not_logged_in
    end
  end

  describe '#two_factor_authenticator_registered' do
    let(:two_factor_authenticator) { Object.new }

    it 'assigns the two-factor authenticator' do
      listener.two_factor_authenticator_registered(two_factor_authenticator)
      controller.instance_variable_get(:@two_factor_authenticator).should == two_factor_authenticator
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
casino-1.3.2 spec/controllers/listener/two_factor_authenticator_registrator_spec.rb
casino-1.3.1 spec/controllers/listener/two_factor_authenticator_registrator_spec.rb
casino-1.3.0 spec/controllers/listener/two_factor_authenticator_registrator_spec.rb
casino-1.2.2 spec/controllers/listener/two_factor_authenticator_registrator_spec.rb
casino-1.2.1 spec/controllers/listener/two_factor_authenticator_registrator_spec.rb
casino-1.2.0 spec/controllers/listener/two_factor_authenticator_registrator_spec.rb
casino-1.1.0 spec/controllers/listener/two_factor_authenticator_registrator_spec.rb