Module: Capybara::Lockstep::SynchronizeMacros
- Defined in:
- lib/capybara-lockstep/capybara_ext.rb
Instance Method Summary collapse
- #synchronize_after(meth) ⇒ Object
- #synchronize_before(meth, lazy:) ⇒ Object
- #unsynchronize_after(meth) ⇒ Object
Instance Method Details
#synchronize_after(meth) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/capybara-lockstep/capybara_ext.rb', line 20 def synchronize_after(meth) mod = Module.new do define_method meth do |*args, &block| super(*args, &block) ensure Lockstep.auto_synchronize end ruby2_keywords meth end prepend(mod) end |
#synchronize_before(meth, lazy:) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/capybara-lockstep/capybara_ext.rb', line 7 def synchronize_before(meth, lazy:) mod = Module.new do define_method meth do |*args, &block| Lockstep.auto_synchronize(lazy: lazy, log: "Synchronizing before ##{meth}") super(*args, &block) end ruby2_keywords meth end prepend(mod) end |
#unsynchronize_after(meth) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/capybara-lockstep/capybara_ext.rb', line 34 def unsynchronize_after(meth) mod = Module.new do define_method meth do |*args, &block| super(*args, &block) ensure Lockstep.unsynchronize end ruby2_keywords meth end prepend(mod) end |