Configure tests and helpers for current backend state
This commit is contained in:
parent
471440804c
commit
4edae5e7bb
9 changed files with 85 additions and 11 deletions
38
test/controllers/users_controller_test.rb
Normal file
38
test/controllers/users_controller_test.rb
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue