- Implement users index action in UsersController - Create view for displaying all users with gravatar - Update header to link to users index - Add styles for user list display This commit introduces a new feature that allows logged-in users to view a list of all registered users. It includes necessary controller actions, view templates, and styling to improve the user interface.
39 lines
983 B
Ruby
39 lines
983 B
Ruby
require "test_helper"
|
|
|
|
class UsersControllerTest < ActionDispatch::IntegrationTest
|
|
def setup
|
|
@user = users(:michael)
|
|
@other_user = users(:archer)
|
|
end
|
|
test "should get new" do
|
|
get signup_path
|
|
assert_response :success
|
|
end
|
|
|
|
test "should redirect index when not logged in" do
|
|
get users_path
|
|
assert_redirected_to login_url
|
|
end
|
|
|
|
test "Should get sign up title" do
|
|
get signup_path
|
|
assert_response :success
|
|
assert_select "title", full_title("Sign up")
|
|
end
|
|
|
|
test "should redirect edit when logged in as wrong user" do
|
|
log_in_as(@other_user)
|
|
get edit_user_path(@user)
|
|
assert flash.empty?
|
|
assert_redirected_to root_url
|
|
end
|
|
|
|
test "should redirect update when logged in as wrong user" do
|
|
log_in_as(@other_user)
|
|
patch user_path(@user), params: { user: { name: @user.name,
|
|
email: @user.email } }
|
|
assert flash.empty?
|
|
assert_redirected_to root_url
|
|
end
|
|
end
|