spec/lib/rack/geo_locale_spec.rb in rack-geo-locale-0.0.5 vs spec/lib/rack/geo_locale_spec.rb in rack-geo-locale-0.0.6
- old
+ new
@@ -22,9 +22,14 @@
it "should handle an empty REMOTE_ADDR field" do
get '/', {}, {"REMOTE_ADDR" => nil}
last_request.env["locale.country"].should == nil
end
+ it "should take HTTP_X_FORWARDED_FOR before REMOTE_ADDR field" do
+ get '/', {}, {"REMOTE_ADDR" => "10.0.0.1", "HTTP_X_FORWARDED_FOR" => "10.0.0.2"}
+ last_request.env["locale.country"].should == "US"
+ end
+
it "should resolve 10.0.0.1 to SE" do
get '/', {}, {"REMOTE_ADDR" => "10.0.0.1"}
last_request.env["locale.country"].should == "SE"
end