Adding more unit tests
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2025-08-20 22:54:23 -04:00
parent 8c5f510c70
commit 619c122769
3 changed files with 150 additions and 1 deletions

View File

@@ -60,7 +60,7 @@ RSpec.describe(HardwareController) do
before do
request_data = {
hardware_name: 'Test Hardware',
hardware_type: 'gpu',
hardware_type: 'gpu'
}
post '/hardware/add', request_data
end
@@ -109,4 +109,24 @@ RSpec.describe(HardwareController) do
expect(last_response.body).to(include("#{@hardware.name}"))
end
end
# GET /hardware/:hardware_id/edit - page for editing a hardware model
describe 'GET /hardware/:hardware_id/edit' do
before do
@hardware = Hardware.create(name: 'Test Hardware', type: 'gpu')
get "/hardware/#{@hardware.id}/edit"
end
it 'Hardware edit page returns 200.' do
expect(last_response).to(be_ok)
end
it 'Hardware edit page is an HTML response' do
expect(last_response['Content-Type']).to(include('text/html'))
end
it 'Hardware edit page contains "Editing: <hardware name>" on page.' do
expect(last_response.body).to(include("Editing: #{@hardware.name}"))
end
end
end