Sha256: 170aec786c6e97f06009d3c06ec94c66be0ba746c2cd08f3f71658abd1040b40

Contents?: true

Size: 1.1 KB

Versions: 2

Compression:

Stored size: 1.1 KB

Contents

require "spec_helper"

describe Qsagi::Message do
  describe "delivery_tag" do
    it "returns the delivery_tag" do
      data = {
        :delivery_details => {:delivery_tag => "tag"},
        :payload => "raw_payload"
      }
      Qsagi::Message.new(data, :parsed_payload).delivery_tag.should == "tag"
    end

    it "gracefully handles no delivery details" do
      Qsagi::Message.new({}, :parsed_payload).delivery_tag.should be_nil
    end
  end

  describe "exchange" do
    it "returns the exchange" do
      data = {
        :delivery_details => {:exchange => "the_exchange"},
        :payload => "raw_payload"
      }
      Qsagi::Message.new(data, :parsed_payload).exchange.should == "the_exchange"
    end

    it "gracefully handles no delivery details" do
      Qsagi::Message.new({}, :parsed_payload).exchange.should be_nil
    end
  end

  describe "payload" do
    it "returns the parsed payload" do
      data = {
        :delivery_details => {:delivery_tag => "tag"},
        :payload => "raw_payload"
      }
      Qsagi::Message.new(data, :parsed_payload).payload.should == :parsed_payload
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
qsagi-0.0.3 spec/qsagi/message_spec.rb
qsagi-0.0.2 spec/qsagi/message_spec.rb