Module: FactoryBotInstruments::Tracing
- Included in:
- FactoryBot
- Defined in:
- lib/factory_bot_instruments/tracing.rb
Instance Method Summary collapse
Instance Method Details
#trace(sql: true) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/factory_bot_instruments/tracing.rb', line 66 def trace(sql: true) result = nil begin $FACTORY_BOT_INSTRUMENTS_TRACING = true $FACTORY_BOT_INSTRUMENTS_TRACING_DEPTH = 0 FactoryBotInstruments::TracingHelpers.sql_tracer(sql) do result = yield end ensure $FACTORY_BOT_INSTRUMENTS_TRACING = false $FACTORY_BOT_INSTRUMENTS_TRACING_DEPTH = 0 end result end |