diff --git a/spec/models/hair_trigger_spec.rb b/spec/models/hair_trigger_spec.rb index 215ee156c..c1a4924a0 100644 --- a/spec/models/hair_trigger_spec.rb +++ b/spec/models/hair_trigger_spec.rb @@ -5,6 +5,12 @@ require "rails_helper" RSpec.describe HairTrigger, type: :model do describe ".migrations_current?" do it "is always true" do + # work-around empty AR::Base descendants array caused by with_model cleanup + # HairTrigger uses AR::Base to get database triggers (and compare against the schema) + if ActiveRecord::Base.descendants.blank? + ActiveSupport::DescendantsTracker.store_inherited(ActiveRecord::Base, ApplicationRecord) + end + expect(described_class.migrations_current?).to be(true) end end