Sha256: adabed836202faff2e57a8eddf9e2501576c93d62a5d78096a1e6497e83e248c

Contents?: true

Size: 1.05 KB

Versions: 17

Compression:

Stored size: 1.05 KB

Contents

require "spec_helper"

describe "Sender-selected distribution" do
  let(:connection) do
    c = Bunny.new(:user => "bunny_gem", :password => "bunny_password", :vhost => "bunny_testbed")
    c.start
    c
  end

  after :each do
    connection.close if connection.open?
  end

  it "lets publishers specify additional routing keys using CC and BCC headers" do
    ch   = connection.create_channel
    x    = ch.direct("bunny.tests.ssd.exchange")
    q1   = ch.queue("", :exclusive => true).bind(x, :routing_key => "one")
    q2   = ch.queue("", :exclusive => true).bind(x, :routing_key => "two")
    q3   = ch.queue("", :exclusive => true).bind(x, :routing_key => "three")
    q4   = ch.queue("", :exclusive => true).bind(x, :routing_key => "four")

    n    = 10
    n.times do |i|
      x.publish("Message #{i}", :routing_key => "one", :headers => {"CC" => ["two", "three"]})
    end

    sleep 0.5

    expect(q1.message_count).to eq n
    expect(q2.message_count).to eq n
    expect(q3.message_count).to eq n
    expect(q4.message_count).to be_zero

    x.delete
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
bunny-2.6.3 spec/higher_level_api/integration/sender_selected_distribution_spec.rb
bunny-2.6.2 spec/higher_level_api/integration/sender_selected_distribution_spec.rb
bunny-2.6.1 spec/higher_level_api/integration/sender_selected_distribution_spec.rb
bunny-2.6.0 spec/higher_level_api/integration/sender_selected_distribution_spec.rb
bunny-2.5.1 spec/higher_level_api/integration/sender_selected_distribution_spec.rb
bunny-2.5.0 spec/higher_level_api/integration/sender_selected_distribution_spec.rb
bunny-2.4.0 spec/higher_level_api/integration/sender_selected_distribution_spec.rb
bunny-2.3.1 spec/higher_level_api/integration/sender_selected_distribution_spec.rb
bunny-2.3.0 spec/higher_level_api/integration/sender_selected_distribution_spec.rb
bunny-2.2.2 spec/higher_level_api/integration/sender_selected_distribution_spec.rb
bunny-2.2.1 spec/higher_level_api/integration/sender_selected_distribution_spec.rb
bunny-2.2.0 spec/higher_level_api/integration/sender_selected_distribution_spec.rb
bunny-2.1.0 spec/higher_level_api/integration/sender_selected_distribution_spec.rb
bunny-2.0.1 spec/higher_level_api/integration/sender_selected_distribution_spec.rb
bunny-2.0.0 spec/higher_level_api/integration/sender_selected_distribution_spec.rb
bunny-2.0.0.rc2 spec/higher_level_api/integration/sender_selected_distribution_spec.rb
bunny-2.0.0.rc1 spec/higher_level_api/integration/sender_selected_distribution_spec.rb