Files
old-zsterminator/test/controllers/reservations_controller_test.rb
2024-08-06 14:16:40 +02:00

49 lines
1.6 KiB
Ruby

require "test_helper"
class ReservationsControllerTest < ActionDispatch::IntegrationTest
setup do
@reservation = reservations(:one)
end
test "should get index" do
get reservations_url
assert_response :success
end
test "should get new" do
get new_reservation_url
assert_response :success
end
test "should create reservation" do
assert_difference("Reservation.count") do
post reservations_url, params: { reservation: { company_id: @reservation.company_id, customer_id: @reservation.customer_id, description: @reservation.description, end_time: @reservation.end_time, place_id: @reservation.place_id, start_time: @reservation.start_time, title: @reservation.title } }
end
assert_redirected_to reservation_url(Reservation.last)
end
test "should show reservation" do
get reservation_url(@reservation)
assert_response :success
end
test "should get edit" do
get edit_reservation_url(@reservation)
assert_response :success
end
test "should update reservation" do
patch reservation_url(@reservation), params: { reservation: { company_id: @reservation.company_id, customer_id: @reservation.customer_id, description: @reservation.description, end_time: @reservation.end_time, place_id: @reservation.place_id, start_time: @reservation.start_time, title: @reservation.title } }
assert_redirected_to reservation_url(@reservation)
end
test "should destroy reservation" do
assert_difference("Reservation.count", -1) do
delete reservation_url(@reservation)
end
assert_redirected_to reservations_url
end
end