sample_rails_tailwind/test/integration/users_index_test.rb
songtianlun 022eae3029 feat: add pagination to user index view
- Integrate Kaminari for pagination of users
- Update users_controller to paginate users
- Add pagination views for first, last, next, and previous pages
- Seed database with example users for testing

This commit introduces pagination to the user index view, allowing
for better navigation through large sets of users. The Kaminari gem
is utilized to handle pagination, improving the user experience by
reducing load times and enhancing usability. Additionally, the
seeding script has been updated to create multiple users for
better testing of the pagination feature.
2025-01-05 17:50:33 +08:00

18 lines
388 B
Ruby

require "test_helper"
class UsersIndexTest < ActionDispatch::IntegrationTest
def setup
@user = users(:michael)
end
test "index including pagination" do
log_in_as(@user)
get users_path
assert_template "users/index"
assert_select "ul.pagination"
User.page(1).each do |user|
assert_select "a[href=?]", user_path(user), text: user.name
end
end
end