bans: redirect to index page after creating new ban.

This commit is contained in:
evazion
2020-04-03 15:39:14 -05:00
parent 9312e0c78c
commit dc0442bd17
2 changed files with 2 additions and 2 deletions

View File

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

View File

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