testy/test/controllers/guests_controller_test.rb
Mohammad Kanaan 2cc3c1a7dd
Some checks are pending
CI / scan_ruby (push) Waiting to run
CI / lint (push) Waiting to run
CI / test (push) Waiting to run
initial commit
2026-05-17 14:12:43 +03:00

38 lines
891 B
Ruby

require "test_helper"
class GuestsControllerTest < ActionDispatch::IntegrationTest
setup do
@guest = guests(:one)
end
test "should get index" do
get guests_url, as: :json
assert_response :success
end
test "should create guest" do
assert_difference("Guest.count") do
post guests_url, params: { guest: { name: @guest.name, username: @guest.username } }, as: :json
end
assert_response :created
end
test "should show guest" do
get guest_url(@guest), as: :json
assert_response :success
end
test "should update guest" do
patch guest_url(@guest), params: { guest: { name: @guest.name, username: @guest.username } }, as: :json
assert_response :success
end
test "should destroy guest" do
assert_difference("Guest.count", -1) do
delete guest_url(@guest), as: :json
end
assert_response :no_content
end
end