]> git.openstreetmap.org Git - rails.git/blob - test/functional/user_controller_test.rb
Fixed problem where tag lengths were generating a 422 error with no message. They...
[rails.git] / test / functional / user_controller_test.rb
1 require File.dirname(__FILE__) + '/../test_helper'
2
3 class UserControllerTest < ActionController::TestCase
4   fixtures :users
5   
6   # The user creation page loads
7   def test_user_create
8     get :new
9     assert_response :success
10     
11     assert_select "html:root", :count => 1 do
12       assert_select "head", :count => 1 do
13         assert_select "title", :text => /create account/, :count => 1
14       end
15       assert_select "body", :count => 1 do
16         assert_select "div#content", :count => 1 do
17           assert_select "form[action='/user/save'][method=post]", :count => 1 do
18             assert_select "input[id=user_email]", :count => 1
19             assert_select "input[id=user_email_confirmation]", :count => 1
20             assert_select "input[id=user_display_name]", :count => 1
21             assert_select "input[id=user_pass_crypt][type=password]", :count => 1
22             assert_select "input[id=user_pass_crypt_confirmation][type=password]", :count => 1
23             assert_select "input[type=submit][value=Signup]", :count => 1
24           end
25         end
26       end
27     end
28   end
29   
30   # Check that the user account page will display and contains some relevant
31   # information for the user
32   def test_view_user_account
33     get :view
34     assert_response :not_found
35     
36     get :view, {:display_name => "test"}
37     assert_response :success
38   end
39   
40   def test_user_api_details
41     get :api_details
42     assert_response :unauthorized
43     
44     basic_authorization(users(:normal_user).email, "test")
45     get :api_details
46     assert_response :success
47   end
48 end