Skip to content

Commit 662a9b8

Browse files
committed
added tests for admin controller's :hellban action
1 parent 308fce4 commit 662a9b8

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

test/controllers/admin_controller_test.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,4 +165,21 @@ class AdminControllerTest < ActionController::TestCase
165165
assert_response(:success)
166166
assert_not_nil assigns(:logs)
167167
end
168+
169+
test 'hellban should correctly block the user' do
170+
sign_in users(:global_admin)
171+
172+
user = users(:standard_user)
173+
try_hellban_user(user)
174+
user.reload
175+
176+
assert_response(:found)
177+
assert BlockedItem.where(item_type: 'email', value: user.email).any?
178+
end
179+
180+
private
181+
182+
def try_hellban_user(user)
183+
post :hellban, params: { id: user.id }
184+
end
168185
end

0 commit comments

Comments
 (0)