class UserPreferenceControllerTest < ActionController::TestCase
fixtures :users, :user_preferences
class UserPreferenceControllerTest < ActionController::TestCase
fixtures :users, :user_preferences
# authenticate as a user with preferences
basic_authorization("test@openstreetmap.org", "test")
# authenticate as a user with preferences
basic_authorization("test@openstreetmap.org", "test")
- assert_equal "value", UserPreference.find(1, "key").v
- assert_equal "some_value", UserPreference.find(1, "some_key").v
+ assert_equal "value", UserPreference.find([1, "key"]).v
+ assert_equal "some_value", UserPreference.find([1, "some_key"]).v
assert_response :success
assert_equal "text/plain", @response.content_type
assert_equal "", @response.body
assert_response :success
assert_equal "text/plain", @response.content_type
assert_equal "", @response.body
- assert_equal "new_value", UserPreference.find(1, "key").v
- assert_equal "value", UserPreference.find(1, "new_key").v
+ assert_equal "new_value", UserPreference.find([1, "key"]).v
+ assert_equal "value", UserPreference.find([1, "new_key"]).v
assert_response :bad_request
assert_equal "text/plain", @response.content_type
assert_equal "Duplicate preferences with key key", @response.body
assert_response :bad_request
assert_equal "text/plain", @response.content_type
assert_equal "Duplicate preferences with key key", @response.body
end
assert_response :unauthorized, "should be authenticated"
assert_raises ActiveRecord::RecordNotFound do
end
assert_response :unauthorized, "should be authenticated"
assert_raises ActiveRecord::RecordNotFound do
assert_response :success
assert_equal "text/plain", @response.content_type
assert_equal "", @response.body
assert_response :success
assert_equal "text/plain", @response.content_type
assert_equal "", @response.body
assert_response :success
assert_equal "text/plain", @response.content_type
assert_equal "", @response.body
assert_response :success
assert_equal "text/plain", @response.content_type
assert_equal "", @response.body
delete :delete_one, :preference_key => "key"
end
assert_response :unauthorized, "should be authenticated"
delete :delete_one, :preference_key => "key"
end
assert_response :unauthorized, "should be authenticated"
# authenticate as a user with preferences
basic_authorization("test@openstreetmap.org", "test")
# authenticate as a user with preferences
basic_authorization("test@openstreetmap.org", "test")
assert_equal "text/plain", @response.content_type
assert_equal "", @response.body
assert_raises ActiveRecord::RecordNotFound do
assert_equal "text/plain", @response.content_type
assert_equal "", @response.body
assert_raises ActiveRecord::RecordNotFound do