sample_rails_tailwind/test/integration/users_index_test.rb
songtianlun 81906319ea chore: update thruster gem and configure smtp settings
- Upgrade thruster gem to version 0.1.10
- Set SMTP user credentials for sending emails
- Adjust test to verify only activated users are displayed

These updates improve email handling and ensure that the application
uses the latest version of the thruster gem, while also refining
the user index test to accurately reflect the activated state.
2025-01-07 13:18:16 +08:00

30 lines
781 B
Ruby

require "test_helper"
class UsersIndexTest < ActionDispatch::IntegrationTest
def setup
@admin = users(:michael)
@non_admin = users(:archer)
end
test "index including pagination and delete links" do
log_in_as(@admin)
get users_path
assert_template "users/index"
assert_select "ul.pagination"
first_page_of_users = User.where(activated: true).page(1)
# first_page_of_users.first.toggle!(:activated)
first_page_of_users.each do |user|
assert user.activated?
assert_select "a[href=?]", user_path(user), text: user.name
unless user == @admin
assert_select "a[href=?]", user_path(user), text: "delete"
end
end
assert_difference "User.count", -1 do
delete user_path(@non_admin)
end
end
end