How should I test user signup/login with third party library like Omniauth?
-
12-10-2019 - |
Question
I'm using Rails 3.0.3, Rspec2 , Cucumber , Capybara
How should a scenario look for user signup process , when using the Omniauth gem ?
I mean it doesn't make sense for me to testing this library, I only want to test the whole user registration process of my applications point of view:
- open my root_path # my app
- click on /auth/facebook # my app
- THIS IS THE PART OF OMNIAUTH # not my app, doesn't need testing
- access /auth/facebook/callback # my app
- read user information , compare # my app
What is the good practice to test it ?
Solution
You can explore using the FakeWeb gem (https://github.com/chrisk/fakeweb) to mock up the API addresses and fake responses from them. An example of this use case here http://blog.zerosum.org/2009/7/13/twitter-auth-integration-testing
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow