class CypressRails::InitializerHooks

Public Class Methods

instance() click to toggle source
# File lib/cypress-rails/initializer_hooks.rb, line 7
def self.instance
  @instance ||= new
end
new() click to toggle source
# File lib/cypress-rails/initializer_hooks.rb, line 49
def initialize
  reset!
end

Public Instance Methods

after_server_start(&blk) click to toggle source
# File lib/cypress-rails/initializer_hooks.rb, line 15
def after_server_start(&blk)
  register(:after_server_start, blk)
end
after_state_reset(&blk) click to toggle source
# File lib/cypress-rails/initializer_hooks.rb, line 23
def after_state_reset(&blk)
  register(:after_state_reset, blk)
end
after_transaction_start(&blk) click to toggle source
# File lib/cypress-rails/initializer_hooks.rb, line 19
def after_transaction_start(&blk)
  register(:after_transaction_start, blk)
end
before_server_start(&blk) click to toggle source
# File lib/cypress-rails/initializer_hooks.rb, line 11
def before_server_start(&blk)
  register(:before_server_start, blk)
end
before_server_stop(&blk) click to toggle source
# File lib/cypress-rails/initializer_hooks.rb, line 27
def before_server_stop(&blk)
  register(:before_server_stop, blk)
end
reset!() click to toggle source
# File lib/cypress-rails/initializer_hooks.rb, line 31
def reset!
  @hooks = {}
end
run(name) click to toggle source
# File lib/cypress-rails/initializer_hooks.rb, line 35
def run(name)
  return unless @hooks[name]
  @hooks[name].each do |blk|
    blk.call
  end
end

Private Instance Methods

register(name, blk) click to toggle source
# File lib/cypress-rails/initializer_hooks.rb, line 44
def register(name, blk)
  @hooks[name] ||= []
  @hooks[name] << blk
end