spec/lib/queuel/sqs/queue_spec.rb in queuel-0.3.1 vs spec/lib/queuel/sqs/queue_spec.rb in queuel-0.4.0

- old
+ new

@@ -1,11 +1,31 @@ require 'spec_helper' module Queuel - module IronMq + module SQS describe Queue do - let(:queue_object_with_message) { double "QueueObject", get: message, peek: [message] } - let(:queue_object_with_nil_message) { double "QueueObject", get: nil, peek: nil } + let(:message) { double "Message", body: "uhuh" } + let(:client) { double "ClientObject" } + let(:name) { "venues queue" } + let(:credentials) {{ access_key: "none", secret_access_key: "none" }} + let(:queue_object_with_message) { double "QueueObject", get: message, receive_message: message } + let(:queue_object_with_nil_message) { double "QueueObject", get: nil, receive_message: nil } + subject do + described_class.new client, name, credentials + end + + before do + message.stub_chain :as_sns_message, body: "uhuh" + client.stub_chain :queues, named: queue_object_with_message + end + it_should_behave_like "a queue" + + describe "size" do + it "should check the queue_connection's approximate_number_of_messages for size" do + queue_object_with_message.should_receive :approximate_number_of_messages + subject.size + end + end end end end