Sha256: 731231738b1b3ef9c7b61be9cdb77a01baf837db8a97595e53098b24c2fdbe10

Contents?: true

Size: 839 Bytes

Versions: 20

Compression:

Stored size: 839 Bytes

Contents

describe Pheme::MessageType::SnsMessage do
  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 do
    test_class = Class.new(ExampleQueuePoller) do
      include Pheme::MessageType::SnsMessage
    end

    stub_const('SnsMessage::Fixture', test_class)

    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 'parses the message correctly' do
        expect(subject.parse_body(message).test).to eq("test")
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
pheme-4.1.1 spec/message_type/sns_message_spec.rb
pheme-4.1.0 spec/message_type/sns_message_spec.rb
pheme-4.0.15 spec/message_type/sns_message_spec.rb
pheme-4.0.14 spec/message_type/sns_message_spec.rb
pheme-4.0.13 spec/message_type/sns_message_spec.rb
pheme-4.0.12 spec/message_type/sns_message_spec.rb
pheme-4.0.11 spec/message_type/sns_message_spec.rb
pheme-4.0.10 spec/message_type/sns_message_spec.rb
pheme-4.0.9 spec/message_type/sns_message_spec.rb
pheme-4.0.8 spec/message_type/sns_message_spec.rb
pheme-4.0.7 spec/message_type/sns_message_spec.rb
pheme-4.0.6 spec/message_type/sns_message_spec.rb
pheme-4.0.5 spec/message_type/sns_message_spec.rb
pheme-4.0.3 spec/message_type/sns_message_spec.rb
pheme-4.0.2 spec/message_type/sns_message_spec.rb
pheme-4.0.1 spec/message_type/sns_message_spec.rb
pheme-4.0.0 spec/message_type/sns_message_spec.rb
pheme-3.4.0 spec/message_type/sns_message_spec.rb
pheme-3.3.3 spec/message_type/sns_message_spec.rb
pheme-3.3.2 spec/message_type/sns_message_spec.rb