]> git.openstreetmap.org Git - rails.git/blob - test/functional/user_preference_controller_test.rb
Fix compatibility with older versions of the ruby std lib (i.e: the one on cruise...
[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     assert_select "osm:root" do
17       assert_select "preferences", :count => 1 do
18         assert_select "preference", :count => 2
19         assert_select "preference[k=\"#{user_preferences(:a).k}\"][v=\"#{user_preferences(:a).v}\"]", :count => 1
20         assert_select "preference[k=\"#{user_preferences(:two).k}\"][v=\"#{user_preferences(:two).v}\"]", :count => 1
21       end
22     end
23   end
24
25 end