Configure tests and helpers for current backend state

This commit is contained in:
hannah.dagemark 2025-05-09 14:58:37 +02:00 committed by Hannah Dagemark
commit 4edae5e7bb
9 changed files with 85 additions and 11 deletions

View file

@ -0,0 +1,38 @@
require "test_helper"
class UsersControllerTest < ActionDispatch::IntegrationTest
setup do
@user = users(:one) # Assuming you have a fixture or factory for @user
end
test "should get new" do
get new_user_path
assert_response :success
end
test "should get create" do
post users_path
assert_response :success
# post users_path, params: { user: { username: "testuser", password: "password123" } }
# assert_redirected_to user_path(User.last)
end
test "should get edit" do
get edit_user_path(@user)
assert_response :success
end
test "should get update" do
patch user_path(@user)
assert_response :success
# Probably also assert a successful redirect later and push correct data params
end
test "should get destroy" do
delete user_path(@user)
assert_response :success
# Possibly this one too I suppose
end
end