52 lines
1.4 KiB
Ruby
52 lines
1.4 KiB
Ruby
require "application_system_test_case"
|
|
|
|
class VehiclesTest < ApplicationSystemTestCase
|
|
setup do
|
|
@vehicle = vehicles(:one)
|
|
end
|
|
|
|
test "visiting the index" do
|
|
visit vehicles_url
|
|
assert_selector "h1", text: "Vehicles"
|
|
end
|
|
|
|
test "should create vehicle" do
|
|
visit vehicles_url
|
|
click_on "New vehicle"
|
|
|
|
fill_in "Car brand", with: @vehicle.car_brand
|
|
fill_in "Fuel type", with: @vehicle.fuel_type
|
|
fill_in "License plate", with: @vehicle.license_plate
|
|
fill_in "Model", with: @vehicle.model
|
|
fill_in "Model year", with: @vehicle.model_year
|
|
fill_in "Type", with: @vehicle.type
|
|
click_on "Create Vehicle"
|
|
|
|
assert_text "Vehicle was successfully created"
|
|
click_on "Back"
|
|
end
|
|
|
|
test "should update Vehicle" do
|
|
visit vehicle_url(@vehicle)
|
|
click_on "Edit this vehicle", match: :first
|
|
|
|
fill_in "Car brand", with: @vehicle.car_brand
|
|
fill_in "Fuel type", with: @vehicle.fuel_type
|
|
fill_in "License plate", with: @vehicle.license_plate
|
|
fill_in "Model", with: @vehicle.model
|
|
fill_in "Model year", with: @vehicle.model_year.to_s
|
|
fill_in "Type", with: @vehicle.type
|
|
click_on "Update Vehicle"
|
|
|
|
assert_text "Vehicle was successfully updated"
|
|
click_on "Back"
|
|
end
|
|
|
|
test "should destroy Vehicle" do
|
|
visit vehicle_url(@vehicle)
|
|
click_on "Destroy this vehicle", match: :first
|
|
|
|
assert_text "Vehicle was successfully destroyed"
|
|
end
|
|
end
|