Sha256: f6db02ed323fd1fc8bbe453f5d8df4ef83257c751e3d13d2305ba8ae82c24e68

Contents?: true

Size: 704 Bytes

Versions: 2

Compression:

Stored size: 704 Bytes

Contents

module RosettaQueue
  module Gateway

    class FakeAdapter

      def initialize(adapter_settings = {})
        @messages = []
        @open = true
      end

      def send_message(queue, message, headers)
        @messages << {'queue' => queue, 'message' => RosettaQueue::Filters::process_receiving(message), 'headers' => headers}
      end

      def messages_sent_to(queue)
        (queue ? @messages.select{|message| message['queue'] == queue} : @messages).map{|m| m['message']}
      end

      def queues
        @messages.map {|message| message['queue']}
      end

      def disconnect
        @open = false
      end
      
      def open?
        @open == true
      end

    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rosetta_queue-0.5.2 lib/rosetta_queue/adapters/fake.rb
rosetta_queue-0.5.0 lib/rosetta_queue/adapters/fake.rb