Files
game-data/spec/controllers/test_controller_spec.rb
Gregory Ballantine 3f0efce0d8
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Fixed a few lints; changed rake task name to test:lint
2025-08-12 23:56:46 -04:00

45 lines
1.1 KiB
Ruby

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