Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I test authlogic's current_user in Cucumber?

I am trying to use authlogic's test helpers in Cucumber, calling activate_authlogic.

Our application_controller has a current_user_session method.

When we drop into the debugger mid-story, controller returns a Authlogic::TestCase::MockController.

But when we call controller.current_user_session.

The error occurred while evaluating nil.current_user_session.

How does this mock suddenly become a nil?

And does this mock controller know about our application controllers' code?

like image 439
schwabsauce Avatar asked May 15 '09 16:05

schwabsauce


1 Answers

I don't know authlogic (and if this answer is helpful at all), but where does that mock object come from in the first place? You shouldn't be using any mocks in you cucumber stories. Cucumber is like an integration test, testing the complete Rails Stack.

I use it, to make sure, that my view, controller and model specs haven't diverged from each other.

like image 163
jcfischer Avatar answered Nov 01 '22 11:11

jcfischer