2019-07-25 05:27:42 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-01-21 03:08:37 +00:00
|
|
|
RSpec.shared_examples 'a finder with external authorization service' do
|
2019-04-09 15:38:58 +00:00
|
|
|
include ExternalAuthorizationServiceHelpers
|
|
|
|
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:project) { create(:project) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
project.add_maintainer(user)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'finds the subject' do
|
|
|
|
expect(described_class.new(user).execute).to include(subject)
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'with an external authorization service' do
|
|
|
|
before do
|
|
|
|
enable_external_authorization_service_check
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not include the subject when no project was given' do
|
|
|
|
expect(described_class.new(user).execute).not_to include(subject)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'includes the subject when a project id was given' do
|
|
|
|
expect(described_class.new(user, project_params).execute).to include(subject)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|