Module: TestProf::FactoryAllStub
- Defined in:
- lib/test_prof/factory_all_stub.rb,
lib/test_prof/factory_all_stub/factory_bot_patch.rb
Overview
FactoryAllStub inject into FactoryBot to make all strategies be ‘build_stubbed` strategy.
Defined Under Namespace
Modules: FactoryBotPatch
Constant Summary collapse
- LOCAL_NAME =
:__factory_bot_stub_all__
Class Method Summary collapse
Class Method Details
.disable! ⇒ Object
27 28 29 |
# File 'lib/test_prof/factory_all_stub.rb', line 27 def disable! Thread.current[LOCAL_NAME] = false end |
.enable! ⇒ Object
23 24 25 |
# File 'lib/test_prof/factory_all_stub.rb', line 23 def enable! Thread.current[LOCAL_NAME] = true end |
.enabled? ⇒ Boolean
19 20 21 |
# File 'lib/test_prof/factory_all_stub.rb', line 19 def enabled? Thread.current[LOCAL_NAME] == true end |
.init ⇒ Object
13 14 15 16 17 |
# File 'lib/test_prof/factory_all_stub.rb', line 13 def init # Monkey-patch FactoryBot / FactoryGirl TestProf::FactoryBot::FactoryRunner.prepend(FactoryBotPatch) if defined?(TestProf::FactoryBot) end |