debian-mirror-gitlab/spec/lib/feature/gitaly_spec.rb

47 lines
1.1 KiB
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2019-09-04 21:01:54 +05:30
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe Feature::Gitaly do
2019-09-04 21:01:54 +05:30
let(:feature_flag) { "mep_mep" }
describe ".enabled?" do
context 'when the gate is closed' do
before do
stub_feature_flags(gitaly_mep_mep: false)
end
it 'returns false' do
expect(described_class.enabled?(feature_flag)).to be(false)
end
end
context 'when the flag defaults to on' do
it 'returns true' do
expect(described_class.enabled?(feature_flag)).to be(true)
end
end
end
describe ".server_feature_flags" do
2020-03-13 15:44:24 +05:30
before do
2020-06-23 00:09:42 +05:30
stub_feature_flags(gitaly_mep_mep: true, foo: true)
2020-03-13 15:44:24 +05:30
end
2019-09-04 21:01:54 +05:30
2020-03-13 15:44:24 +05:30
subject { described_class.server_feature_flags }
2019-09-04 21:01:54 +05:30
2020-03-13 15:44:24 +05:30
it { is_expected.to be_a(Hash) }
it { is_expected.to eq("gitaly-feature-mep-mep" => "true") }
2020-04-08 14:13:33 +05:30
context 'when table does not exist' do
before do
allow(::Gitlab::Database).to receive(:cached_table_exists?).and_return(false)
end
it 'returns an empty Hash' do
expect(subject).to eq({})
end
end
2019-09-04 21:01:54 +05:30
end
end