# frozen_string_literal: true require_relative '../spec_helper' RSpec.describe(HardwareController) do # /hardware - redirects to /hardware/list describe 'GET /hardware' do before { get '/hardware' } it 'Hardware base route redirects to /hardware/list' do expect(last_response).to(be_redirect) expect(last_response['Location']).to(eq("#{BASE_URL}/hardware/list")) end end # /hardware/list - displays a table of hardwares describe 'GET /hardware/list' do before { get '/hardware/list' } it 'Hardware list page returns 200.' do expect(last_response).to(be_ok) end it "Hardware list page contains 'List of hardware' on page." do expect(last_response.body).to(include('List of hardware')) end end # /hardware/add - form for adding hardware describe 'GET /hardware/add' do before { get '/hardware/add' } it 'Hardware add page returns 200.' do expect(last_response).to(be_ok) end it "Hardware add page contains 'Add new hardware' on page." do expect(last_response.body).to(include('Add new hardware')) end end end