bans: redirect to index page after creating new ban.
This commit is contained in:
@@ -26,7 +26,7 @@ class BansController < ApplicationController
|
||||
def create
|
||||
@ban = authorize Ban.new(banner: CurrentUser.user, **permitted_attributes(Ban))
|
||||
@ban.save
|
||||
respond_with(@ban)
|
||||
respond_with(@ban, location: bans_path)
|
||||
end
|
||||
|
||||
def update
|
||||
|
||||
@@ -50,7 +50,7 @@ class BansControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_difference("Ban.count", 1) do
|
||||
post_auth bans_path, @mod, params: { ban: { duration: 60, reason: "xxx", user_id: @user.id }}
|
||||
|
||||
assert_response :redirect
|
||||
assert_redirected_to bans_path
|
||||
assert_equal(true, @user.reload.is_banned?)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user