2021-12-28 10:59:16 +01:00
|
|
|
require "test_helper"
|
|
|
|
|
|
|
|
class UsersControllerTest < ActionDispatch::IntegrationTest
|
|
|
|
setup do
|
|
|
|
@user = users(:one)
|
|
|
|
end
|
|
|
|
|
|
|
|
test "should get index" do
|
|
|
|
get users_url
|
|
|
|
assert_response :success
|
|
|
|
end
|
|
|
|
|
|
|
|
test "should get new" do
|
|
|
|
get new_user_url
|
|
|
|
assert_response :success
|
|
|
|
end
|
|
|
|
|
|
|
|
test "should create user" do
|
|
|
|
assert_difference("User.count") do
|
2023-02-26 15:09:08 +01:00
|
|
|
post users_url, params: {user: {}}
|
2021-12-28 10:59:16 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
assert_redirected_to user_url(User.last)
|
|
|
|
end
|
|
|
|
|
|
|
|
test "should show user" do
|
|
|
|
get user_url(@user)
|
|
|
|
assert_response :success
|
|
|
|
end
|
|
|
|
|
|
|
|
test "should get edit" do
|
|
|
|
get edit_user_url(@user)
|
|
|
|
assert_response :success
|
|
|
|
end
|
|
|
|
|
|
|
|
test "should update user" do
|
2023-02-26 15:09:08 +01:00
|
|
|
patch user_url(@user), params: {user: {}}
|
2021-12-28 10:59:16 +01:00
|
|
|
assert_redirected_to user_url(@user)
|
|
|
|
end
|
|
|
|
|
|
|
|
test "should destroy user" do
|
|
|
|
assert_difference("User.count", -1) do
|
|
|
|
delete user_url(@user)
|
|
|
|
end
|
|
|
|
|
|
|
|
assert_redirected_to users_url
|
|
|
|
end
|
|
|
|
end
|