Module: Capybara::AsyncRunner::Commands::Responders::ClassMethods

Defined in:
lib/capybara/async_runner/commands/responders.rb

Constant Summary collapse

BLANK_PROXY =
proc { |value| value }

Instance Method Summary collapse

Instance Method Details

#respondersObject



38
39
40
# File 'lib/capybara/async_runner/commands/responders.rb', line 38

def responders
  store[:responders] ||= {}
end

#response(method_name, options = {}) { ... } ⇒ Object

Defines a responder for script

raw_data will be returned if no block provided

Parameters:

  • method_name (String, Symbols)
  • options (Hash) (defaults to: {})

Options Hash (options):

  • :as (Symbol)

    can be :callback

Yields:

  • raw_data from script



53
54
55
56
57
58
59
# File 'lib/capybara/async_runner/commands/responders.rb', line 53

def response(method_name, options = {}, &block)
  mapping = {
    options: options,
    processor: block || BLANK_PROXY
  }
  responders[method_name] = mapping
end