Class: FactoryBot::With::Scoped
- Inherits:
-
Object
- Object
- FactoryBot::With::Scoped
- Defined in:
- lib/factory_bot/with/scoped.rb
Overview
An internal class to implement implicit context scope.
Class Method Summary collapse
Class Method Details
.with_ancestors(ancestors) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/factory_bot/with/scoped.rb', line 13 def with_ancestors(ancestors, &) tmp_ancestors = self.ancestors Thread.current[:factory_bot_with_scoped_ancestors] = [*ancestors, *tmp_ancestors || []] yield ensure Thread.current[:factory_bot_with_scoped_ancestors] = tmp_ancestors end |