From 4cfc44a09f74924ce9d3da2c66b56ef99df32a62 Mon Sep 17 00:00:00 2001 From: Sidharth Bansal Date: Mon, 2 Jul 2018 06:37:17 +0530 Subject: [PATCH] Integration tests for facebook (#2963) --- test/integration/login_flow_test.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/integration/login_flow_test.rb b/test/integration/login_flow_test.rb index 396595a9a11..18722c0b034 100644 --- a/test/integration/login_flow_test.rb +++ b/test/integration/login_flow_test.rb @@ -71,4 +71,20 @@ class LoginFlowTest < ActionDispatch::IntegrationTest request.env['omniauth.auth'] = OmniAuth.config.mock_auth[:github2] assert_not_nil request.env['omniauth.auth'] end + + test 'twitter login routing' do + assert_routing '/auth/twitter/callback', {controller: 'user_sessions', action: 'create',provider: 'twitter'} + end + + test 'twitter login post' do + assert_routing({path: '/auth/twitter/callback', method: 'post'},{controller: 'user_sessions', action: 'create' ,provider: 'twitter'}) + end + + test 'should get oauth hash from /auth/twitter' do + get '/auth/twitter' + assert_redirected_to '/auth/twitter/callback' + assert_not_nil OmniAuth.config.mock_auth[:twitter2] + request.env['omniauth.auth'] = OmniAuth.config.mock_auth[:twitter2] + assert_not_nil request.env['omniauth.auth'] + end end