]> git.openstreetmap.org Git - rails.git/blob - test/functional/user_preference_controller_test.rb
Improving the not found handling of preferences. adding a user preference test. addin...
[rails.git] / test / functional / user_preference_controller_test.rb
1 require File.dirname(__FILE__) + '/../test_helper'
2
3 class UserPreferenceControllerTest < ActionController::TestCase
4   fixtures :users, :user_preferences
5   
6   def test_read
7     # first try without auth
8     get :read
9     assert_response :unauthorized, "should be authenticated"
10     
11     # now set the auth
12     basic_authorization("test@openstreetmap.org", "test")
13     
14     get :read
15     assert_response :success
16     print @response.body
17     assert_select "osm:root" do
18       assert_select "preferences", :count => 1 do
19         assert_select "preference", :count => 2
20         assert_select "preference[k=\"#{user_preferences(:a).k}\"][v=\"#{user_preferences(:a).v}\"]", :count => 1
21         assert_select "preference[k=\"#{user_preferences(:two).k}\"][v=\"#{user_preferences(:two).v}\"]", :count => 1
22       end
23     end
24   end
25
26 end