Skip to content

Commit

Permalink
Inline helper in broken exchange example
Browse files Browse the repository at this point in the history
This allows us to read the example without 'bouncing' to the helper
definition.

Issue ruby-amqp#410
  • Loading branch information
camelpunch committed Jun 12, 2016
1 parent ce94a6a commit 1809e38
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions spec/higher_level_api/integration/connection_recovery_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -191,17 +191,28 @@

it "recovers exchange bindings" do
with_open do |c|
ch = c.create_channel
x = ch.fanout("amq.fanout")
x2 = ch.fanout("bunny.tests.recovery.fanout")
x2.bind(x)
ch = c.create_channel
source = ch.fanout("amq.fanout")
destination = ch.fanout("bunny.tests.recovery.fanout")
routing_key = ""

destination.bind(source)
close_all_connections!
sleep 0.1
expect(c).not_to be_open

wait_for_recovery
expect(ch).to be_open
ensure_exchange_binding_recovery(ch, x, x2)

ch.confirm_select
q = ch.queue("", :exclusive => true)
q.bind(destination, :routing_key => routing_key)

source.publish("msg", :routing_key => routing_key)
ch.wait_for_confirms
sleep 0.5
expect(q.message_count).to eq 1
q.delete
end
end

Expand Down Expand Up @@ -382,16 +393,4 @@ def ensure_queue_binding_recovery(ch, x, q, routing_key = "")
expect(q.message_count).to eq 1
q.purge
end

def ensure_exchange_binding_recovery(ch, source, destination, routing_key = "")
ch.confirm_select
q = ch.queue("", :exclusive => true)
q.bind(destination, :routing_key => routing_key)

source.publish("msg", :routing_key => routing_key)
ch.wait_for_confirms
sleep 0.5
expect(q.message_count).to eq 1
q.delete
end
end

0 comments on commit 1809e38

Please sign in to comment.