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?
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.