Sha256: 7c77214cb4c5fca7361d321c9e88fe97cd942e6883a46691fe1a1de7777927b4

Contents?: true

Size: 1.2 KB

Versions: 22

Compression:

Stored size: 1.2 KB

Contents

require 'spec_helper'

describe GoogleAuthenticatorRails::ActionController::Integration do
  describe '::included' do
    context 'ApplicationController already defined' do
      before  { class ApplicationController < MockController; end }
      after   { Object.send(:remove_const, :ApplicationController) }
      subject { lambda { MockController.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

22 entries across 22 versions & 1 rubygems

Version Path
google-authenticator-rails-0.0.4 spec/action_controller/integration_spec.rb
google-authenticator-rails-0.0.3 spec/action_controller/integration_spec.rb