42 lines
1.0 KiB
Ruby
42 lines
1.0 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 redirects to /test/list' do
|
|
expect(last_response).to(be_redirect)
|
|
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
|