Skip to content

Commit

Permalink
failing specs for issue ruby-amqp#115
Browse files Browse the repository at this point in the history
When publisher confirms are enabled, the after_publish callback is not
executed.
  • Loading branch information
grantr committed Jan 18, 2012
1 parent 9d0d04d commit 5bfe497
Showing 1 changed file with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,45 @@
@channel2 = AMQP::Channel.new
end

it 'should increment publisher_index confirming channel' do
exchange = channel3.fanout("amqpgem.tests.fanout0", :auto_delete => true)

channel3.confirm_select
channel3.publisher_index.should == 0

EventMachine.add_timer(0.5) do
exchange.publish("Hi")
end

done(2.0) do
channel3.publisher_index.should == 1
end
end

it 'should call after_publish callback' do
events = Array.new

channel3 = AMQP::Channel.new
exchange = channel3.fanout("amqpgem.tests.fanout0", :auto_delete => true)

channel3.confirm_select

module AfterPublishMixin
def after_publish(*args)
events << :after_publish
end
end

channel.extend(AfterPublishMixin)

EventMachine.add_timer(0.5) do
exchange.publish("Hi")
end

done(2.0) do
events.should include(:after_publish)
end
end

context "when messages are transient" do
context "and routable" do
Expand Down

0 comments on commit 5bfe497

Please sign in to comment.