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!
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.
精彩评论