Sha256: 04ea4f926fc2e572475a6ddbfaefa9d055e5cb4ed2a60d5e85fb14642179762f
Contents?: true
Size: 1.69 KB
Versions: 6
Compression:
Stored size: 1.69 KB
Contents
require 'spec_helper' module Queuel module SQS describe Queue do 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 describe "push" do before do queue_object_with_message.should_receive(:send_message) .with('foobar') end it "receives a call to build message with the credentials" do subject.should_receive(:build_push_message) .with("foobar", credentials) .and_return('foobar') subject.push "foobar" end it "merges options that are passed in" do subject.should_receive(:build_push_message) .with("foobar", {:foo => 'bar'}.merge(credentials)) .and_return('foobar') subject.push "foobar", :foo => 'bar' end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems