Skip to content

Commit

Permalink
Integration tests for twitter
Browse files Browse the repository at this point in the history
  • Loading branch information
SidharthBansal committed Jul 2, 2018
1 parent 0d8477e commit 451e69d
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions test/integration/login_flow_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,36 @@ 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

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

0 comments on commit 451e69d

Please sign in to comment.