Made UI pretty!
CI / scan_ruby (push) Failing after 9s
CI / scan_js (push) Failing after 7s
CI / lint (push) Failing after 8s

This commit is contained in:
2026-09-17 20:59:56 -06:00
parent 7c71f4a0ad
commit 87894ad620
6 changed files with 938 additions and 287 deletions
+66 -2
View File
@@ -81,6 +81,44 @@ RSpec.describe "Vehicles" do
expect(response.body).to include(active_vehicle.model)
expect(response.body).to include(inactive_vehicle.model)
end
it "shows upcoming maintenance names on vehicle tiles" do
vehicle = create(:vehicle, current_odometer: 14_750)
create(
:maintenance_schedule,
vehicle: vehicle,
maintenance_type: "Oil Change",
mileage_interval: 5_000,
baseline_odometer: 10_000,
baseline_date: Date.current
)
get vehicles_path
expect(response).to have_http_status(:ok)
expect(response.body).to include("vehicle-card--upcoming")
expect(response.body).to include("Upcoming maintenance")
expect(response.body).to include("Oil Change")
end
it "shows overdue maintenance names on vehicle tiles" do
vehicle = create(:vehicle, current_odometer: 15_000)
create(
:maintenance_schedule,
vehicle: vehicle,
maintenance_type: "Oil Change",
mileage_interval: 5_000,
baseline_odometer: 10_000,
baseline_date: Date.current
)
get vehicles_path
expect(response).to have_http_status(:ok)
expect(response.body).to include("vehicle-card--overdue")
expect(response.body).to include("Overdue maintenance")
expect(response.body).to include("Oil Change")
end
end
describe "GET /vehicles/:id" do
@@ -110,6 +148,7 @@ RSpec.describe "Vehicles" do
expect(response).to have_http_status(:ok)
expect(response.body).to include(vehicle.make)
expect(response.body).to include(vehicle.model)
expect(response.body).to include("Vehicle Information")
expect(response.body).to include("Maintenance Schedules")
expect(response.body).to include("Manage maintenance schedules")
expect(response.body).to include("Fuel History")
@@ -121,6 +160,8 @@ RSpec.describe "Vehicles" do
expect(response.body).to include(older_maintenance_entry.notes)
expect(response.body.index("12,000")).to be < response.body.index("11,000")
expect(response.body.index(newer_maintenance_entry.notes)).to be < response.body.index(older_maintenance_entry.notes)
expect(response.body.index("Record Fuel")).to be < response.body.index("Record Maintenance")
expect(response.body.index("Maintenance History")).to be < response.body.index("Fuel History")
end
it "shows overdue maintenance alerts" do
@@ -137,8 +178,11 @@ RSpec.describe "Vehicles" do
get vehicle_path(vehicle)
expect(response).to have_http_status(:ok)
expect(response.body).to include("Overdue Maintenance")
expect(response.body).to include("Overdue maintenance")
expect(response.body).to include("Oil Change is overdue")
expect(response.body).to include("aria-label=\"Maintenance attention needed\"")
expect(response.body).to include("<summary>Record Maintenance</summary>")
expect(response.body).to include("<details class=\"dashboard-section\" open>")
end
it "shows upcoming maintenance warnings" do
@@ -155,8 +199,28 @@ RSpec.describe "Vehicles" do
get vehicle_path(vehicle)
expect(response).to have_http_status(:ok)
expect(response.body).to include("Upcoming Maintenance")
expect(response.body).to include("Upcoming maintenance")
expect(response.body).to include("Oil Change is upcoming")
expect(response.body).to include("aria-label=\"Maintenance attention needed\"")
expect(response.body).to include("<summary>Record Maintenance</summary>")
expect(response.body).to include("<details class=\"dashboard-section\" open>")
end
it "hides the top maintenance alert area when maintenance is current" do
vehicle = create(:vehicle, current_odometer: 10_100)
create(:maintenance_schedule, vehicle: vehicle, maintenance_type: "Oil Change")
create(
:maintenance_entry,
vehicle: vehicle,
name: "Oil Change",
odometer: 10_000,
date: Date.current
)
get vehicle_path(vehicle)
expect(response).to have_http_status(:ok)
expect(response.body).not_to include("aria-label=\"Maintenance attention needed\"")
end
it "shows no-history maintenance status without marking it overdue" do