This commit is contained in:
Toks
2014-01-08 17:06:56 -05:00
parent fac10ede98
commit cb629613bd
5 changed files with 7 additions and 7 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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