mirror of
https://github.com/basecamp/once-campfire.git
synced 2026-10-08 15:50:08 +09:00
Merge pull request #316: List one page of account members at a time
Reviewed and merged by GPT on behalf of DHH.
This commit is contained in:
@@ -52,6 +52,19 @@ class AccountsControllerTest < ActionDispatch::IntegrationTest
|
||||
end
|
||||
end
|
||||
|
||||
test "edit lists a page of members and the next page carries on from it" do
|
||||
User.insert_all 501.times.map { |i| { name: "Member #{i}", email_address: "member#{i}@37signals.com" } }
|
||||
users(:kevin).banned!
|
||||
|
||||
get edit_account_url
|
||||
first_page = listed_user_ids
|
||||
get account_users_url(page: 2, format: :turbo_stream)
|
||||
next_page = listed_user_ids
|
||||
|
||||
assert_not_empty next_page
|
||||
assert_equal User.where(status: [ :active, :banned ]).without_bots.ids.sort, (first_page + next_page).sort
|
||||
end
|
||||
|
||||
test "update" do
|
||||
assert users(:david).administrator?
|
||||
|
||||
@@ -68,4 +81,9 @@ class AccountsControllerTest < ActionDispatch::IntegrationTest
|
||||
put account_url, params: { account: { name: "Different" } }
|
||||
assert_response :forbidden
|
||||
end
|
||||
|
||||
private
|
||||
def listed_user_ids
|
||||
response.body.scan(%r{href="/users/(\d+)"}).flatten.map(&:to_i)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user