Sha256: c3a46e047a4af079f7d584f07b8b0cd3ddcbbc7527b2b1186ecbe6c24c7ee867

Contents?: true

Size: 1.16 KB

Versions: 9

Compression:

Stored size: 1.16 KB

Contents

require 'spec_helper'

describe GoogleAuthenticatorRails::ActionController::Integration do
  describe '::included' do
    context 'ApplicationController already defined' do
      # Autoload ApplicationController.
      before  { ApplicationController }
      subject { lambda { MockControllerWithApplicationController.send(:include, GoogleAuthenticatorRails::ActionController::Integration) } }

      it { should raise_error(GoogleAuthenticatorRails::ActionController::RailsAdapter::LoadedTooLateError) }
    end

    it 'should add the before filter' do
      MockController.should_receive(:prepend_before_filter).with(:activate_google_authenticator_rails)
      MockController.send(:include, GoogleAuthenticatorRails::ActionController::Integration)
    end
  end

  describe '::activate_google_authenticator_rails' do
    let(:controller) { MockController.new }

    before  do
      MockController.send(:include, GoogleAuthenticatorRails::ActionController::Integration)
      controller.send(:activate_google_authenticator_rails)
    end
    
    specify { GoogleAuthenticatorRails::Session::Base.controller.should be_a  GoogleAuthenticatorRails::ActionController::RailsAdapter }
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
google-authenticator-rails-3.4.3 spec/action_controller/integration_spec.rb
google-authenticator-rails-3.4.2 spec/action_controller/integration_spec.rb
google-authenticator-rails-3.4.1 spec/action_controller/integration_spec.rb
google-authenticator-rails-3.4.0 spec/action_controller/integration_spec.rb
google-authenticator-rails-3.3.1 spec/action_controller/integration_spec.rb
google-authenticator-rails-3.3.0 spec/action_controller/integration_spec.rb
google-authenticator-rails-3.2.1 spec/action_controller/integration_spec.rb
google-authenticator-rails-3.2.0 spec/action_controller/integration_spec.rb
google-authenticator-rails-3.1.0 spec/action_controller/integration_spec.rb