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.
60 61 62 |
# File 'lib/action_cable/connection/test_case.rb', line 60 def logger @logger end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
60 61 62 |
# File 'lib/action_cable/connection/test_case.rb', line 60 def request @request end |
Instance Method Details
#build_headers(headers) ⇒ Object
77 78 79 80 81 82 83 |
# File 'lib/action_cable/connection/test_case.rb', line 77 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
62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/action_cable/connection/test_case.rb', line 62 def initialize(path, , headers) inner_logger = ActiveSupport::Logger.new(StringIO.new) tagged_logging = ActiveSupport::TaggedLogging.new(inner_logger) @logger = ActionCable::Connection::TaggedLoggerProxy.new(tagged_logging, tags: []) 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 |