Make sure hidden users are shown in order

The test "Action links remember the pagination setting and the filter"
was failing sometimes because it assumed the third user created was
going to appear in the third place, but that wasn't always the case.

So we're using the same order we use in the rest of the sections dealing
with hidden content.
This commit is contained in:
Javi Martín
2021-12-22 16:02:49 +01:00
parent 7caee9a93c
commit 992da1fef3
2 changed files with 2 additions and 2 deletions

View File

@@ -4,7 +4,7 @@ class Admin::HiddenUsersController < Admin::BaseController
before_action :load_user, only: [:confirm_hide, :restore] before_action :load_user, only: [:confirm_hide, :restore]
def index def index
@users = User.only_hidden.send(@current_filter).page(params[:page]) @users = User.only_hidden.send(@current_filter).order(hidden_at: :desc).page(params[:page])
end end
def show def show

View File

@@ -83,7 +83,7 @@ describe "Admin hidden users", :admin do
visit admin_hidden_users_path(filter: "with_confirmed_hide", page: 2) visit admin_hidden_users_path(filter: "with_confirmed_hide", page: 2)
accept_confirm("Are you sure? Restore \"#{users[2].name}\"") do accept_confirm("Are you sure? Restore \"#{users[-3].name}\"") do
click_button "Restore", match: :first, exact: true click_button "Restore", match: :first, exact: true
end end