Sha256: 3b593a5f5376c33dfe99216fa77543b5e60f549a926fc1352aeecacd680fede1

Contents?: true

Size: 979 Bytes

Versions: 2

Compression:

Stored size: 979 Bytes

Contents

require 'announce'
require 'announce/adapters/test_adapter'

module Announce
  module Testing

    def published_messages
      Announce::Adapters::TestAdapter::Topic.published_messages
    end

    def last_message
      published_messages.last
    end

    def clear_messages
      published_messages.clear
    end

    def subscriptions
      Announce::Adapters::TestAdapter::Subscriber.subscriptions
    end

    def last_subscription
      subscriptions.last
    end

    def clear_subscriptions
      subscriptions.clear
    end

    def broker_configured?
      Announce::Adapters::TestAdapter::BrokerManager.configured?
    end

    def reset_broker_config
      Announce::Adapters::TestAdapter::BrokerManager.reset
    end

    def reset_announce
      Announce.logger = Logger.new('/dev/null')
      Announce.options[:adapter] = 'test'
      Announce.options[:queue_name_prefix] = 'test'
      Announce.options[:app_name] = 'app'
      clear_messages
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
announce-0.2.3 lib/announce/testing.rb
announce-0.2.2 lib/announce/testing.rb