spec/integration/exchange_declaration_spec.rb in amqp-0.7.5 vs spec/integration/exchange_declaration_spec.rb in amqp-0.8.0.beta1
- old
+ new
@@ -24,31 +24,26 @@
describe "#direct" do
context "when exchange name is specified" do
it 'declares a new direct exchange with that name' do
@channel.direct('name').name.should == 'name'
- @channel.direct('name').delete
-
done
end
it "declares direct exchange as transient (non-durable)" do
exchange = @channel.direct('name')
exchange.should_not be_durable
exchange.should be_transient
- exchange.delete
-
done
end
it "declares direct exchange as non-auto-deleted" do
exchange = @channel.direct('name')
exchange.should_not be_auto_deleted
- exchange.delete
done
end
end
@@ -62,13 +57,13 @@
context "when exchange name was specified as a blank string" do
it 'returns direct exchange with server-generated name' do
pending <<-EOF
- This has to be fixed in RabbitMQ first
- https://bugzilla.rabbitmq.com/show_bug.cgi?id=23509
- EOF
+ This has to be fixed in RabbitMQ first
+ https://bugzilla.rabbitmq.com/show_bug.cgi?id=23509
+ EOF
@channel.direct("") do |exchange|
exchange.name.should_not be_empty
done
end
end
@@ -83,13 +78,10 @@
original_exchange = @channel.direct(name)
exchange = @channel.direct(name, :passive => true)
exchange.should == original_exchange
- original_exchange.delete
- exchange.delete
-
done
end # it
end
context "and exchange with given name DOES NOT exist" do
@@ -110,12 +102,10 @@
it "returns a new durable direct exchange" do
exchange = @channel.direct("a_new_durable_direct_exchange", :durable => true)
exchange.should be_durable
exchange.should_not be_transient
- exchange.delete
-
done
end # it
end # context
@@ -123,60 +113,53 @@
it "returns a new NON-durable direct exchange" do
exchange = @channel.direct("a_new_non_durable_direct_exchange", :durable => false)
exchange.should_not be_durable
exchange.should be_transient
- exchange.delete
-
done
end # it
end # context
context "when exchange is declared as auto-deleted" do
it "returns a new auto-deleted direct exchange" do
exchange = @channel.direct("a new auto-deleted direct exchange", :auto_delete => true)
exchange.should be_auto_deleted
- exchange.delete
done
end # it
end # context
context "when exchange is declared as auto-deleted" do
it "returns a new auto-deleted direct exchange" do
exchange = @channel.direct("a new non-auto-deleted direct exchange", :auto_delete => false)
exchange.should_not be_auto_deleted
- exchange.delete
done
end # it
end # context
context "when exchange is declared without explicit :nowait parameter" do
it "is declared with :nowait by default" do
exchange = @channel.direct("a new non-auto-deleted direct exchange", :auto_delete => false)
exchange.should_not be_auto_deleted
- exchange.delete
done
end # it
end # context
context "when exchange is re-declared with parameters different from original declaration" do
it "raises an exception" do
- exchange = @channel.direct("previously.declared.durable.direct.exchange", :durable => true)
+ @channel.direct("previously.declared.durable.direct.exchange", :durable => true)
expect {
@channel.direct("previously.declared.durable.direct.exchange", :durable => false)
}.to raise_error(AMQP::IncompatibleOptionsError)
- exchange.delete
-
done
end # it
end # context
end # describe
@@ -189,11 +172,10 @@
it "declares a new fanout exchange with that name" do
exchange = @channel.fanout(name)
exchange.name.should == name
- exchange.delete
done
end
end # context
@@ -215,13 +197,10 @@
original_exchange = @channel.fanout(name)
exchange = @channel.fanout(name, :passive => true)
exchange.should == original_exchange
- original_exchange.delete
- exchange.delete
-
done
end # it
end
context "and exchange with given name DOES NOT exist" do
@@ -312,12 +291,10 @@
it "declares a new topic exchange with that name" do
exchange = @channel.topic(name)
exchange.name.should == name
- exchange.delete
-
done
end
end # context
context "when exchange name is omitted" do
@@ -337,12 +314,10 @@
original_exchange = @channel.topic(name)
exchange = @channel.topic(name, :passive => true)
exchange.should == original_exchange
- original_exchange.delete
- exchange.delete
done
end # it
end
@@ -364,12 +339,10 @@
it "returns a new durable topic exchange" do
exchange = @channel.topic("a_new_durable_topic_exchange", :durable => true)
exchange.should be_durable
exchange.should_not be_transient
- exchange.delete
-
done
end # it
end # context
@@ -377,12 +350,10 @@
it "returns a new NON-durable topic exchange" do
exchange = @channel.topic("a_new_non_durable_topic_exchange", :durable => false)
exchange.should_not be_durable
exchange.should be_transient
- exchange.delete
-
done
end # it
end # context
@@ -399,22 +370,20 @@
context "when exchange is declared as auto-deleted" do
it "returns a new auto-deleted topic exchange" do
exchange = @channel.topic("a new non-auto-deleted topic exchange", :auto_delete => false)
exchange.should_not be_auto_deleted
- exchange.delete
done
end # it
end # context
context "when exchange is declared without explicit :nowait parameter" do
it "is declared with :nowait by default" do
exchange = @channel.topic("a new non-auto-deleted topic exchange", :auto_delete => false)
exchange.should_not be_auto_deleted
- exchange.delete
done
end # it
end # context
@@ -424,19 +393,17 @@
end
it "raises an exception" do
channel = AMQP::Channel.new
- exchange = channel.topic("previously.declared.durable.topic.exchange", :durable => true)
+ channel.topic("previously.declared.durable.topic.exchange", :durable => true)
channel.should be_open
expect {
channel.topic("previously.declared.durable.topic.exchange", :durable => false)
}.to raise_error(AMQP::IncompatibleOptionsError)
- exchange.delete
-
done
end # it
end # context
end # describe
@@ -449,11 +416,10 @@
it "declares a new headers exchange with that name" do
exchange = @channel.headers(name)
exchange.name.should == name
- exchange.delete
done
end
end # context
@@ -478,12 +444,10 @@
original_exchange = @channel.headers(name)
exchange = @channel.headers(name, :passive => true)
exchange.should == original_exchange
- original_exchange.delete
- exchange.delete
done
end # it
end
@@ -505,12 +469,10 @@
it "returns a new durable headers exchange" do
exchange = @channel.headers("a_new_durable_headers_exchange", :durable => true)
exchange.should be_durable
exchange.should_not be_transient
- exchange.delete
-
done
end # it
end # context
@@ -518,47 +480,40 @@
it "returns a new NON-durable headers exchange" do
exchange = @channel.headers("a_new_non_durable_headers_exchange", :durable => false)
exchange.should_not be_durable
exchange.should be_transient
- exchange.delete
-
done
end # it
end # context
context "when exchange is declared as auto-deleted" do
it "returns a new auto-deleted headers exchange" do
exchange = @channel.headers("a new auto-deleted headers exchange", :auto_delete => true)
exchange.should be_auto_deleted
-
done
end # it
end # context
context "when exchange is declared as auto-deleted" do
it "returns a new auto-deleted headers exchange" do
exchange = @channel.headers("a new non-auto-deleted headers exchange", :auto_delete => false)
exchange.should_not be_auto_deleted
- exchange.delete
-
done
end # it
end # context
context "when exchange is declared without explicit :nowait parameter" do
it "is declared with :nowait by default" do
exchange = @channel.headers("a new non-auto-deleted headers exchange", :auto_delete => false)
exchange.should_not be_auto_deleted
- exchange.delete
-
done
end # it
end # context
@@ -566,16 +521,14 @@
amqp_after do
done
end
it "raises an exception" do
- exchange = @channel.headers("previously.declared.durable.topic.exchange", :durable => true)
+ @channel.headers("previously.declared.durable.topic.exchange", :durable => true)
expect {
@channel.headers("previously.declared.durable.topic.exchange", :durable => false)
}.to raise_error(AMQP::IncompatibleOptionsError)
-
- exchange.delete
done
end # it
end # context
end # describe