Use temporary assignment helper to silence deprecations in specs
This commit is contained in:
parent
7722017bc7
commit
ecb56565a1
|
@ -1,18 +1,9 @@
|
|||
require "active_support"
|
||||
|
||||
module SilenceDeprecation
|
||||
def silence_deprecation(example)
|
||||
cached_silenced = FactoryBot::Deprecation.silenced
|
||||
FactoryBot::Deprecation.silenced = true
|
||||
example.run
|
||||
FactoryBot::Deprecation.silenced = cached_silenced
|
||||
end
|
||||
end
|
||||
|
||||
RSpec.configure do |config|
|
||||
config.include SilenceDeprecation
|
||||
|
||||
config.around :example, silence_deprecation: true do |example|
|
||||
silence_deprecation(example)
|
||||
with_temporary_assignment(FactoryBot::Deprecation, :silenced, true) do
|
||||
example.run
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue