diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /spec/lib/gitlab/uuid_spec.rb | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'spec/lib/gitlab/uuid_spec.rb')
-rw-r--r-- | spec/lib/gitlab/uuid_spec.rb | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/spec/lib/gitlab/uuid_spec.rb b/spec/lib/gitlab/uuid_spec.rb new file mode 100644 index 00000000000..a2e28f5a24d --- /dev/null +++ b/spec/lib/gitlab/uuid_spec.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Gitlab::UUID do + let_it_be(:name) { "GitLab" } + + describe '.v5' do + subject { described_class.v5(name) } + + before do + # This is necessary to clear memoization for testing different environments + described_class.instance_variable_set(:@default_namespace_id, nil) + end + + context 'in development' do + let_it_be(:development_proper_uuid) { "5b593e54-90f5-504b-8805-5394a4d14b94" } + + before do + allow(Rails).to receive(:env).and_return(:development) + end + + it { is_expected.to eq(development_proper_uuid) } + end + + context 'in test' do + let_it_be(:test_proper_uuid) { "5b593e54-90f5-504b-8805-5394a4d14b94" } + + it { is_expected.to eq(test_proper_uuid) } + end + + context 'in staging' do + let_it_be(:staging_proper_uuid) { "dd190b37-7754-5c7c-80a0-85621a5823ad" } + + before do + allow(Rails).to receive(:env).and_return(:staging) + end + + it { is_expected.to eq(staging_proper_uuid) } + end + + context 'in production' do + let_it_be(:production_proper_uuid) { "4961388b-9d8e-5da0-a499-3ef5da58daf0" } + + before do + allow(Rails).to receive(:env).and_return(:production) + end + + it { is_expected.to eq(production_proper_uuid) } + end + end +end |