Sha256: df983b06ef902dff2213aeb616e433df9855abccec714ebea3c0430688b418f1

Contents?: true

Size: 1.21 KB

Versions: 42

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper.rb'

describe Pwwka::SendMessageAsyncJob do
  describe "::perform" do
    before do
      allow(Pwwka::Transmitter).to receive(:send_message!)
    end
    context "with just two arguments" do
      it "calls through to Pwwka::Transmitter, setting error handling to 'raise'" do
        described_class.perform({ "foo" => "bar"} , "some.routing.key")
        expect(Pwwka::Transmitter).to have_received(:send_message!).with(
          { "foo" => "bar" },
          "some.routing.key",
          type: nil,
          message_id: :auto_generate,
          headers: nil,
          on_error: :raise
        )
      end
    end
    context "with optional values" do
      it "passes them through to Pwwka::Transmitter" do
        described_class.perform(
          { "foo" => "bar"},
          "some.routing.key",
          "type" =>  "Customer",
          "message_id" =>  "foobar",
          "headers" =>  { "x" => "y" }
        )
        expect(Pwwka::Transmitter).to have_received(:send_message!).with(
          { "foo" => "bar" },
          "some.routing.key",
          type: "Customer",
          message_id: "foobar",
          headers: { "x" => "y" },
          on_error: :raise
        )
      end
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
pwwka-0.21.1 spec/unit/send_message_async_job_spec.rb
pwwka-0.21.0 spec/unit/send_message_async_job_spec.rb
pwwka-0.20.0 spec/unit/send_message_async_job_spec.rb
pwwka-0.19.0 spec/unit/send_message_async_job_spec.rb
pwwka-0.18.0 spec/unit/send_message_async_job_spec.rb
pwwka-0.17.0 spec/unit/send_message_async_job_spec.rb
pwwka-0.16.1 spec/unit/send_message_async_job_spec.rb
pwwka-0.16.0 spec/unit/send_message_async_job_spec.rb
pwwka-0.15.1 spec/unit/send_message_async_job_spec.rb
pwwka-0.15.0 spec/unit/send_message_async_job_spec.rb
pwwka-0.14.0 spec/unit/send_message_async_job_spec.rb
pwwka-0.13.3 spec/unit/send_message_async_job_spec.rb
pwwka-0.13.2 spec/unit/send_message_async_job_spec.rb
pwwka-0.13.1 spec/unit/send_message_async_job_spec.rb
pwwka-0.13.0 spec/unit/send_message_async_job_spec.rb
pwwka-0.13.0.RC2 spec/unit/send_message_async_job_spec.rb
pwwka-0.13.0.RC1 spec/unit/send_message_async_job_spec.rb
pwwka-0.12.0 spec/unit/send_message_async_job_spec.rb
pwwka-0.12.0.RC2 spec/unit/send_message_async_job_spec.rb
pwwka-0.12.0.RC1 spec/unit/send_message_async_job_spec.rb