Amokrane Chentir
Amokrane Chentir

Reputation: 30385

Rails - How to simply mock current_user (OmniAuth) on Test::Unit?

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

Answers (1)

Matt Polito
Matt Polito

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

Related Questions