Sha256: 6575ad9d74f1a80e119568a8bc2995f4c939a7218371b91367b3e0d4dea02096

Contents?: true

Size: 1.21 KB

Versions: 13

Compression:

Stored size: 1.21 KB

Contents

require 'test_helper'

#  was the web request successful?
#  was the user redirected to the right page?
#  was the user successfully authenticated?
#  was the correct object stored in the response?
#  was the appropriate message delivered in the json payload?

class Overrides::OmniauthCallbacksControllerTest < ActionDispatch::IntegrationTest
  describe Overrides::OmniauthCallbacksController do
    setup do
      OmniAuth.config.test_mode = true
      OmniAuth.config.mock_auth[:facebook] = OmniAuth::AuthHash.new({
        :provider => 'facebook',
        :uid => '123545',
        :info => {
          name: 'chong',
          email: 'chongbong@aol.com'
        }
      })

      @favorite_color = "gray"

      get_via_redirect '/evil_user_auth/facebook', {
        auth_origin_url: Faker::Internet.url,
        favorite_color: @favorite_color
      }

      @user = assigns(:user)
    end

    test 'request is successful' do
      assert_equal 200, response.status
    end

    test 'controller was overridden' do
      assert_equal @user.nickname, Overrides::OmniauthCallbacksController::DEFAULT_NICKNAME
    end

    test 'whitelisted param was allowed' do
      assert_equal @favorite_color, @user.favorite_color
    end
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
xing_backend_token_auth-0.1.32 test/controllers/overrides/omniauth_callbacks_controller_test.rb
xing_backend_token_auth-0.1.31 test/controllers/overrides/omniauth_callbacks_controller_test.rb
devise_token_auth-0.1.30.beta3 test/controllers/overrides/omniauth_callbacks_controller_test.rb
devise_token_auth-0.1.30.beta2 test/controllers/overrides/omniauth_callbacks_controller_test.rb
devise_token_auth-0.1.30.beta1 test/controllers/overrides/omniauth_callbacks_controller_test.rb
devise_token_auth-0.1.29 test/controllers/overrides/omniauth_callbacks_controller_test.rb
devise_token_auth-0.1.29.beta7 test/controllers/overrides/omniauth_callbacks_controller_test.rb
devise_token_auth-0.1.29.beta6 test/controllers/overrides/omniauth_callbacks_controller_test.rb
devise_token_auth-0.1.29.beta5 test/controllers/overrides/omniauth_callbacks_controller_test.rb
devise_token_auth-0.1.29.beta4 test/controllers/overrides/omniauth_callbacks_controller_test.rb
devise_token_auth-0.1.29.beta3 test/controllers/overrides/omniauth_callbacks_controller_test.rb
devise_token_auth-0.1.29.beta2 test/controllers/overrides/omniauth_callbacks_controller_test.rb
devise_token_auth-0.1.29.beta1 test/controllers/overrides/omniauth_callbacks_controller_test.rb