sample_rails_tailwind/test/integration/users_index_test.rb
songtianlun 81843f0c08
Some checks failed
CI / scan_ruby (push) Has been cancelled
CI / scan_js (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / test (push) Has been cancelled
chore: remove unused jQuery and Bootstrap dependencies
- Deleted the `add_jquery.js` file as jQuery is no longer needed.
- Removed references to Bootstrap from the Gemfile and package.json.
- Updated the application layout to reflect the removal of Bootstrap styles.
- Adjusted the paginator HTML to use a class that aligns with the new styling.

These changes streamline the asset pipeline by eliminating unused libraries,
which can improve load times and reduce potential security vulnerabilities.
The application now relies on alternative styling and JavaScript solutions.
2025-01-17 17:08:07 +08:00

30 lines
794 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 "div.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=?][data-turbo-method='delete']", user_path(user)
end
end
assert_difference "User.count", -1 do
delete user_path(@non_admin)
end
end
end