Files
vms/test/controllers/vehicles_controller_test.rb
David Böhm 132ea2c51d
Some checks are pending
CI / scan_ruby (push) Waiting to run
CI / scan_js (push) Waiting to run
CI / lint (push) Waiting to run
CI / test (push) Waiting to run
Added vehicle scaffold
2024-08-20 19:50:29 +02:00

49 lines
1.3 KiB
Ruby

require "test_helper"
class VehiclesControllerTest < ActionDispatch::IntegrationTest
setup do
@vehicle = vehicles(:one)
end
test "should get index" do
get vehicles_url
assert_response :success
end
test "should get new" do
get new_vehicle_url
assert_response :success
end
test "should create vehicle" do
assert_difference("Vehicle.count") do
post vehicles_url, params: { vehicle: { car_brand: @vehicle.car_brand, fuel_type: @vehicle.fuel_type, license_plate: @vehicle.license_plate, model: @vehicle.model, model_year: @vehicle.model_year, type: @vehicle.type } }
end
assert_redirected_to vehicle_url(Vehicle.last)
end
test "should show vehicle" do
get vehicle_url(@vehicle)
assert_response :success
end
test "should get edit" do
get edit_vehicle_url(@vehicle)
assert_response :success
end
test "should update vehicle" do
patch vehicle_url(@vehicle), params: { vehicle: { car_brand: @vehicle.car_brand, fuel_type: @vehicle.fuel_type, license_plate: @vehicle.license_plate, model: @vehicle.model, model_year: @vehicle.model_year, type: @vehicle.type } }
assert_redirected_to vehicle_url(@vehicle)
end
test "should destroy vehicle" do
assert_difference("Vehicle.count", -1) do
delete vehicle_url(@vehicle)
end
assert_redirected_to vehicles_url
end
end