Module: WebPipe::TestSupport

Defined in:
lib/web_pipe/test_support.rb

Overview

Test helper methods.

This module is meant to be included in a test file to provide helper methods.

Instance Method Summary collapse

Instance Method Details

#build_conn(uri = '', attributes: {}, env_opts: {}) ⇒ Conn

Builds a Conn

attributes struct. It overrides what is taken from the uri parameter connection struct is created. See Rack::MockRequest.env_for.

Parameters:

  • uri (String) (defaults to: '')

    URI that will be used to populate the request

  • attributes (Hash<Symbol, Any>) (defaults to: {})

    Manually set attributes for the

  • env_opts (Hash) (defaults to: {})

    Options to be added to the env from which the

Returns:



21
22
23
24
25
26
# File 'lib/web_pipe/test_support.rb', line 21

def build_conn(uri = '', attributes: {}, env_opts: {})
  env = Rack::MockRequest.env_for(uri, env_opts)
  ConnSupport::Builder
    .call(env)
    .new(attributes)
end