Sha256: cccf4c4ab43cc298e43d01ce70537ebe2563a504e43956f718483fe30a20b941

Contents?: true

Size: 1.67 KB

Versions: 1

Compression:

Stored size: 1.67 KB

Contents

require 'spec_helper'

describe NetSuite::Actions::Update do

  context 'Customer' do
    let(:customer) do
      NetSuite::Records::Customer.new(:entity_id => 'Shutter Fly', :company_name => 'Shutter Fly, Inc.')
    end

    before do
      savon.expects(:update).with({
        'platformMsgs:record' => {
          'listRel:entityId'    => 'Shutter Fly',
          'listRel:companyName' => 'Shutter Fly, Inc.'
        },
        :attributes! => {
          'platformMsgs:baseRef' => {
            'xsi:type' => 'listRel:Customer'
          }
        }
      }).returns(:update_customer)
    end

    it 'makes a valid request to the NetSuite API' do
      NetSuite::Actions::Update.call(customer)
    end

    it 'returns a valid Response object' do
      response = NetSuite::Actions::Update.call(customer)
      response.should be_kind_of(NetSuite::Response)
      response.should be_success
    end
  end

  context 'Invoice' do
    let(:invoice) do
      NetSuite::Records::Invoice.new(:source => 'Google', :total => 100.0)
    end

    before do
      pending
      savon.expects(:update).with({
        'platformMsgs:record' => {
          'listRel:source' => 'Google',
          'listRel:total'  => 100.0
        },
        :attributes! => {
          'platformMsgs:baseRef' => {
            'xsi:type' => 'listRel:Invoice'
          }
        }
      }).returns(:update_invoice)
    end

    it 'makes a valid request to the NetSuite API' do
      NetSuite::Actions::Update.call(invoice)
    end

    it 'returns a valid Response object' do
      response = NetSuite::Actions::Update.call(invoice)
      response.should be_kind_of(NetSuite::Response)
      response.should be_success
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
netsuite-0.0.16 spec/netsuite/actions/update_spec.rb