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
28 29 30 |
# File 'lib/test_prof/factory_all_stub.rb', line 28 def disable! Thread.current[LOCAL_NAME] = false end |
.enable! ⇒ Object
24 25 26 |
# File 'lib/test_prof/factory_all_stub.rb', line 24 def enable! Thread.current[LOCAL_NAME] = true end |
.enabled? ⇒ Boolean
20 21 22 |
# File 'lib/test_prof/factory_all_stub.rb', line 20 def enabled? Thread.current[LOCAL_NAME] == true end |
.init ⇒ Object
14 15 16 17 18 |
# File 'lib/test_prof/factory_all_stub.rb', line 14 def init # Monkey-patch FactoryBot / FactoryGirl TestProf::FactoryBot::FactoryRunner.prepend(FactoryBotPatch) if defined?(TestProf::FactoryBot) end |