Sha256: fc65e6d0ab1e0eedfe60fda6e3bbb343ddf73763f874f53d1beb78aa86255888

Contents?: true

Size: 974 Bytes

Versions: 8

Compression:

Stored size: 974 Bytes

Contents

require 'fake_sqs/responder'
require 'active_support/core_ext/hash'
require 'verbose_hash_fetch'

RSpec.describe FakeSQS::Responder do

  it "yields xml" do
    xml = subject.call :GetQueueUrl do |x|
      x.QueueUrl "example.com"
    end

    data = Hash.from_xml(xml)
    url = data.
      fetch("GetQueueUrlResponse").
      fetch("GetQueueUrlResult").
      fetch("QueueUrl")
    expect(url).to eq "example.com"
  end

  it "skips result if no block is given" do
    xml = subject.call :DeleteQueue

    data = Hash.from_xml(xml)

    response = data.fetch("DeleteQueueResponse")
    expect(response).to have_key("ResponseMetadata")
    expect(response).not_to have_key("DeleteQueueResult")
  end

  it "has metadata" do
    xml = subject.call :GetQueueUrl do |x|
    end

    data = Hash.from_xml(xml)

    request_id = data.
      fetch("GetQueueUrlResponse").
      fetch("ResponseMetadata").
      fetch("RequestId")

    expect(request_id.size).to eq 36
  end

end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
fake_servicebus-0.0.2 spec/unit/responder_spec.rb
fake_sqs-0.4.3 spec/unit/responder_spec.rb
fake_sqs-0.4.2 spec/unit/responder_spec.rb
fake_sqs-0.4.1 spec/unit/responder_spec.rb
fake_sqs-0.4.0 spec/unit/responder_spec.rb
fake_sqs-0.3.1 spec/unit/responder_spec.rb
fake_sqs-0.3.0 spec/unit/responder_spec.rb
fake_sqs-0.2.0 spec/unit/responder_spec.rb