3
votes

I've been having trouble using cucumber and webrat to test authlogic-openid authentication in a rails app. Following Ryan Bates's excellent screencast I was able to install authlogic with the open-id plugin. OpenID works when I login using the browser but so far I've been unable to test the app using cucumber and webrat.

I've tried using rots as a dummy open id server. Again this works when I try it in the browser but webrat won't doesn't correctly follow the get/post redirects required to authentic with the dummy open id server.

This answer on SO suggests overriding the authentication method to always return a successful login but this approach doesn't seem like integration testing the application.

What is the best way to functionally test authlogic-open-id? Should I even bother? Should I test the actions when the user is already logged in and assume OpenID will work?

2

2 Answers

2
votes

have you tried the test helper set_session_for(@user)? I would assume that the plugin is tested and there really is no need to test it again (unless you have modified it).

1
votes

I asked the same question on the authlogic mailing list. I got a good answer directing me to use WWW:Mechanise with some patch code to that makes webrat follow all redirects. This seems to work for doing rails integration testing using authlogic open id with a local open id server.

Here's the discussion thread.