Commit 9e6a528b authored by Doug Stull's avatar Doug Stull

Check environment for experiment first

parent 2cf100d5
......@@ -201,7 +201,7 @@ module Gitlab
return false unless EXPERIMENTS.key?(experiment_key)
experiment = experiment(experiment_key)
experiment.enabled? && experiment.enabled_for_environment?
experiment.enabled_for_environment? && experiment.enabled?
end
def enabled_for_attribute?(experiment_key, attribute)
......
......@@ -442,6 +442,14 @@ RSpec.describe Gitlab::Experimentation, :snowplow do
let(:environment) { ::Gitlab.com? }
it { is_expected.to be_falsey }
it 'ensures the typically less expensive environment is checked before the more expensive call to database for Feature' do
expect_next_instance_of(described_class::Experiment) do |experiment|
expect(experiment).not_to receive(:enabled?)
end
subject
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment