Module: ActionCable::Connection::TestConnection
- Defined in:
- lib/action_cable/connection/test_case.rb
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Instance Method Summary collapse
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
55 56 57 |
# File 'lib/action_cable/connection/test_case.rb', line 55 def logger @logger end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
55 56 57 |
# File 'lib/action_cable/connection/test_case.rb', line 55 def request @request end |
Instance Method Details
#build_headers(headers) ⇒ Object
70 71 72 73 74 75 76 |
# File 'lib/action_cable/connection/test_case.rb', line 70 def build_headers(headers) headers.each_with_object({}) do |(k, v), obj| k = k.upcase k.tr!("-", "_") obj["HTTP_#{k}"] = v end end |
#initialize(path, cookies, headers) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/action_cable/connection/test_case.rb', line 57 def initialize(path, , headers) @logger = ActiveSupport::TaggedLogging.new ActiveSupport::Logger.new(StringIO.new) uri = URI.parse(path) env = { "QUERY_STRING" => uri.query, "PATH_INFO" => uri.path }.merge(build_headers(headers)) @request = TestRequest.create(env) @request. = .with_indifferent_access end |