Sha256: 3ae3b17278293e7ea2101407d413c8af7dd6ec679ea799fe4124fab478ec86d7

Contents?: true

Size: 783 Bytes

Versions: 7

Compression:

Stored size: 783 Bytes

Contents

require 'spec_helper'

describe SimpleTokenAuthentication::FallbackAuthenticationHandler do

  it_behaves_like 'an authentication handler'

  describe '#authenticate_entity!' do

    it 'delegates authentication to Devise::Controllers::Helpers through a controller', private: true do
      controller = double()
      allow(controller).to receive(:authenticate_user!).and_return('Devise response.')

      entity = double()
      allow(entity).to receive_message_chain(:name_underscore).and_return('user')

      # delegating consists in sending the message
      expect(controller).to receive(:authenticate_user!)
      response = subject.authenticate_entity!(controller, entity)

      # and returning the response
      expect(response).to eq 'Devise response.'
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
simple_token_authentication-1.9.1 spec/lib/simple_token_authentication/fallback_authentication_handler_spec.rb
simple_token_authentication-1.9.0 spec/lib/simple_token_authentication/fallback_authentication_handler_spec.rb
simple_token_authentication-1.8.0 spec/lib/simple_token_authentication/fallback_authentication_handler_spec.rb
stn-simple_token_authentication-1.7.1 spec/lib/simple_token_authentication/fallback_authentication_handler_spec.rb
simple_token_authentication-1.7.0 spec/lib/simple_token_authentication/fallback_authentication_handler_spec.rb
simple_token_authentication-1.6.0 spec/lib/simple_token_authentication/fallback_authentication_handler_spec.rb
simple_token_authentication-1.5.2 spec/lib/simple_token_authentication/fallback_authentication_handler_spec.rb