Reputation: 30385
I am trying to figure out how can I mock (simply) current_user inside my unit tests in Rails? (I am using Test::Unit). I tried to look on Google and StackOverflow but nothing really helpful!
Any ideas?
Thanks!
Upvotes: 2
Views: 1146
Reputation: 9756
If you're in a unit test then you should probably be passing in current_user to your process. When testing from a higher level where you will actually care about current_user, OmniAuth has some mocking for tests.
Look Here: https://github.com/intridea/omniauth/wiki/Integration-Testing
Hope that helps.
Upvotes: 2