spec/unit/queue_spec.rb in fake_sqs-0.0.8 vs spec/unit/queue_spec.rb in fake_sqs-0.0.9
- old
+ new
@@ -52,11 +52,11 @@
half_sample_group = sample_group / 2
ten_percent = half_sample_group / 0.1
sample_group.times do
sent_first = send_message
- sent_second = send_message
+ _ = send_message
message = receive_message.values.first
if message == sent_first
indexes[:first] += 1
else
indexes[:second] += 1
@@ -86,14 +86,22 @@
reset_queue
end
end
it "keeps track of sent messages" do
+
send_message
+
queue.should have(0).messages_in_flight
+ queue.attributes["ApproximateNumberOfMessagesNotVisible"].should eq 0
+ queue.attributes["ApproximateNumberOfMessages"].should eq 1
+
receive_message
+
queue.should have(1).messages_in_flight
+ queue.attributes["ApproximateNumberOfMessagesNotVisible"].should eq 1
+ queue.attributes["ApproximateNumberOfMessages"].should eq 0
end
it "gets multiple message" do
sent_first = send_message
sent_second = send_message
@@ -115,20 +123,34 @@
end
describe "#delete_message" do
it "deletes by the receipt" do
- message = send_message
+ send_message
receipt = receive_message.keys.first
queue.should have(1).messages_in_flight
queue.delete_message(receipt)
queue.should have(0).messages_in_flight
queue.should have(0).messages
end
it "won't raise if the receipt is unknown" do
queue.delete_message("abc")
+ end
+
+ end
+
+ describe "#add_queue_attributes" do
+
+ it "adds to it's queue attributes" do
+ queue.add_queue_attributes("foo" => "bar")
+ queue.attributes.should eq(
+ "foo" => "bar",
+ "QueueArn" => queue.arn,
+ "ApproximateNumberOfMessages" => 0,
+ "ApproximateNumberOfMessagesNotVisible" => 0
+ )
end
end
def send_message(options = {})