Added some more tests; changed URLs for model list pages and added redirects
This commit is contained in:
41
spec/controllers/test_controller_spec.rb
Normal file
41
spec/controllers/test_controller_spec.rb
Normal file
@@ -0,0 +1,41 @@
|
||||
# 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
|
Reference in New Issue
Block a user