X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/3123822bba5865e81e8c10be16452a0a8b5362f9..d3d6e9902c8b03fcd31df253cf395f06f757880a:/test/controllers/user_controller_test.rb diff --git a/test/controllers/user_controller_test.rb b/test/controllers/user_controller_test.rb index 6a5fca785..cc8142b01 100644 --- a/test/controllers/user_controller_test.rb +++ b/test/controllers/user_controller_test.rb @@ -2,7 +2,10 @@ 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") + end ## # test all routes which lead to this controller @@ -924,6 +927,7 @@ class UserControllerTest < ActionController::TestCase end # Test a user who has been blocked + create(:user_block, :user => users(:blocked_user)) get :view, :display_name => "blocked" assert_response :success assert_select "div#userinformation" do @@ -938,6 +942,7 @@ class UserControllerTest < ActionController::TestCase end # Test a moderator who has applied blocks + create(:user_block, :creator => users(:moderator_user)) get :view, :display_name => "moderator" assert_response :success assert_select "div#userinformation" do @@ -1034,6 +1039,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 @@ -1191,7 +1198,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