Sha256: 83dce67676426437227095ea6f354b188666f60e7120d9aa20a783fa4cb7e7c9

Contents?: true

Size: 945 Bytes

Versions: 3

Compression:

Stored size: 945 Bytes

Contents

# frozen_string_literal: true

require 'test_helper'

class Custom::OmniauthCallbacksControllerTest < ActionDispatch::IntegrationTest
  describe Custom::OmniauthCallbacksController do
    include CustomControllersRoutes

    setup do
      OmniAuth.config.test_mode = true
      OmniAuth.config.mock_auth[:facebook] = OmniAuth::AuthHash.new(
        provider: 'facebook',
        uid: '123545',
        info: {
          name: 'swong',
          email: 'swongsong@yandex.ru'
        }
      )
    end

    test 'yield resource to block on omniauth_success success' do
      @redirect_url = 'http://ng-token-auth.dev/'
      post '/nice_user_auth/facebook',
          params: { auth_origin_url: @redirect_url,
                    omniauth_window_type: 'newWindow' }

      follow_all_redirects!

      assert @controller.omniauth_success_block_called?,
             'omniauth_success failed to yield resource to provided block'
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
devise_token_auth-1.2.5 test/controllers/custom/custom_omniauth_callbacks_controller_test.rb
devise_token_auth-1.2.4 test/controllers/custom/custom_omniauth_callbacks_controller_test.rb
devise_token_auth-1.2.2 test/controllers/custom/custom_omniauth_callbacks_controller_test.rb