Writing a test for IP addresses

I have a Rails controller which behaves differently based on the IP
address of the remote request. However, the defaults for functional
tests get submitted with an IP of 0.0.0.0. How can I create a series of
tests that use various remote IP addresses per get?

Thanks,
Chaz

On 1/10/07, Chaz [email protected] wrote:

I have a Rails controller which behaves differently based on the IP
address of the remote request. However, the defaults for functional
tests get submitted with an IP of 0.0.0.0. How can I create a series of
tests that use various remote IP addresses per get?

@request.env[‘REMOTE_ADDR’] = ‘10.0.1.1’ # or whatever IP address

Do that in your setup before your test. Might be a more direct way,
but that’s how I’ve been doing it.

Thanks, Jim – that’s exactly what I needed.

Chaz