diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-10-29 18:37:00 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-10-29 18:37:00 +0000 |
commit | a842769c3f3836b037807815e127c3a22ee4cb7e (patch) | |
tree | 2bc457e91953a3831a98f7ed927c4ddd84628ac3 /test | |
parent | ac56d1d5e54334624cfdf584b1b854c26d2dc00e (diff) | |
download | redmine-a842769c3f3836b037807815e127c3a22ee4cb7e.tar.gz redmine-a842769c3f3836b037807815e127c3a22ee4cb7e.zip |
AccountController#show (/account/show/:id) moved to UsersController#show (/users/:id).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2988 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/account_controller_test.rb | 30 | ||||
-rw-r--r-- | test/functional/users_controller_test.rb | 43 |
2 files changed, 43 insertions, 30 deletions
diff --git a/test/functional/account_controller_test.rb b/test/functional/account_controller_test.rb index 67c4d8b6c..17d19dfe1 100644 --- a/test/functional/account_controller_test.rb +++ b/test/functional/account_controller_test.rb @@ -31,36 +31,6 @@ class AccountControllerTest < ActionController::TestCase User.current = nil end - def test_show - get :show, :id => 2 - assert_response :success - assert_template 'show' - assert_not_nil assigns(:user) - end - - def test_show_should_not_fail_when_custom_values_are_nil - user = User.find(2) - - # Create a custom field to illustrate the issue - custom_field = CustomField.create!(:name => 'Testing', :field_format => 'text') - custom_value = user.custom_values.build(:custom_field => custom_field).save! - - get :show, :id => 2 - assert_response :success - end - - - def test_show_inactive - get :show, :id => 5 - assert_response 404 - assert_nil assigns(:user) - end - - def test_show_should_not_reveal_users_with_no_visible_activity_or_project - get :show, :id => 9 - assert_response 404 - end - def test_login_should_redirect_to_back_url_param # request.uri is "test.host" in test environment post :login, :username => 'jsmith', :password => 'jsmith', :back_url => 'http%3A%2F%2Ftest.host%2Fissues%2Fshow%2F1' diff --git a/test/functional/users_controller_test.rb b/test/functional/users_controller_test.rb index df87462a8..af7ba1b51 100644 --- a/test/functional/users_controller_test.rb +++ b/test/functional/users_controller_test.rb @@ -74,6 +74,49 @@ class UsersControllerTest < ActionController::TestCase assert_equal 1, users.size assert_equal 'John', users.first.firstname end + + def test_show_routing + assert_routing( + {:method => :get, :path => '/users/44'}, + :controller => 'users', :action => 'show', :id => '44' + ) + assert_recognizes( + {:controller => 'users', :action => 'show', :id => '44'}, + {:method => :get, :path => '/users/44'} + ) + end + + def test_show + @request.session[:user_id] = nil + get :show, :id => 2 + assert_response :success + assert_template 'show' + assert_not_nil assigns(:user) + end + + def test_show_should_not_fail_when_custom_values_are_nil + user = User.find(2) + + # Create a custom field to illustrate the issue + custom_field = CustomField.create!(:name => 'Testing', :field_format => 'text') + custom_value = user.custom_values.build(:custom_field => custom_field).save! + + get :show, :id => 2 + assert_response :success + end + + + def test_show_inactive + get :show, :id => 5 + assert_response 404 + assert_nil assigns(:user) + end + + def test_show_should_not_reveal_users_with_no_visible_activity_or_project + @request.session[:user_id] = nil + get :show, :id => 9 + assert_response 404 + end def test_add_routing assert_routing( |