gitlab-org--gitlab-foss/spec/support/factory_default.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
490 B
Ruby
Raw Normal View History

# frozen_string_literal: true
module Gitlab
module FreezeFactoryDefault
def set_factory_default(name, obj, preserve_traits: nil)
obj.freeze unless obj.frozen?
super
end
end
end
TestProf::FactoryDefault::DefaultSyntax.prepend Gitlab::FreezeFactoryDefault
RSpec.configure do |config|
config.after do |ex|
TestProf::FactoryDefault.reset unless ex.metadata[:factory_default] == :keep
end
config.after(:all) do
TestProf::FactoryDefault.reset
end
end