I’m having big trouble testing with rSpec’s controller API. Right now I’m using a middleware authentication solution (Warden), and when I run the specs, the proxy added by the middleware is not there, and all the authentication tests are throwing NilPointerExceptions all over the place.
It seems rSpec is not adding the middleware to the final app on purpose, and I would like to know if there is a way to monkey patch rSpec in order to make that go.
I already tested the whole thing with cucumber, however this is a refactoring of an old authentication version and there is several Controller tests that depend on authentication logic in order to work.
Thanks in advance.
It seems rSpec Controller API for Rails 2.x is not really using Rack on the controller call, so this is not possible to do. However there is a (non proven) solution pointed out by David Chelimsky. I’ll put the answer he gave me on the rSpec-user mail list.
I ended up mocking the ApplicationController on the authentication logic methods to do dummy stuff in order to make my specs run, I did this before having the suggestion pointed out by David, so I wouldn’t know if that work. Either way I hope it help any other developer on the same situation.