]> git.openstreetmap.org Git - rails.git/blobdiff - test/controllers/user_controller_test.rb
Stub out requests to gravatar.com during tests.
[rails.git] / test / controllers / user_controller_test.rb
index c3a1116054edd014a31e37a4febc84d1ad9b1633..ef4bd0fff040314858032e39fbf286726eb12545 100644 (file)
@@ -2,7 +2,11 @@ require "test_helper"
 
 class UserControllerTest < ActionController::TestCase
   api_fixtures
-  fixtures :messages
+
+  setup do
+    stub_request(:get, "http://api.hostip.info/country.php?ip=0.0.0.0")
+    stub_request(:get, /.*gravatar.com.*d=404/).to_return(:status => 404)
+  end
 
   ##
   # test all routes which lead to this controller
@@ -1036,6 +1040,8 @@ class UserControllerTest < ActionController::TestCase
   end
 
   def test_api_details
+    create(:message, :read, :recipient => users(:normal_user))
+
     # check that nothing is returned when not logged in
     get :api_details
     assert_response :unauthorized
@@ -1193,7 +1199,7 @@ class UserControllerTest < ActionController::TestCase
     # Get users to work with
     user = users(:normal_user)
     friend = users(:public_user)
-    create(:friend, :user_id => user.id, :friend_user_id => friend.id)
+    create(:friend, :befriender => user, :befriendee => friend)
 
     # Check that the users are friends
     assert Friend.where(:user_id => user.id, :friend_user_id => friend.id).first