spec/qsagi/queue_spec.rb in qsagi-0.2.2 vs spec/qsagi/queue_spec.rb in qsagi-0.2.3

- old
+ new

@@ -3,11 +3,11 @@ describe Qsagi::Queue do it "and push and pop from a queue" do ExampleQueue.connect do |queue| queue.push("message") result = queue.pop - result.payload.should == "message" + expect(result.payload).to eq("message") end end describe "self.exchange" do it "configures the exchange" do @@ -20,38 +20,38 @@ queue_on_exchange1.connect do |queue| queue.push "message1" end queue_on_exchange1.connect do |queue| message = queue.pop - message.payload.should == "message1" - message.exchange.should == "exchange1" + expect(message.payload).to eq("message1") + expect(message.exchange).to eq("exchange1") end queue_on_exchange2.connect do |queue| - queue.pop.should be_nil + expect(queue.pop).to be_nil end end end describe "clear" do it "clears the queue" do ExampleQueue.connect do |queue| queue.push("message") queue.clear - queue.pop.should == nil + expect(queue.pop).to be_nil end end end describe "length" do it "returns the number of messages in the queue" do ExampleQueue.connect do |queue| queue.push("message") - queue.length.should == 1 + expect(queue.length).to eq(1) queue.push("message") - queue.length.should == 2 + expect(queue.length).to eq(2) queue.pop - queue.length.should == 1 + expect(queue.length).to eq(1) end end end describe "reject" do @@ -60,62 +60,62 @@ queue.push("message") message = queue.pop(:auto_ack => false) queue.reject(message, :requeue => true) end ExampleQueue.connect do |queue| - queue.length.should == 1 + expect(queue.length).to eq(1) end end it "rejects and discards the message" do ExampleQueue.connect do |queue| queue.push("message") message = queue.pop(:auto_ack => false) queue.reject(message, :requeue => false) end ExampleQueue.connect do |queue| - queue.length.should == 0 + expect(queue.length).to eq(0) end end end describe "pop" do it "automatically acks if :auto_ack is not passed in" do ExampleQueue.connect do |queue| queue.push("message") message = queue.pop - message.payload.should == "message" + expect(message.payload).to eq("message") end ExampleQueue.connect do |queue| message = queue.pop - message.should == nil + expect(message).to be_nil end end it "will not automatically ack if :auto_ack is set to false" do ExampleQueue.connect do |queue| queue.push("message") message = queue.pop(:auto_ack => false) - message.payload.should == "message" + expect(message.payload).to eq("message") end ExampleQueue.connect do |queue| message = queue.pop(:auto_ack => false) - message.payload.should == "message" + expect(message.payload).to eq("message") queue.ack(message) end ExampleQueue.connect do |queue| message = queue.pop(:auto_ack => false) - message.should == nil + expect(message).to be_nil end end end describe "queue_type confirmed" do it "should use a ConfirmedQueue" do ExampleQueue.connect(:queue_type => :confirmed) do |queue| queue.push("message") queue.wait_for_confirms - queue.nacked_messages.size.should == 0 + expect(queue.nacked_messages.size).to eq(0) end end end end