spec/exchange_spec.rb in bunny-0.4.3 vs spec/exchange_spec.rb in bunny-0.4.4
- old
+ new
@@ -6,11 +6,11 @@
# If this is not the case, please change the 'Bunny.new' call below to include
# the relevant arguments e.g. @b = Bunny.new(:user => 'john', :pass => 'doe', :host => 'foobar')
require File.expand_path(File.join(File.dirname(__FILE__), %w[.. lib bunny]))
-describe Bunny::Exchange do
+describe Bunny do
before(:each) do
@b = Bunny.new
@b.start
end
@@ -48,21 +48,31 @@
exch.should be_an_instance_of Bunny::Exchange
exch.name.should == 'amq.topic'
exch.type.should == :topic
@b.exchanges.has_key?('amq.topic').should be true
end
+
- # headers exchange not implemented in RabbitMQ yet. Uncomment if target broker/server supports it
- #
- #it "should allow a default headers exchange to be instantiated without specifying :type" do
- # exch = @b.exchange('amq.match')
- # exch.should be_an_instance_of Bunny::Exchange
- # exch.name.should == 'amq.match'
- # exch.type.should == :headers
- # @b.exchanges.has_key?('amq.match').should be true
- #end
+=begin
+ #*** Uncomment these tests if your broker/server supports headers exchanges ***
+ it "should allow a default headers (amq.match) exchange to be instantiated without specifying :type" do
+ exch = @b.exchange('amq.match')
+ exch.should be_an_instance_of Bunny::Exchange
+ exch.name.should == 'amq.match'
+ exch.type.should == :headers
+ @b.exchanges.has_key?('amq.match').should be true
+ end
+ it "should allow a default headers (amq.headers) exchange to be instantiated without specifying :type" do
+ exch = @b.exchange('amq.headers')
+ exch.should be_an_instance_of Bunny::Exchange
+ exch.name.should == 'amq.headers'
+ exch.type.should == :headers
+ @b.exchanges.has_key?('amq.headers').should be true
+ end
+=end
+
it "should create an exchange as direct by default" do
exch = @b.exchange('direct_defaultex')
exch.should be_an_instance_of Bunny::Exchange
exch.name.should == 'direct_defaultex'
exch.type.should == :direct
@@ -90,9 +100,20 @@
exch.should be_an_instance_of Bunny::Exchange
exch.name.should == 'fanout_exchange'
exch.type.should == :fanout
@b.exchanges.has_key?('fanout_exchange').should be true
end
+
+=begin
+ #*** Uncomment this test if your broker/server supports headers exchanges ***
+ it "should be able to be instantiated as a headers exchange" do
+ exch = @b.exchange('headers_exchange', :type => :headers)
+ exch.should be_an_instance_of Bunny::Exchange
+ exch.name.should == 'headers_exchange'
+ exch.type.should == :headers
+ @b.exchanges.has_key?('headers_exchange').should be true
+ end
+=end
it "should ignore the :nowait option when instantiated" do
exch = @b.exchange('direct2_exchange', :nowait => true)
end
\ No newline at end of file