]> git.openstreetmap.org Git - rails.git/blobdiff - test/controllers/user_controller_test.rb
Merge remote-tracking branch 'openstreetmap/pull/1347' into master
[rails.git] / test / controllers / user_controller_test.rb
index e549ec90a07c9b5d4502dddd81814c7a8bfaac69..a5d723c91f0f8d0dc3881474d4a07ee76e409c27 100644 (file)
@@ -4,7 +4,7 @@ class UserControllerTest < ActionController::TestCase
   api_fixtures
 
   def setup
-    stub_signup_requests
+    stub_hostip_requests
   end
 
   ##
@@ -813,7 +813,7 @@ class UserControllerTest < ActionController::TestCase
     assert_select "form#accountForm > fieldset > div.form-row > select#user_preferred_editor > option[selected]", false
 
     # Changing to an uploaded image should work
-    image = Rack::Test::UploadedFile.new("test/traces/1.gif", "image/gif")
+    image = Rack::Test::UploadedFile.new("test/traces/a.gif", "image/gif")
     post :account, { :display_name => user.display_name, :image_action => "new", :user => user.attributes.merge(:image => image) }, { :user => user.id }
     assert_response :success
     assert_template :account
@@ -1094,6 +1094,12 @@ class UserControllerTest < ActionController::TestCase
   end
 
   def test_api_gpx_files
+    trace1 = create(:trace, :user => users(:normal_user)) do |trace|
+      create(:tracetag, :trace => trace, :tag => "London")
+    end
+    trace2 = create(:trace, :user => users(:normal_user)) do |trace|
+      create(:tracetag, :trace => trace, :tag => "Birmingham")
+    end
     # check that nothing is returned when not logged in
     get :api_gpx_files
     assert_response :unauthorized
@@ -1105,10 +1111,10 @@ class UserControllerTest < ActionController::TestCase
     assert_equal "text/xml", response.content_type
 
     # check the data that is returned
-    assert_select "gpx_file[id='1']", 1 do
+    assert_select "gpx_file[id='#{trace1.id}']", 1 do
       assert_select "tag", "London"
     end
-    assert_select "gpx_file[id='4']", 1 do
+    assert_select "gpx_file[id='#{trace2.id}']", 1 do
       assert_select "tag", "Birmingham"
     end
   end
@@ -1384,7 +1390,7 @@ class UserControllerTest < ActionController::TestCase
     get :list, :page => 3
     assert_response :success
     assert_template :list
-    assert_select "table#user_list tr", :count => 25
+    assert_select "table#user_list tr", :count => 26
   end
 
   def test_list_post_confirm