Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/concerns/ci/partitionable/switch_spec.rb')
-rw-r--r--spec/models/concerns/ci/partitionable/switch_spec.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/spec/models/concerns/ci/partitionable/switch_spec.rb b/spec/models/concerns/ci/partitionable/switch_spec.rb
index 0041a33e50e..c6e2ed265bd 100644
--- a/spec/models/concerns/ci/partitionable/switch_spec.rb
+++ b/spec/models/concerns/ci/partitionable/switch_spec.rb
@@ -31,8 +31,6 @@ RSpec.describe Ci::Partitionable::Switch, :aggregate_failures do
end
before do
- allow(ActiveSupport::DescendantsTracker).to receive(:store_inherited)
-
create_tables(<<~SQL)
CREATE TABLE _test_ci_jobs_metadata(
id serial NOT NULL PRIMARY KEY,
@@ -78,6 +76,15 @@ RSpec.describe Ci::Partitionable::Switch, :aggregate_failures do
)
end
+ # the models defined here are leaked to other tests through
+ # `ActiveRecord::Base.descendants` and we need to counter the side effects
+ # from this. We redefine the method so that we don't check the FF existence
+ # outside of the examples here.
+ # `ActiveSupport::DescendantsTracker.clear` doesn't work with cached classes.
+ after do
+ model.define_singleton_method(:routing_table_enabled?) { false }
+ end
+
it { expect(model).not_to be_routing_class }
it { expect(partitioned_model).to be_routing_class }