From 1154fa0073ea671384187b0437447ba34c61bd5d Mon Sep 17 00:00:00 2001 From: Sidharth Date: Mon, 2 Jul 2018 00:46:18 +0530 Subject: [PATCH] Integration tests for twitter --- 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..d0cb7baf046 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 'facebook login routing' do + assert_routing '/auth/facebook/callback', {controller: 'user_sessions', action: 'create',provider: 'facebook'} + end + + test 'facebook login post' do + assert_routing({path: '/auth/facebook/callback', method: 'post'},{controller: 'user_sessions', action: 'create' ,provider: 'facebook'}) + end + + test 'should get oauth hash from /auth/facebook' do + get '/auth/facebook' + assert_redirected_to '/auth/facebook/callback' + assert_not_nil OmniAuth.config.mock_auth[:facebook2] + request.env['omniauth.auth'] = OmniAuth.config.mock_auth[:facebook2] + assert_not_nil request.env['omniauth.auth'] + end end