X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/c76e60f052051a35fe7e9044969337cd88e5b1fd..561f2f694adc8ac57011eac1eec5929425276c59:/test/functional/user_preference_controller_test.rb?ds=inline diff --git a/test/functional/user_preference_controller_test.rb b/test/functional/user_preference_controller_test.rb index ff44c1e36..3921fe536 100644 --- a/test/functional/user_preference_controller_test.rb +++ b/test/functional/user_preference_controller_test.rb @@ -2,7 +2,32 @@ require File.dirname(__FILE__) + '/../test_helper' class UserPreferenceControllerTest < ActionController::TestCase fixtures :users, :user_preferences - + + ## + # test all routes which lead to this controller + def test_routes + assert_routing( + { :path => "/api/0.6/user/preferences", :method => :get }, + { :controller => "user_preference", :action => "read" } + ) + assert_routing( + { :path => "/api/0.6/user/preferences", :method => :put }, + { :controller => "user_preference", :action => "update" } + ) + assert_routing( + { :path => "/api/0.6/user/preferences/key", :method => :get }, + { :controller => "user_preference", :action => "read_one", :preference_key => "key" } + ) + assert_routing( + { :path => "/api/0.6/user/preferences/key", :method => :put }, + { :controller => "user_preference", :action => "update_one", :preference_key => "key" } + ) + assert_routing( + { :path => "/api/0.6/user/preferences/key", :method => :delete }, + { :controller => "user_preference", :action => "delete_one", :preference_key => "key" } + ) + end + def test_read # first try without auth get :read @@ -13,8 +38,7 @@ class UserPreferenceControllerTest < ActionController::TestCase get :read assert_response :success - print @response.body - assert_select "osm:root" do + assert_select "osm" do assert_select "preferences", :count => 1 do assert_select "preference", :count => 2 assert_select "preference[k=\"#{user_preferences(:a).k}\"][v=\"#{user_preferences(:a).v}\"]", :count => 1 @@ -22,5 +46,4 @@ class UserPreferenceControllerTest < ActionController::TestCase end end end - end