Repository URL to install this package:
|
Version:
7.3.3 ▾
|
# frozen_string_literal: true
shared_examples 'the page requires login' do
it 'responds with 401' do
expect(subject.status_code).to eq(401)
end
end
shared_examples 'the page denies access' do |expected_string: 'Access Denied'|
it 'responds with 403 with the correct message and a link to /', :aggregate_failures do
expect(subject.status_code).to eq(403)
expect(subject).to have_link href: '/'
expect(subject).to have_text expected_string
end
end
shared_examples 'the page was not found' do |expected_string: 'Sorry, page not found'|
it 'responds with 404 with the correct message and a link to /', :aggregate_failures do
expect(subject.status_code).to eq(404)
expect(subject).to have_link href: '/'
expect(subject).to have_text expected_string
end
end
shared_examples 'the page redirects' do |to: nil|
if to
let(:redirect_to) { to }
redirects = "redirects to #{to}"
else
redirects = 'redirects to the correct page'
end
it redirects, :aggregate_failures do
raise 'no redirect URL supplied' unless respond_to?(:redirect_to)
expect(subject.current_url).to match_url(redirect_to)
end
end
shared_examples 'the page permits access' do
it 'responds with 200' do
expect(subject.status_code).to eq(200)
end
end