Sha256: 050892f1e336a21cc517ddb536e4ec6eee592a1bf3d1798a325ff28a41a748a6

Contents?: true

Size: 1.41 KB

Versions: 4

Compression:

Stored size: 1.41 KB

Contents

require 'spec_helper'

describe FuelSDK::Soap do

  let(:client) { FuelSDK::Client.new }
  subject {client}

  it 'has inflector support' do
    expect('Definitions'.singularize).to eq 'Definition'
  end

  describe '#create_action_message' do
    it 'returns message' do
      expect(subject.create_action_message('Definitions', 'QueryDefinition', [{'ObjectID' => 1}], 'start'))
        .to eq(
        {
          'Action'      => 'start',
          'Definitions' => {
            'Definition' => [{
              'ObjectID'  => 1,
              '@xsi:type' => 'tns:QueryDefinition'
            }]
          }
        }
      )
    end

    it 'standardizes properties to an array' do
      expect(subject.create_action_message('Definitions', 'QueryDefinition', {'ObjectID' => 1}, 'start'))
        .to eq(
        {
          'Action'      => 'start',
          'Definitions' => {
            'Definition' => [{
              'ObjectID'  => 1,
              '@xsi:type' => 'tns:QueryDefinition'
            }]
          }
        }
      )
    end
  end

  describe '#soap_perform' do
    it 'starts a defined query' do
      subject.should_receive(:create_action_message)
        .with('Definitions', 'QueryDefinition', [{'ObjectID' => 1}], 'start')
        .and_return 'Do It'
      subject.should_receive(:soap_request).with(:perform, 'Do It')
      subject.soap_perform 'QueryDefinition', [{'ObjectID' => 1}], 'start'
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fuelsdk-0.1.11 spec/soap/perform_spec.rb
fuelsdk-0.1.9 spec/soap/perform_spec.rb
fuelsdk-0.1.8 spec/soap/perform_spec.rb
fuelsdk-0.1.7 spec/soap/perform_spec.rb