Merge branch 'master' into attribute-searching

This commit is contained in:
evazion
2020-08-17 14:23:00 -05:00
committed by GitHub
155 changed files with 2834 additions and 2169 deletions

View File

@@ -57,6 +57,7 @@ class BansControllerTest < ActionDispatch::IntegrationTest
context "create action" do
should "allow mods to ban members" do
assert_difference("Ban.count", 1) do
@user = create(:user)
post_auth bans_path, @mod, params: { ban: { duration: 60, reason: "xxx", user_id: @user.id }}
assert_redirected_to bans_path
@@ -85,12 +86,20 @@ class BansControllerTest < ActionDispatch::IntegrationTest
should "not allow regular users to ban anyone" do
assert_difference("Ban.count", 0) do
@user = create(:user)
post_auth bans_path, @user, params: { ban: { duration: 60, reason: "xxx", user_id: @mod.id }}
assert_response 403
assert_equal(false, @mod.reload.is_banned?)
end
end
should "not allow users to be double banned" do
assert_difference("Ban.count", 0) do
post_auth bans_path, @mod, params: { ban: { duration: 60, reason: "xxx", user_id: @ban.user.id }}
assert_response :success
end
end
end
context "update action" do