1 # frozen_string_literal: true
3 require "application_system_test_case"
5 class UserStatusChangeTest < ApplicationSystemTestCase
7 admin = create(:administrator_user)
11 test "Admin can unsuspend a user" do
12 user = create(:user, :suspended)
18 assert_no_content "Unsuspend"
20 assert_equal "active", user.status
23 test "Admin can suspend a user" do
24 # There's another instance of "Suspend" in the page.
25 # This test uses a more specific text, putting it in
26 # a variable to avoid a misspelling when doing
27 # `assert_no_content` later
28 suspend_action_text = "Suspend this User"
33 click_on suspend_action_text
36 assert_no_content suspend_action_text
38 assert_equal "suspended", user.status
41 test "Admin can confirm a user" do
42 user = create(:user, :suspended)
48 assert_no_content "Unsuspend"
50 assert_equal "confirmed", user.status