Sha256: c7fe77f718ff7ed607f36aec3fae693f26afb675099d5f9c5a17c57506e9fa61
Contents?: true
Size: 920 Bytes
Versions: 2
Compression:
Stored size: 920 Bytes
Contents
# encoding: utf-8 require 'test_helper' class RequestTest < Test::Unit::TestCase class MockRequest include Geocoder2::Request attr_accessor :env, :ip def initialize(env={}, ip="") @env = env @ip = ip end end def test_http_x_real_ip req = MockRequest.new({"HTTP_X_REAL_IP" => "74.200.247.59"}) assert req.location.is_a?(Geocoder2::Result::Freegeoip) end def test_http_x_forwarded_for_without_proxy req = MockRequest.new({"HTTP_X_FORWARDED_FOR" => "74.200.247.59"}) assert req.location.is_a?(Geocoder2::Result::Freegeoip) end def test_http_x_forwarded_for_with_proxy req = MockRequest.new({"HTTP_X_FORWARDED_FOR" => "74.200.247.59, 74.200.247.59"}) assert req.location.is_a?(Geocoder2::Result::Freegeoip) end def test_with_request_ip req = MockRequest.new({}, "74.200.247.59") assert req.location.is_a?(Geocoder2::Result::Freegeoip) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
geocoder2-0.1.1 | test/request_test.rb |
geocoder2-0.1.0 | test/request_test.rb |