diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-25 06:08:49 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-25 06:08:49 +0300 |
commit | a8c82a6395ed62380b9061a26d92e41d46c2877e (patch) | |
tree | bd8ab49ac11104ad9ae953afd4c5e0036fdddaa2 /spec/lib/gitlab/git | |
parent | 0b881f91159cc97ccb7328a2e52977a60ea83fbe (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/git')
-rw-r--r-- | spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb b/spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb index 300d7bb14b6..b396e5d22c3 100644 --- a/spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb +++ b/spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb @@ -152,6 +152,43 @@ describe Gitlab::Git::RuggedImpl::UseRugged, :seed_helper do end end + describe '#rugged_enabled_through_feature_flag?' do + subject { wrapper.send(:rugged_enabled_through_feature_flag?) } + + before do + allow(Feature).to receive(:enabled?).with(:feature_key_1).and_return(true) + allow(Feature).to receive(:enabled?).with(:feature_key_2).and_return(true) + allow(Feature).to receive(:enabled?).with(:feature_key_3).and_return(false) + allow(Feature).to receive(:enabled?).with(:feature_key_4).and_return(false) + + stub_const('Gitlab::Git::RuggedImpl::Repository::FEATURE_FLAGS', feature_keys) + end + + context 'no feature keys given' do + let(:feature_keys) { [] } + + it { is_expected.to be_falsey } + end + + context 'all features are enabled' do + let(:feature_keys) { [:feature_key_1, :feature_key_2] } + + it { is_expected.to be_truthy} + end + + context 'all features are not enabled' do + let(:feature_keys) { [:feature_key_3, :feature_key_4] } + + it { is_expected.to be_falsey } + end + + context 'some feature is enabled' do + let(:feature_keys) { [:feature_key_4, :feature_key_2] } + + it { is_expected.to be_truthy } + end + end + def create_temporary_gitaly_metadata_file tmp = Tempfile.new('.gitaly-metadata') gitaly_metadata = { |