I have Rails 2.3.8, Ruby 1.8.7, Mongrel Web Server and MySQL database.
I am in the development mode and I need to find the real IP address>
I am testing with Rspec and what I did was:
request.stub(:remote_ip).and_return('198.172.43.34')
Instance.stub(:find_by_key).and_return(@instance)
before = @instance.weekly_statistic.times_opened_by['198.172.43.34']
get :key, :key=>"314C00"
@instance.weekly_statistic.times_opened_by['198.172.43.34'].should == before+1
And it worked like a charm! : )