X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/a3eb48385bcf1465339d473c0c1657e075cd507d..16da03aacb264c1703d8bd4fab5c58c78745be00:/test/controllers/user_controller_test.rb diff --git a/test/controllers/user_controller_test.rb b/test/controllers/user_controller_test.rb index a39e07efc..7b5f77d62 100644 --- a/test/controllers/user_controller_test.rb +++ b/test/controllers/user_controller_test.rb @@ -1,8 +1,9 @@ -require 'test_helper' +require "test_helper" class UserControllerTest < ActionController::TestCase - fixtures :users - + api_fixtures + fixtures :user_blocks, :messages, :friends + ## # test all routes which lead to this controller def test_routes @@ -195,13 +196,13 @@ class UserControllerTest < ActionController::TestCase end assert_select "body", :count => 1 do assert_select "div#content", :count => 1 do - assert_select "form[action='/user/new'][method=post]", :count => 1 do - assert_select "input[id=user_email]", :count => 1 - assert_select "input[id=user_email_confirmation]", :count => 1 - assert_select "input[id=user_display_name]", :count => 1 - assert_select "input[id=user_pass_crypt][type=password]", :count => 1 - assert_select "input[id=user_pass_crypt_confirmation][type=password]", :count => 1 - assert_select "input[type=submit][value=Sign Up]", :count => 1 + assert_select "form[action='/user/new'][method='post']", :count => 1 do + assert_select "input[id='user_email']", :count => 1 + assert_select "input[id='user_email_confirmation']", :count => 1 + assert_select "input[id='user_display_name']", :count => 1 + assert_select "input[id='user_pass_crypt'][type='password']", :count => 1 + assert_select "input[id='user_pass_crypt_confirmation'][type='password']", :count => 1 + assert_select "input[type='submit'][value='Sign Up']", :count => 1 end end end @@ -222,9 +223,9 @@ class UserControllerTest < ActionController::TestCase def test_user_create_success user = new_user - assert_difference('User.count', 1) do - assert_difference('ActionMailer::Base.deliveries.size', 1) do - post :save, {}, {:new_user => user} + assert_difference("User.count", 1) do + assert_difference("ActionMailer::Base.deliveries.size", 1) do + post :save, {}, { :new_user => user } end end @@ -235,7 +236,7 @@ class UserControllerTest < ActionController::TestCase assert_match /#{@url}/, register_email.body.to_s # Check the page - assert_redirected_to :action => 'confirm', :display_name => user.display_name + assert_redirected_to :action => "confirm", :display_name => user.display_name ActionMailer::Base.deliveries.clear end @@ -244,14 +245,14 @@ class UserControllerTest < ActionController::TestCase user = new_user user.email = users(:public_user).email - assert_no_difference('User.count') do - assert_no_difference('ActionMailer::Base.deliveries.size') do - post :save, {}, {:new_user => user} + assert_no_difference("User.count") do + assert_no_difference("ActionMailer::Base.deliveries.size") do + post :save, {}, { :new_user => user } end end assert_response :success - assert_template 'new' + assert_template "new" assert_select "form > fieldset > div.form-row > input.field_with_errors#user_email" end @@ -259,58 +260,58 @@ class UserControllerTest < ActionController::TestCase user = new_user user.email = users(:public_user).email.upcase - assert_no_difference('User.count') do - assert_no_difference('ActionMailer::Base.deliveries.size') do - post :save, {}, {:new_user => user} + assert_no_difference("User.count") do + assert_no_difference("ActionMailer::Base.deliveries.size") do + post :save, {}, { :new_user => user } end end assert_response :success - assert_template 'new' + assert_template "new" assert_select "form > fieldset > div.form-row > input.field_with_errors#user_email" end - + def test_user_create_submit_duplicate_name user = new_user user.display_name = users(:public_user).display_name - assert_no_difference('User.count') do - assert_no_difference('ActionMailer::Base.deliveries.size') do - post :save, {}, {:new_user => user} + assert_no_difference("User.count") do + assert_no_difference("ActionMailer::Base.deliveries.size") do + post :save, {}, { :new_user => user } end end assert_response :success - assert_template 'new' + assert_template "new" assert_select "form > fieldset > div.form-row > input.field_with_errors#user_display_name" end - + def test_user_create_submit_duplicate_name_uppercase user = new_user user.display_name = users(:public_user).display_name.upcase - assert_no_difference('User.count') do - assert_no_difference('ActionMailer::Base.deliveries.size') do - post :save, {}, {:new_user => user} + assert_no_difference("User.count") do + assert_no_difference("ActionMailer::Base.deliveries.size") do + post :save, {}, { :new_user => user } end end assert_response :success - assert_template 'new' + assert_template "new" assert_select "form > fieldset > div.form-row > input.field_with_errors#user_display_name" end def test_user_save_referer_params user = new_user - assert_difference('User.count', 1) do - assert_difference('ActionMailer::Base.deliveries.size', 1) do - post :save, {}, {:new_user => user, - :referer => '/edit?editor=id#map=1/2/3'} - end + assert_difference("User.count", 1) do + assert_difference("ActionMailer::Base.deliveries.size", 1) do + post :save, {}, { :new_user => user, + :referer => "/edit?editor=id#map=1/2/3" } + end end - assert_equal welcome_path(:editor => 'id', :zoom => 1, :lat => 2, :lon => 3), + assert_equal welcome_path(:editor => "id", :zoom => 1, :lat => 2, :lon => 3), user.tokens.order("id DESC").first.referer ActionMailer::Base.deliveries.clear @@ -325,7 +326,7 @@ class UserControllerTest < ActionController::TestCase @request.cookies["_osm_session"] = user.display_name post :confirm, :confirm_string => token.token - assert_redirected_to :action => 'confirm' + assert_redirected_to :action => "confirm" assert_match /expired/, flash[:error] end @@ -336,7 +337,7 @@ class UserControllerTest < ActionController::TestCase @request.cookies["_osm_session"] = user.display_name post :confirm, :confirm_string => token.token - assert_redirected_to :action => 'login' + assert_redirected_to :action => "login" assert_match /confirmed/, flash[:error] end @@ -370,7 +371,7 @@ class UserControllerTest < ActionController::TestCase # Test resetting using the address as recorded for a user that has an # address which is duplicated in a different case by another user - assert_difference('ActionMailer::Base.deliveries.size', 1) do + assert_difference("ActionMailer::Base.deliveries.size", 1) do post :lost_password, :user => { :email => users(:normal_user).email } end assert_response :redirect @@ -383,7 +384,7 @@ class UserControllerTest < ActionController::TestCase # Test resetting using an address that matches a different user # that has the same address in a different case - assert_difference('ActionMailer::Base.deliveries.size', 1) do + assert_difference("ActionMailer::Base.deliveries.size", 1) do post :lost_password, :user => { :email => users(:normal_user).email.upcase } end assert_response :redirect @@ -396,7 +397,7 @@ class UserControllerTest < ActionController::TestCase # Test resetting using an address that is a case insensitive match # for more than one user but not an exact match for either - assert_difference('ActionMailer::Base.deliveries.size', 0) do + assert_difference("ActionMailer::Base.deliveries.size", 0) do post :lost_password, :user => { :email => users(:normal_user).email.titlecase } end assert_response :success @@ -405,7 +406,7 @@ class UserControllerTest < ActionController::TestCase # Test resetting using the address as recorded for a user that has an # address which is case insensitively unique - assert_difference('ActionMailer::Base.deliveries.size', 1) do + assert_difference("ActionMailer::Base.deliveries.size", 1) do post :lost_password, :user => { :email => users(:public_user).email } end assert_response :redirect @@ -418,7 +419,7 @@ class UserControllerTest < ActionController::TestCase # Test resetting using an address that matches a user that has the # same (case insensitively unique) address in a different case - assert_difference('ActionMailer::Base.deliveries.size', 1) do + assert_difference("ActionMailer::Base.deliveries.size", 1) do post :lost_password, :user => { :email => users(:public_user).email.upcase } end assert_response :redirect @@ -467,7 +468,7 @@ class UserControllerTest < ActionController::TestCase # Make sure that you are redirected to the login page when # you are not logged in - get :account, { :display_name => user.display_name } + get :account, :display_name => user.display_name assert_response :redirect assert_redirected_to :controller => :user, :action => "login", :referer => "/user/test/account" @@ -521,7 +522,7 @@ class UserControllerTest < ActionController::TestCase # Changing email to one that exists should fail user.new_email = users(:public_user).email - assert_no_difference('ActionMailer::Base.deliveries.size') do + assert_no_difference("ActionMailer::Base.deliveries.size") do post :account, { :display_name => user.display_name, :user => user.attributes }, { "user" => user.id } end assert_response :success @@ -532,7 +533,7 @@ class UserControllerTest < ActionController::TestCase # Changing email to one that exists should fail, regardless of case user.new_email = users(:public_user).email.upcase - assert_no_difference('ActionMailer::Base.deliveries.size') do + assert_no_difference("ActionMailer::Base.deliveries.size") do post :account, { :display_name => user.display_name, :user => user.attributes }, { "user" => user.id } end assert_response :success @@ -543,7 +544,7 @@ class UserControllerTest < ActionController::TestCase # Changing email to one that doesn't exist should work user.new_email = "new_tester@example.com" - assert_difference('ActionMailer::Base.deliveries.size', 1) do + assert_difference("ActionMailer::Base.deliveries.size", 1) do post :account, { :display_name => user.display_name, :user => user.attributes }, { "user" => user.id } end assert_response :success @@ -556,88 +557,88 @@ class UserControllerTest < ActionController::TestCase assert_equal user.new_email, email.to.first ActionMailer::Base.deliveries.clear end - + # Check that the user account page will display and contains some relevant # information for the user def test_user_view_account # Test a non-existent user - get :view, {:display_name => "unknown"} + get :view, :display_name => "unknown" assert_response :not_found - + # Test a normal user - get :view, {:display_name => "test"} + get :view, :display_name => "test" assert_response :success assert_select "div#userinformation" do - assert_select "a[href^=/user/test/history]", 1 - assert_select "a[href=/user/test/traces]", 1 - assert_select "a[href=/user/test/diary]", 1 - assert_select "a[href=/user/test/diary/comments]", 1 - assert_select "a[href=/user/test/account]", 0 - assert_select "a[href=/user/test/blocks]", 0 - assert_select "a[href=/user/test/blocks_by]", 0 - assert_select "a[href=/blocks/new/test]", 0 - end - + assert_select "a[href^='/user/test/history']", 1 + assert_select "a[href='/user/test/traces']", 1 + assert_select "a[href='/user/test/diary']", 1 + assert_select "a[href='/user/test/diary/comments']", 1 + assert_select "a[href='/user/test/account']", 0 + assert_select "a[href='/user/test/blocks']", 0 + assert_select "a[href='/user/test/blocks_by']", 0 + assert_select "a[href='/blocks/new/test']", 0 + end + # Test a user who has been blocked - get :view, {:display_name => "blocked"} + get :view, :display_name => "blocked" assert_response :success assert_select "div#userinformation" do - assert_select "a[href^=/user/blocked/history]", 1 - assert_select "a[href=/user/blocked/traces]", 1 - assert_select "a[href=/user/blocked/diary]", 1 - assert_select "a[href=/user/blocked/diary/comments]", 1 - assert_select "a[href=/user/blocked/account]", 0 - assert_select "a[href=/user/blocked/blocks]", 1 - assert_select "a[href=/user/blocked/blocks_by]", 0 - assert_select "a[href=/blocks/new/blocked]", 0 - end - + assert_select "a[href^='/user/blocked/history']", 1 + assert_select "a[href='/user/blocked/traces']", 1 + assert_select "a[href='/user/blocked/diary']", 1 + assert_select "a[href='/user/blocked/diary/comments']", 1 + assert_select "a[href='/user/blocked/account']", 0 + assert_select "a[href='/user/blocked/blocks']", 1 + assert_select "a[href='/user/blocked/blocks_by']", 0 + assert_select "a[href='/blocks/new/blocked']", 0 + end + # Test a moderator who has applied blocks - get :view, {:display_name => "moderator"} + get :view, :display_name => "moderator" assert_response :success assert_select "div#userinformation" do - assert_select "a[href^=/user/moderator/history]", 1 - assert_select "a[href=/user/moderator/traces]", 1 - assert_select "a[href=/user/moderator/diary]", 1 - assert_select "a[href=/user/moderator/diary/comments]", 1 - assert_select "a[href=/user/moderator/account]", 0 - assert_select "a[href=/user/moderator/blocks]", 0 - assert_select "a[href=/user/moderator/blocks_by]", 1 - assert_select "a[href=/blocks/new/moderator]", 0 + assert_select "a[href^='/user/moderator/history']", 1 + assert_select "a[href='/user/moderator/traces']", 1 + assert_select "a[href='/user/moderator/diary']", 1 + assert_select "a[href='/user/moderator/diary/comments']", 1 + assert_select "a[href='/user/moderator/account']", 0 + assert_select "a[href='/user/moderator/blocks']", 0 + assert_select "a[href='/user/moderator/blocks_by']", 1 + assert_select "a[href='/blocks/new/moderator']", 0 end # Login as a normal user session[:user] = users(:normal_user).id # Test the normal user - get :view, {:display_name => "test"} + get :view, :display_name => "test" assert_response :success assert_select "div#userinformation" do - assert_select "a[href^=/user/test/history]", 1 - assert_select "a[href=/traces/mine]", 1 - assert_select "a[href=/user/test/diary]", 1 - assert_select "a[href=/user/test/diary/comments]", 1 - assert_select "a[href=/user/test/account]", 1 - assert_select "a[href=/user/test/blocks]", 0 - assert_select "a[href=/user/test/blocks_by]", 0 - assert_select "a[href=/blocks/new/test]", 0 + assert_select "a[href^='/user/test/history']", 1 + assert_select "a[href='/traces/mine']", 1 + assert_select "a[href='/user/test/diary']", 1 + assert_select "a[href='/user/test/diary/comments']", 1 + assert_select "a[href='/user/test/account']", 1 + assert_select "a[href='/user/test/blocks']", 0 + assert_select "a[href='/user/test/blocks_by']", 0 + assert_select "a[href='/blocks/new/test']", 0 end # Login as a moderator session[:user] = users(:moderator_user).id # Test the normal user - get :view, {:display_name => "test"} + get :view, :display_name => "test" assert_response :success assert_select "div#userinformation" do - assert_select "a[href^=/user/test/history]", 1 - assert_select "a[href=/user/test/traces]", 1 - assert_select "a[href=/user/test/diary]", 1 - assert_select "a[href=/user/test/diary/comments]", 1 - assert_select "a[href=/user/test/account]", 0 - assert_select "a[href=/user/test/blocks]", 0 - assert_select "a[href=/user/test/blocks_by]", 0 - assert_select "a[href=/blocks/new/test]", 1 + assert_select "a[href^='/user/test/history']", 1 + assert_select "a[href='/user/test/traces']", 1 + assert_select "a[href='/user/test/diary']", 1 + assert_select "a[href='/user/test/diary/comments']", 1 + assert_select "a[href='/user/test/account']", 0 + assert_select "a[href='/user/test/blocks']", 0 + assert_select "a[href='/user/test/blocks_by']", 0 + assert_select "a[href='/blocks/new/test']", 1 end end @@ -649,21 +650,21 @@ class UserControllerTest < ActionController::TestCase # check the data that is returned assert_select "description", :count => 1, :text => "test" assert_select "contributor-terms", :count => 1 do - assert_select "[agreed=true]" + assert_select "[agreed='true']" end assert_select "img", :count => 1 assert_select "roles", :count => 1 do assert_select "role", :count => 0 end assert_select "changesets", :count => 1 do - assert_select "[count=0]" + assert_select "[count='0']" end assert_select "traces", :count => 1 do - assert_select "[count=0]" + assert_select "[count='0']" end assert_select "blocks", :count => 1 do assert_select "received", :count => 1 do - assert_select "[count=0][active=0]" + assert_select "[count='0'][active='0']" end assert_select "issued", :count => 0 end @@ -691,7 +692,7 @@ class UserControllerTest < ActionController::TestCase # check that nothing is returned when not logged in get :api_details assert_response :unauthorized - + # check that we get a response when logged in basic_authorization(users(:normal_user).email, "test") get :api_details @@ -700,36 +701,36 @@ class UserControllerTest < ActionController::TestCase # check the data that is returned assert_select "description", :count => 1, :text => "test" assert_select "contributor-terms", :count => 1 do - assert_select "[agreed=true][pd=false]" + assert_select "[agreed='true'][pd='false']" end assert_select "img", :count => 1 assert_select "roles", :count => 1 do assert_select "role", :count => 0 end assert_select "changesets", :count => 1 do - assert_select "[count=0]", :count => 1 + assert_select "[count='0']", :count => 1 end assert_select "traces", :count => 1 do - assert_select "[count=0]", :count => 1 + assert_select "[count='0']", :count => 1 end assert_select "blocks", :count => 1 do assert_select "received", :count => 1 do - assert_select "[count=0][active=0]" + assert_select "[count='0'][active='0']" end assert_select "issued", :count => 0 end assert_select "home", :count => 1 do - assert_select "[lat=12.1][lon=12.1][zoom=3]" + assert_select "[lat='12.1'][lon='12.1'][zoom='3']" end assert_select "languages", :count => 1 do assert_select "lang", :count => 1, :text => "en" end assert_select "messages", :count => 1 do assert_select "received", :count => 1 do - assert_select "[count=1][unread=0]" + assert_select "[count='1'][unread='0']" end assert_select "sent", :count => 1 do - assert_select "[count=1]" + assert_select "[count='1']" end end end @@ -743,37 +744,37 @@ class UserControllerTest < ActionController::TestCase assert_nil Friend.where(:user_id => user.id, :friend_user_id => friend.id).first # When not logged in a GET should ask us to login - get :make_friend, {:display_name => friend.display_name} + get :make_friend, :display_name => friend.display_name assert_redirected_to :controller => :user, :action => "login", :referer => make_friend_path(:display_name => friend.display_name) # When not logged in a POST should error - post :make_friend, {:display_name => friend.display_name} + post :make_friend, :display_name => friend.display_name assert_response :forbidden assert_nil Friend.where(:user_id => user.id, :friend_user_id => friend.id).first # When logged in a GET should get a confirmation page - get :make_friend, {:display_name => friend.display_name}, {"user" => user} + get :make_friend, { :display_name => friend.display_name }, { "user" => user } assert_response :success assert_template :make_friend assert_select "form" do - assert_select "input[type=hidden][name=referer]", 0 - assert_select "input[type=submit]", 1 + assert_select "input[type='hidden'][name='referer']", 0 + assert_select "input[type='submit']", 1 end assert_nil Friend.where(:user_id => user.id, :friend_user_id => friend.id).first # The GET should preserve any referer - get :make_friend, {:display_name => friend.display_name, :referer => "/test"}, {"user" => user} + get :make_friend, { :display_name => friend.display_name, :referer => "/test" }, { "user" => user } assert_response :success assert_template :make_friend assert_select "form" do - assert_select "input[type=hidden][name=referer][value=/test]", 1 - assert_select "input[type=submit]", 1 + assert_select "input[type='hidden'][name='referer'][value='/test']", 1 + assert_select "input[type='submit']", 1 end assert_nil Friend.where(:user_id => user.id, :friend_user_id => friend.id).first # When logged in a POST should add the friendship - assert_difference('ActionMailer::Base.deliveries.size', 1) do - post :make_friend, {:display_name => friend.display_name}, {"user" => user} + assert_difference("ActionMailer::Base.deliveries.size", 1) do + post :make_friend, { :display_name => friend.display_name }, { "user" => user } end assert_redirected_to user_path(:display_name => friend.display_name) assert_match /is now your friend/, flash[:notice] @@ -784,8 +785,8 @@ class UserControllerTest < ActionController::TestCase ActionMailer::Base.deliveries.clear # A second POST should report that the friendship already exists - assert_no_difference('ActionMailer::Base.deliveries.size') do - post :make_friend, {:display_name => friend.display_name}, {"user" => user} + assert_no_difference("ActionMailer::Base.deliveries.size") do + post :make_friend, { :display_name => friend.display_name }, { "user" => user } end assert_redirected_to user_path(:display_name => friend.display_name) assert_match /You are already friends with/, flash[:warning] @@ -801,42 +802,42 @@ class UserControllerTest < ActionController::TestCase assert Friend.where(:user_id => user.id, :friend_user_id => friend.id).first # When not logged in a GET should ask us to login - get :remove_friend, {:display_name => friend.display_name} + get :remove_friend, :display_name => friend.display_name assert_redirected_to :controller => :user, :action => "login", :referer => remove_friend_path(:display_name => friend.display_name) # When not logged in a POST should error - post :remove_friend, {:display_name => friend.display_name} + post :remove_friend, :display_name => friend.display_name assert_response :forbidden assert Friend.where(:user_id => user.id, :friend_user_id => friend.id).first # When logged in a GET should get a confirmation page - get :remove_friend, {:display_name => friend.display_name}, {"user" => user} + get :remove_friend, { :display_name => friend.display_name }, { "user" => user } assert_response :success assert_template :remove_friend assert_select "form" do - assert_select "input[type=hidden][name=referer]", 0 - assert_select "input[type=submit]", 1 + assert_select "input[type='hidden'][name='referer']", 0 + assert_select "input[type='submit']", 1 end assert Friend.where(:user_id => user.id, :friend_user_id => friend.id).first # The GET should preserve any referer - get :remove_friend, {:display_name => friend.display_name, :referer => "/test"}, {"user" => user} + get :remove_friend, { :display_name => friend.display_name, :referer => "/test" }, { "user" => user } assert_response :success assert_template :remove_friend assert_select "form" do - assert_select "input[type=hidden][name=referer][value=/test]", 1 - assert_select "input[type=submit]", 1 + assert_select "input[type='hidden'][name='referer'][value='/test']", 1 + assert_select "input[type='submit']", 1 end assert Friend.where(:user_id => user.id, :friend_user_id => friend.id).first # When logged in a POST should remove the friendship - post :remove_friend, {:display_name => friend.display_name}, {"user" => user} + post :remove_friend, { :display_name => friend.display_name }, { "user" => user } assert_redirected_to user_path(:display_name => friend.display_name) assert_match /was removed from your friends/, flash[:notice] assert_nil Friend.where(:user_id => user.id, :friend_user_id => friend.id).first # A second POST should report that the friendship does not exist - post :remove_friend, {:display_name => friend.display_name}, {"user" => user} + post :remove_friend, { :display_name => friend.display_name }, { "user" => user } assert_redirected_to user_path(:display_name => friend.display_name) assert_match /is not one of your friends/, flash[:error] assert_nil Friend.where(:user_id => user.id, :friend_user_id => friend.id).first @@ -844,17 +845,17 @@ class UserControllerTest < ActionController::TestCase def test_set_status # Try without logging in - get :set_status, {:display_name => users(:normal_user).display_name, :status => "suspended"} + get :set_status, :display_name => users(:normal_user).display_name, :status => "suspended" assert_response :redirect assert_redirected_to :action => :login, :referer => set_status_user_path(:status => "suspended") # Now try as a normal user - get :set_status, {:display_name => users(:normal_user).display_name, :status => "suspended"}, {:user => users(:normal_user).id} + get :set_status, { :display_name => users(:normal_user).display_name, :status => "suspended" }, { :user => users(:normal_user).id } assert_response :redirect assert_redirected_to :action => :view, :display_name => users(:normal_user).display_name # Finally try as an administrator - get :set_status, {:display_name => users(:normal_user).display_name, :status => "suspended"}, {:user => users(:administrator_user).id} + get :set_status, { :display_name => users(:normal_user).display_name, :status => "suspended" }, { :user => users(:administrator_user).id } assert_response :redirect assert_redirected_to :action => :view, :display_name => users(:normal_user).display_name assert_equal "suspended", User.find(users(:normal_user).id).status @@ -862,17 +863,17 @@ class UserControllerTest < ActionController::TestCase def test_delete # Try without logging in - get :delete, {:display_name => users(:normal_user).display_name, :status => "suspended"} + get :delete, :display_name => users(:normal_user).display_name, :status => "suspended" assert_response :redirect assert_redirected_to :action => :login, :referer => delete_user_path(:status => "suspended") # Now try as a normal user - get :delete, {:display_name => users(:normal_user).display_name, :status => "suspended"}, {:user => users(:normal_user).id} + get :delete, { :display_name => users(:normal_user).display_name, :status => "suspended" }, { :user => users(:normal_user).id } assert_response :redirect assert_redirected_to :action => :view, :display_name => users(:normal_user).display_name # Finally try as an administrator - get :delete, {:display_name => users(:normal_user).display_name, :status => "suspended"}, {:user => users(:administrator_user).id} + get :delete, { :display_name => users(:normal_user).display_name, :status => "suspended" }, { :user => users(:administrator_user).id } assert_response :redirect assert_redirected_to :action => :view, :display_name => users(:normal_user).display_name