Sha256: 6a06e4a30758888331b7fc9a07b3888bad343214132dfa4e28ee2f05f31151bf

Contents?: true

Size: 1.46 KB

Versions: 6

Compression:

Stored size: 1.46 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}],
            :attributes! => {
              'Definition' => { '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}],
            :attributes! => {
              'Definition' => { '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

6 entries across 6 versions & 1 rubygems

Version Path
fuelsdk-0.1.6 spec/soap/perform_spec.rb
fuelsdk-0.1.5 spec/soap/perform_spec.rb
fuelsdk-0.1.4 spec/soap/perform_spec.rb
fuelsdk-0.1.3 spec/soap/perform_spec.rb
fuelsdk-0.1.2 spec/soap/perform_spec.rb
fuelsdk-0.1.1 spec/soap/perform_spec.rb