From dc0442bd17485b59e2b385eb8a094c62c270bc32 Mon Sep 17 00:00:00 2001 From: evazion Date: Fri, 3 Apr 2020 15:39:14 -0500 Subject: [PATCH] bans: redirect to index page after creating new ban. --- app/controllers/bans_controller.rb | 2 +- test/functional/bans_controller_test.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/bans_controller.rb b/app/controllers/bans_controller.rb index 74bbcd8a1..74b76372a 100644 --- a/app/controllers/bans_controller.rb +++ b/app/controllers/bans_controller.rb @@ -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 diff --git a/test/functional/bans_controller_test.rb b/test/functional/bans_controller_test.rb index 97484e615..f42f6194b 100644 --- a/test/functional/bans_controller_test.rb +++ b/test/functional/bans_controller_test.rb @@ -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