#2079: Fix tests
This commit is contained in:
@@ -30,7 +30,7 @@ class Admin::UsersControllerTest < ActionController::TestCase
|
|||||||
context "promoted to an admin" do
|
context "promoted to an admin" do
|
||||||
should "fail" do
|
should "fail" do
|
||||||
put :update, {:id => @user.id, :user => {:level => "50"}}, {:user_id => @mod.id}
|
put :update, {:id => @user.id, :user => {:level => "50"}}, {:user_id => @mod.id}
|
||||||
assert_redirected_to(new_session_path)
|
assert_response(403)
|
||||||
@user.reload
|
@user.reload
|
||||||
assert_equal(20, @user.level)
|
assert_equal(20, @user.level)
|
||||||
end
|
end
|
||||||
@@ -39,8 +39,8 @@ class Admin::UsersControllerTest < ActionController::TestCase
|
|||||||
|
|
||||||
context "on an admin user" do
|
context "on an admin user" do
|
||||||
should "fail" do
|
should "fail" do
|
||||||
put :update, {:id => @admin.id, :user => {:level => "30"}}
|
put :update, {:id => @admin.id, :user => {:level => "30"}}, {:user_id => @mod.id}
|
||||||
assert_redirected_to new_session_path
|
assert_response(403)
|
||||||
@admin.reload
|
@admin.reload
|
||||||
assert_equal(50, @admin.level)
|
assert_equal(50, @admin.level)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class AdvertisementsControllerTest < ActionController::TestCase
|
|||||||
should "block non-advertisers" do
|
should "block non-advertisers" do
|
||||||
regular_user = FactoryGirl.create(:user)
|
regular_user = FactoryGirl.create(:user)
|
||||||
get :index, {}, {:user_id => regular_user.id}
|
get :index, {}, {:user_id => regular_user.id}
|
||||||
assert_redirected_to(new_session_path(:url => advertisements_path))
|
assert_response(403)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ class DmailsControllerTest < ActionController::TestCase
|
|||||||
|
|
||||||
should "not show dmails not owned by the current user" do
|
should "not show dmails not owned by the current user" do
|
||||||
get :show, {:id => @dmail.id}, {:user_id => @unrelated_user.id}
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
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}
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
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}
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user