Improving the not found handling of preferences. adding a user preference test. adding some utility methods to the test helper

This commit is contained in:
Shaun McDonald 2008-12-12 18:54:03 +00:00
parent 541c24b23d
commit c76e60f052
4 changed files with 62 additions and 43 deletions

View file

@ -1,5 +1,4 @@
require File.dirname(__FILE__) + '/../test_helper'
require 'node_controller'
class NodeControllerTest < ActionController::TestCase
api_fixtures

View file

@ -1,8 +1,26 @@
require File.dirname(__FILE__) + '/../test_helper'
class UserPreferenceControllerTest < ActionController::TestCase
# Replace this with your real tests.
def test_truth
assert true
fixtures :users, :user_preferences
def test_read
# first try without auth
get :read
assert_response :unauthorized, "should be authenticated"
# now set the auth
basic_authorization("test@openstreetmap.org", "test")
get :read
assert_response :success
print @response.body
assert_select "osm:root" 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
assert_select "preference[k=\"#{user_preferences(:two).k}\"][v=\"#{user_preferences(:two).v}\"]", :count => 1
end
end
end
end