2020-08-25 08:04:30 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2021-04-20 20:11:06 -04:00
|
|
|
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
|
|
|
|
|
2020-08-25 08:04:30 -04:00
|
|
|
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
|