I guess you can try to mock everything but that will result in mocking everything and not really testing anything. I guess you need to test it with your bare hands ;)
@uxweb so if you visit your /auth/login page, and click the Twitter button, you expect to be redirected to your own home page, and not to Twitter's authorization page?
@bobbybouwmann Thanks man, looks like this is a little complex to test :s.
@toniperic That's where i'm stucked :), When clicking the Twitter link, it will go to /auth/twitter, then it redirects to the provider auth url, then after the user has logged in, the auth provider page redirects to /auth/twitter/callback, in that route i get the user and then is logged in and redirected to '/'.
My question is, how would be possible to interact with the auth provider page to log in and then be redirected :s.
@uxweb you don't want to actually use a valid Twitter account for testing purposes, nor do you want to visit Twitter's authorization page.
To accomplish that, you'd want to mock Twitter's response, and not actually hit their servers with a real account. Then, you should test the callback URL, and assert that the user is being redirected to / with mocked data you provided.
Currently, your tests are checking that clicking the Twitter button redirects to your homepage, which is obviously not what you want (and which is obviously not happening when you test everything manually using a browser).