module GovukMessageQueueConsumer
  class MockMessage < Message
    attr_reader :acked, :retried, :discarded

    alias :acked? :acked
    alias :discarded? :discarded
    alias :retried? :retried

    def initialize(payload = {}, headers = {}, delivery_info = {})
      @payload = payload
      @headers = OpenStruct.new(headers)
      @delivery_info = OpenStruct.new(delivery_info)
    end

    def ack
      @acked = true
    end

    def retry
      @retried = true
    end

    def discard
      @discarded = true
    end
  end
end

module GovukMessageQueueConsumer
  class MockMessage < Message
    attr_reader :acked, :retried, :discarded, :payload, :header, :delivery_info

    alias :acked? :acked
    alias :discarded? :discarded
    alias :retried? :retried

    def initialize(payload = {}, headers = {}, delivery_info = {})
      @payload = payload
      @headers = OpenStruct.new(headers)
      @delivery_info = OpenStruct.new(delivery_info)
    end

    def ack
      @acked = true
    end

    def retry
      @retried = true
    end

    def discard
      @discarded = true
    end
  end
end

Add attribute readers to mock message
Add attribute readers to mock message

This adds public access for payload, delivery_info and headers on
mock message instances. This is helpful for tests using the mock
message class and have expectations based on these attributes.
