diff options
author | Robert Speicher <rspeicher@gmail.com> | 2019-03-18 18:11:21 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2019-03-18 18:11:21 +0300 |
commit | f012e93482c93c754efa9b84025cea7ad83acdc9 (patch) | |
tree | d8f11e35fb36a8b0070b724edc91919c81e7d4f2 /spec/lib | |
parent | 123841f65a5a14ff60eab329edc2dd5c110cefb0 (diff) | |
parent | 3eee0426c5bee0edd5d65291e2ea32a02b906792 (diff) |
Merge branch 'resolve-lib-gitlab-differences' into 'master'
Move EE specific code out of lib/gitlab
See merge request gitlab-org/gitlab-ce!25741
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/user_extractor_spec.rb | 12 | ||||
-rw-r--r-- | spec/lib/gitlab/utils_spec.rb | 18 |
2 files changed, 30 insertions, 0 deletions
diff --git a/spec/lib/gitlab/user_extractor_spec.rb b/spec/lib/gitlab/user_extractor_spec.rb index 6e2bb81fbda..b86ec5445b8 100644 --- a/spec/lib/gitlab/user_extractor_spec.rb +++ b/spec/lib/gitlab/user_extractor_spec.rb @@ -38,6 +38,18 @@ describe Gitlab::UserExtractor do 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 diff --git a/spec/lib/gitlab/utils_spec.rb b/spec/lib/gitlab/utils_spec.rb index 8f5029b3565..4645339f439 100644 --- a/spec/lib/gitlab/utils_spec.rb +++ b/spec/lib/gitlab/utils_spec.rb @@ -213,4 +213,22 @@ describe Gitlab::Utils do expect(subject[:variables].first[:key]).to eq('VAR1') end end + + describe '.try_megabytes_to_bytes' do + context 'when the size can be converted to megabytes' do + it 'returns the size in megabytes' do + size = described_class.try_megabytes_to_bytes(1) + + expect(size).to eq(1.megabytes) + end + end + + context 'when the size can not be converted to megabytes' do + it 'returns the input size' do + size = described_class.try_megabytes_to_bytes('foo') + + expect(size).to eq('foo') + end + end + end end |