Sha256: c7e5ac06a49d4168454a64cf67c18f9ef1b3c986a311a8e1e635c65dbbdddde0

Contents?: true

Size: 960 Bytes

Versions: 7

Compression:

Stored size: 960 Bytes

Contents

# frozen_string_literal: true

RSpec.describe SoapyCake::Response do
  let(:xml) do
    <<-XML
      <?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
        <soap:Body>
          <SomeResponse>
            <SomeResult>
              <success>true</success>
              <row_count>2</row_count>
              <somes>
                <some>
                  <id>123</id>
                </some>
                <some>
                  <id>312</id>
                </some>
              </somes>
            </SomeResult>
          </SomeResponse>
        </soap:Body>
      </soap:Envelope>
    XML
  end

  subject(:response) { described_class.new(xml.strip, false, 0) }

  it 'returns an enumerator' do
    expect(response.to_enum).to be_a(Enumerator)
  end

  it 'parses the CAKE XML structure properly' do
    expect(response.to_enum.to_a).to eq([{ id: '123' }, { id: '312' }])
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
soapy_cake-2.3.1 spec/lib/soapy_cake/response_spec.rb
soapy_cake-2.3.0 spec/lib/soapy_cake/response_spec.rb
soapy_cake-2.2.7 spec/lib/soapy_cake/response_spec.rb
soapy_cake-2.2.6 spec/lib/soapy_cake/response_spec.rb
soapy_cake-2.2.5 spec/lib/soapy_cake/response_spec.rb
soapy_cake-2.2.4 spec/lib/soapy_cake/response_spec.rb
soapy_cake-2.2.3 spec/lib/soapy_cake/response_spec.rb