Often when you are writing unit tests, you want to mock your IP address. Some of the uses cases could be – you are checking if IP is within the certain range.
For RSpec 2.x mocking IP would look like this:
Taken from here
However, if you try to do it in RSpec 3.x, it will give you an error since ‘any_instance‘ syntax is deprecated.
To make the same work for RSpec 3.x use this: