diff options
author | Igor <idrozdov@gitlab.com> | 2019-07-04 12:13:50 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2019-07-04 12:13:50 +0300 |
commit | ae7041d4dae5650172858ec86bcb6ca92ec4512a (patch) | |
tree | 2065d0ad82f77585295a1749dcfe49f977ea14b8 /spec/lib/gitlab | |
parent | 97b2a3cc7c3fab546c60229c9d058fa1472724ac (diff) |
Backports for EE's "Allow adding groups to CODEOWNERS file"
Some general code has been added/removed in EE version
which needs to be backported in CE
Diffstat (limited to 'spec/lib/gitlab')
-rw-r--r-- | spec/lib/gitlab/user_extractor_spec.rb | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/spec/lib/gitlab/user_extractor_spec.rb b/spec/lib/gitlab/user_extractor_spec.rb deleted file mode 100644 index b86ec5445b8..00000000000 --- a/spec/lib/gitlab/user_extractor_spec.rb +++ /dev/null @@ -1,78 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -describe Gitlab::UserExtractor do - let(:text) do - <<~TXT - This is a long texth that mentions some users. - @user-1, @user-2 and user@gitlab.org take a walk in the park. - There they meet @user-4 that was out with other-user@gitlab.org. - @user-1 thought it was late, so went home straight away - TXT - end - subject(:extractor) { described_class.new(text) } - - describe '#users' do - it 'returns an empty relation when nil was passed' do - extractor = described_class.new(nil) - - expect(extractor.users).to be_empty - expect(extractor.users).to be_a(ActiveRecord::Relation) - end - - it 'returns the user case insensitive for usernames' do - user = create(:user, username: "USER-4") - - expect(extractor.users).to include(user) - end - - it 'returns users by primary email' do - user = create(:user, email: 'user@gitlab.org') - - expect(extractor.users).to include(user) - end - - it 'returns users by secondary email' do - user = create(:email, email: 'other-user@gitlab.org').user - - expect(extractor.users).to include(user) - end - - context 'input as array of strings' do - it 'is treated as one string' do - extractor = described_class.new(text.lines) - - user_1 = create(:user, username: "USER-1") - user_4 = create(:user, username: "USER-4") - user_email = create(:user, email: 'user@gitlab.org') - - expect(extractor.users).to contain_exactly(user_1, user_4, user_email) - end - end - end - - describe '#matches' do - it 'includes all mentioned email adresses' do - expect(extractor.matches[:emails]).to contain_exactly('user@gitlab.org', 'other-user@gitlab.org') - end - - it 'includes all mentioned usernames' do - expect(extractor.matches[:usernames]).to contain_exactly('user-1', 'user-2', 'user-4') - end - - context 'input has no matching e-mail or usernames' do - it 'returns an empty list of users' do - extractor = described_class.new('My test') - - expect(extractor.users).to be_empty - end - end - end - - describe '#references' do - it 'includes all user-references once' do - expect(extractor.references).to contain_exactly('user-1', 'user-2', 'user@gitlab.org', 'user-4', 'other-user@gitlab.org') - end - end -end |