Module: Magellan::Subscriber::Testing::Integration

Included in:
RSpec::Rails::RequestExampleGroup
Defined in:
lib/magellan/subscriber/testing/integration.rb

Instance Method Summary collapse

Instance Method Details

#publish(topic, body = "") ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/magellan/subscriber/testing/integration.rb', line 8

def publish(topic, body="")
  executor = Magellan::Subscriber::Executor.new
  request_message = {
    "headers" => {
      "Method" => "PUBLISH",
      "Path-Info" => topic,
    },
    "body" => Base64.strict_encode64(body),
    "body_encoding" => "base64",
  }
  executor.execute(request_message)
end