mod actions: add options to filter /mod_actions by subject.

This commit is contained in:
evazion
2022-09-25 22:48:23 -05:00
parent 3dc765ca9d
commit 17c6a2d77b
8 changed files with 61 additions and 12 deletions

View File

@@ -1,7 +1,8 @@
FactoryBot.define do
factory(:mod_action) do
creator :factory => :user
description {"1234"}
category {"other"}
creator factory: :user
subject factory: :post
description { "undeleted post ##{subject_id}" }
category { "post_undelete" }
end
end

View File

@@ -60,6 +60,26 @@ class IpBansControllerTest < ActionDispatch::IntegrationTest
end
end
context "show action" do
should "redirect for html" do
get_auth ip_ban_path(@ip_ban), @admin
assert_redirected_to ip_bans_path(search: { id: @ip_ban.id })
end
should "render for json" do
get_auth ip_ban_path(@ip_ban), @admin, as: :json
assert_response :success
end
should "render 403 for an unauthorized user" do
get ip_ban_path(@ip_ban)
assert_response 403
end
end
context "update action" do
should "mark an ip ban as deleted" do
put_auth ip_ban_path(@ip_ban), @admin, params: { ip_ban: { is_deleted: true }, format: "js" }