From cb629613bd41969a0efe456a928ebdd34caf51ff Mon Sep 17 00:00:00 2001 From: Toks Date: Wed, 8 Jan 2014 17:06:56 -0500 Subject: [PATCH] #2079: Fix tests --- test/functional/admin/users_controller_test.rb | 6 +++--- test/functional/advertisements_controller_test.rb | 2 +- test/functional/dmails_controller_test.rb | 2 +- test/functional/forum_posts_controller_test.rb | 2 +- test/functional/forum_topics_controller_test.rb | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/functional/admin/users_controller_test.rb b/test/functional/admin/users_controller_test.rb index 8acaddcb2..3435503b6 100644 --- a/test/functional/admin/users_controller_test.rb +++ b/test/functional/admin/users_controller_test.rb @@ -30,7 +30,7 @@ class Admin::UsersControllerTest < ActionController::TestCase context "promoted to an admin" do should "fail" do put :update, {:id => @user.id, :user => {:level => "50"}}, {:user_id => @mod.id} - assert_redirected_to(new_session_path) + assert_response(403) @user.reload assert_equal(20, @user.level) end @@ -39,8 +39,8 @@ class Admin::UsersControllerTest < ActionController::TestCase context "on an admin user" do should "fail" do - put :update, {:id => @admin.id, :user => {:level => "30"}} - assert_redirected_to new_session_path + put :update, {:id => @admin.id, :user => {:level => "30"}}, {:user_id => @mod.id} + assert_response(403) @admin.reload assert_equal(50, @admin.level) end diff --git a/test/functional/advertisements_controller_test.rb b/test/functional/advertisements_controller_test.rb index 43738ab62..72b2a5d77 100644 --- a/test/functional/advertisements_controller_test.rb +++ b/test/functional/advertisements_controller_test.rb @@ -52,7 +52,7 @@ class AdvertisementsControllerTest < ActionController::TestCase should "block non-advertisers" do regular_user = FactoryGirl.create(:user) get :index, {}, {:user_id => regular_user.id} - assert_redirected_to(new_session_path(:url => advertisements_path)) + assert_response(403) end end end diff --git a/test/functional/dmails_controller_test.rb b/test/functional/dmails_controller_test.rb index 5644d798d..90b761e98 100644 --- a/test/functional/dmails_controller_test.rb +++ b/test/functional/dmails_controller_test.rb @@ -66,7 +66,7 @@ class DmailsControllerTest < ActionController::TestCase should "not show dmails not owned by the current user" do get :show, {:id => @dmail.id}, {:user_id => @unrelated_user.id} - assert_redirected_to(new_session_path(:url => "/dmails/#{@dmail.id}")) + assert_response(403) end end diff --git a/test/functional/forum_posts_controller_test.rb b/test/functional/forum_posts_controller_test.rb index ff7281d97..2900dda54 100644 --- a/test/functional/forum_posts_controller_test.rb +++ b/test/functional/forum_posts_controller_test.rb @@ -51,7 +51,7 @@ class ForumPostsControllerTest < ActionController::TestCase should "fail if the editor is not the creator of the topic and is not a moderator" do get :edit, {:id => @forum_post.id}, {:user_id => @other_user.id} - assert_redirected_to(new_session_path(:url => edit_forum_post_path(@forum_post))) + assert_response(403) end end diff --git a/test/functional/forum_topics_controller_test.rb b/test/functional/forum_topics_controller_test.rb index bc08b9bbc..3ab5c37e7 100644 --- a/test/functional/forum_topics_controller_test.rb +++ b/test/functional/forum_topics_controller_test.rb @@ -50,7 +50,7 @@ class ForumTopicsControllerTest < ActionController::TestCase should "fail if the editor is not the creator of the topic and is not a moderator" do get :edit, {:id => @forum_topic.id}, {:user_id => @other_user.id} - assert_redirected_to(new_session_path(:url => edit_forum_topic_path(@forum_topic))) + assert_response(403) end end