debian-mirror-gitlab/spec/support/shared_examples/finders/finder_with_external_authorization_enabled_shared_examples.rb

31 lines
810 B
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2020-03-13 15:44:24 +05:30
RSpec.shared_examples 'a finder with external authorization service' do
2019-07-07 11:18:12 +05:30
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