Sha256: 2d6a1af9031a204ee35607770d1302695b46fa6e0676bbc2d9cbd676dfad9fd7

Contents?: true

Size: 816 Bytes

Versions: 15

Compression:

Stored size: 816 Bytes

Contents

describe Pheme::MessageType::SnsMessage do
  module SnsMessage
    class Fixture < ExampleQueuePoller
      include Pheme::MessageType::SnsMessage
    end
  end

  subject { SnsMessage::Fixture.new }

  let(:poller) do
    poller = double
    allow(poller).to receive(:poll).with(kind_of(Hash))
    allow(poller).to receive(:parse_message)
    allow(poller).to receive(:before_request)
    poller
  end

  before(:each) do
    use_default_configuration!
    allow(Aws::SQS::QueuePoller).to receive(:new) { poller }
  end

  describe "#parse_message" do
    context "with JSON message" do
      let!(:message) { OpenStruct.new({ body: '{"Message":"{\"test\":\"test\"}"}' }) }

      it 'should parse the message correctly' do
        expect(subject.parse_body(message).test).to eq("test")
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
pheme-3.1.3 spec/message_type/sns_message_spec.rb
pheme-3.1.2 spec/message_type/sns_message_spec.rb
pheme-3.1.1 spec/message_type/sns_message_spec.rb
pheme-3.1.0 spec/message_type/sns_message_spec.rb
pheme-3.0.1 spec/message_type/sns_message_spec.rb
pheme-3.0.0 spec/message_type/sns_message_spec.rb
pheme-1.2.2 spec/message_type/sns_message_spec.rb
pheme-1.2.1 spec/message_type/sns_message_spec.rb
pheme-1.2.0 spec/message_type/sns_message_spec.rb
pheme-1.1.1 spec/message_type/sns_message_spec.rb
pheme-1.1.0 spec/message_type/sns_message_spec.rb
pheme-1.0.0 spec/message_type/sns_message_spec.rb
pheme-0.0.11 spec/message_type/sns_message_spec.rb
pheme-0.0.10 spec/message_type/sns_message_spec.rb
pheme-0.0.9 spec/message_type/sns_message_spec.rb