Repository URL to install this package:
|
Version:
7.3.3 ▾
|
# frozen_string_literal: true
shared_examples 'the endpoint requires login' do
it 'responds with 401' do
expect(subject.status).to eq(401)
end
end
shared_examples 'the endpoint denies access' do
it { is_expected.to be_forbidden }
end
shared_examples 'the endpoint was not found' do
it { is_expected.to be_not_found }
end
shared_examples 'the endpoint redirects' do |to: nil|
if to
let(:redirect_to) { to }
redirects = "redirects to #{to}"
else
redirects = 'redirects'
end
it redirects, :aggregate_failures do
expect(subject).to be_redirect
next unless respond_to? :redirect_to
expect(subject.location).to match_url(redirect_to)
end
end
shared_examples 'the endpoint permits access' do
it { is_expected.to be_ok }
end