X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/5e86393f72f62a1f37ca49d5dfe4ea64f8290a3e..0e6d4f18dabf9ccf00567886d8e373dbef1f6966:/test/test_helper.rb?ds=sidebyside diff --git a/test/test_helper.rb b/test/test_helper.rb index 11782e098..88cfe4831 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -15,7 +15,7 @@ module ActiveSupport def self.api_fixtures # print "setting up the api_fixtures" fixtures :users, :user_roles - fixtures :changesets, :changeset_tags + fixtures :changesets fixtures :current_nodes, :nodes set_fixture_class :current_nodes => Node @@ -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_hostip_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