Sha256: 8d5895f0c02abdc4db4a75c8ed7966ebd724c18669bf332b30e57594a57f1716

Contents?: true

Size: 1.23 KB

Versions: 19

Compression:

Stored size: 1.23 KB

Contents

require 'spec_helper.rb'

describe Pwwka::SendMessageAsyncSidekiqJob 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.new.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.new.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

19 entries across 19 versions & 1 rubygems

Version Path
pwwka-1.0.0 spec/unit/send_message_async_sidekiq_job_spec.rb
pwwka-1.0.0.RC1 spec/unit/send_message_async_sidekiq_job_spec.rb
pwwka-0.24.0 spec/unit/send_message_async_sidekiq_job_spec.rb
pwwka-0.23.0 spec/unit/send_message_async_sidekiq_job_spec.rb
pwwka-0.22.7 spec/unit/send_message_async_sidekiq_job_spec.rb
pwwka-0.22.7.RC spec/unit/send_message_async_sidekiq_job_spec.rb
pwwka-0.23.0.RC2 spec/unit/send_message_async_sidekiq_job_spec.rb
pwwka-0.22.6 spec/unit/send_message_async_sidekiq_job_spec.rb
pwwka-0.23.RC1 spec/unit/send_message_async_sidekiq_job_spec.rb
pwwka-0.22.5 spec/unit/send_message_async_sidekiq_job_spec.rb
pwwka-0.22.4 spec/unit/send_message_async_sidekiq_job_spec.rb
pwwka-0.22.3 spec/unit/send_message_async_sidekiq_job_spec.rb
pwwka-0.22.2 spec/unit/send_message_async_sidekiq_job_spec.rb
pwwka-0.21.3 spec/unit/send_message_async_sidekiq_job_spec.rb
pwwka-0.22.2.RC4 spec/unit/send_message_async_sidekiq_job_spec.rb
pwwka-0.22.2.RC3 spec/unit/send_message_async_sidekiq_job_spec.rb
pwwka-0.22.2.RC2 spec/unit/send_message_async_sidekiq_job_spec.rb
pwwka-0.22.0.RC2 spec/unit/send_message_async_sidekiq_job_spec.rb
pwwka-0.22.0.RC spec/unit/send_message_async_sidekiq_job_spec.rb