]> git.openstreetmap.org Git - rails.git/blobdiff - test/test_helper.rb
Use 'def setup' instead of 'setup do', for consistency
[rails.git] / test / test_helper.rb
index 11782e098f7e2f0054c176f1790e4e219cb2c1bc..420512e741e075d894c8ec1fb78a1f1eba860b3e 100644 (file)
@@ -168,5 +168,17 @@ module ActiveSupport
 
       yield
     end
+
+    def stub_gravatar_request(email, status = 200, body = nil)
+      hash = Digest::MD5.hexdigest(email.downcase)
+      url = "https://www.gravatar.com/avatar/#{hash}?d=404"
+      stub_request(:get, url).and_return(:status => status, :body => body)
+    end
+
+    def stub_signup_requests
+      # Controller tests and integration tests use different IPs
+      stub_request(:get, "http://api.hostip.info/country.php?ip=0.0.0.0")
+      stub_request(:get, "http://api.hostip.info/country.php?ip=127.0.0.1")
+    end
   end
 end