views:

76

answers:

1

Can Rails integration tests hit another server for OpenId authentication?

When my Rails application, running on http://localhost:3000/, redirects to http://localhost:1123/server for OpenId authentication, Rails fake browser actually goes to http://localhost:3000/server. It seems like the fake browser used in the integration tests is ignoring the hostname and port, and just picking up the directory part of the path.

Any ideas how to allow that redirect to arrive at a separate server?

+1  A: 

The 'fake browser' indeed only accesses the Rails application, and nothing from without. Which is good, because your tests would fail if you OpenID server is down.

The best solution is to use the 'fakeweb' gem. This allows you to emulate a remote response and test your applications behaviour accordingly.

Ariejan
Thank you for pointing to fakeweb, I'll keep it in mind. But for these tests I'm using rots, a local test OpenID, which I start and stop with the tests automatically.
J. Pablo Fernández