Commit 932156cd authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'jj-fix-feature-used' into 'master'

This is a quick fix for Feature use [RUN ALL RSPEC]

See merge request gitlab-org/gitlab!52647
parents a2e9af71 58a071a2
...@@ -5,6 +5,12 @@ require 'spec_helper' ...@@ -5,6 +5,12 @@ require 'spec_helper'
RSpec.describe ApplicationExperiment do RSpec.describe ApplicationExperiment do
subject { described_class.new(:stub) } subject { described_class.new(:stub) }
it "naively assumes a 1x1 relationship to feature flags for tests" do
expect(Feature).to receive(:persist_used!).with('stub')
described_class.new(:stub)
end
describe "publishing results" do describe "publishing results" do
it "tracks the assignment" do it "tracks the assignment" do
expect(subject).to receive(:track).with(:assignment) expect(subject).to receive(:track).with(:assignment)
......
# frozen_string_literal: true # frozen_string_literal: true
# This is a temporary fix until we have a larger discussion around the
# challenges raised in https://gitlab.com/gitlab-org/gitlab/-/issues/300104
class ApplicationExperiment < Gitlab::Experiment # rubocop:disable Gitlab/NamespacedClass
def initialize(*args)
super
Feature.persist_used!(name)
end
end
# Disable all caching for experiments in tests. # Disable all caching for experiments in tests.
Gitlab::Experiment::Configuration.cache = nil Gitlab::Experiment::Configuration.cache = nil
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