Sha256: 3189cdcb79479a46aa48ba2b1c2335e813e6e3dca0f61e3de02a0c489ef4e50e

Contents?: true

Size: 944 Bytes

Versions: 46

Compression:

Stored size: 944 Bytes

Contents

require 'spec_helper'

describe Pwwka::TestHandler::Message do
  let(:delivery_info) { double("delivery info") }
  let(:properties) { double("properties") }
  let(:payload) { { foo: "bar" }.to_json }

  subject(:message) { described_class.new(delivery_info,properties,payload) }

  describe "attributes" do
    specify { expect(message.delivery_info).to eq(delivery_info) }
    specify { expect(message.properties).to    eq(properties) }
    specify { expect(message.payload).to       eq(JSON.parse(payload)) }
  end

  describe "splatting" do
    it "extracts pieces during a splat" do
      extracted_delivery_info,extracted_payload,extracted_properties,extracted_raw_payload = message
      expect(extracted_delivery_info).to  eq(delivery_info)
      expect(extracted_properties).to     eq(properties)
      expect(extracted_payload).to        eq(JSON.parse(payload))
      expect(extracted_raw_payload).to    eq(payload)
    end
  end

end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
pwwka-0.11.0 spec/unit/test_handler_message_spec.rb
pwwka-0.11.0.RC1 spec/unit/test_handler_message_spec.rb
pwwka-0.10.0 spec/unit/test_handler_message_spec.rb
pwwka-0.10.0.RC spec/unit/test_handler_message_spec.rb
pwwka-0.9.0 spec/unit/test_handler_message_spec.rb
pwwka-0.9.0.RC1 spec/unit/test_handler_message_spec.rb