Sha256: 234bdcd1a52fdd9ff2c365bdee2a3c6470333556f3b60b48a6318c90330c64e4

Contents?: true

Size: 1.79 KB

Versions: 21

Compression:

Stored size: 1.79 KB

Contents

require 'spec_helper'

describe NetSuite::Actions::GetDeleted do
  before(:all) { savon.mock!  }
  after(:all) { savon.unmock! }

  describe 'Invoice' do
    before do
      savon.expects(:get_deleted).with(:message => {
        'platformMsgs:pageIndex' => 1,
        'platformMsgs:getDeletedFilter' => {
          "platformCore:type" => {
            "@operator" =>"anyOf",
            "platformCore:searchValue" => ["invoice"],
          },
          "platformCore:deletedDate" => {
            "@operator" =>"within",
            "platformCore:searchValue" => "2016-12-01T00:00:00",
            "platformCore:searchValue2" => "2016-12-02T00:00:00",
          }
        }
      }).returns(File.read('spec/support/fixtures/get_deleted/get_deleted_invoices.xml'))
    end

    it 'makes a valid request to the NetSuite API' do
      NetSuite::Actions::GetDeleted.call([NetSuite::Records::Invoice, { page: 1, criteria: [
        {
          field: 'type',
          operator: 'anyOf',
          type: 'SearchEnumMultiSelectField',
          value: ["invoice"]
        },
        {
          field: 'deletedDate',
          operator: "within",
          type: 'SearchDateField',
          value: ["2016-12-01T00:00:00","2016-12-02T00:00:00"]
        }
      ]}])
    end

    it 'returns a valid Response object' do
      response = NetSuite::Actions::GetDeleted.call([NetSuite::Records::Invoice, { page: 1, criteria: [
        {
          field: 'type',
          operator: 'anyOf',
          type: 'SearchEnumMultiSelectField',
          value: ["invoice"]
        },
        {
          field: 'deletedDate',
          operator: "within",
          type: 'SearchDateField',
          value: ["2016-12-01T00:00:00","2016-12-02T00:00:00"]
        }
      ]}])
      expect(response).to be_kind_of(NetSuite::Response)
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
netsuite-0.9.3 spec/netsuite/actions/get_deleted_spec.rb
netsuite-0.9.2 spec/netsuite/actions/get_deleted_spec.rb
netsuite-0.9.1 spec/netsuite/actions/get_deleted_spec.rb
netsuite-0.9.0 spec/netsuite/actions/get_deleted_spec.rb
netsuite-0.8.12 spec/netsuite/actions/get_deleted_spec.rb
netsuite-0.8.11 spec/netsuite/actions/get_deleted_spec.rb
netsuite-0.8.10 spec/netsuite/actions/get_deleted_spec.rb
netsuite-0.8.9 spec/netsuite/actions/get_deleted_spec.rb
netsuite-0.8.8 spec/netsuite/actions/get_deleted_spec.rb
netsuite-0.8.7 spec/netsuite/actions/get_deleted_spec.rb
netsuite-0.8.6 spec/netsuite/actions/get_deleted_spec.rb
netsuite-0.8.5 spec/netsuite/actions/get_deleted_spec.rb
netsuite-0.8.4 spec/netsuite/actions/get_deleted_spec.rb
netsuite-0.8.3 spec/netsuite/actions/get_deleted_spec.rb
netsuite-0.8.2 spec/netsuite/actions/get_deleted_spec.rb
netsuite-0.8.1 spec/netsuite/actions/get_deleted_spec.rb
netsuite-0.8.0 spec/netsuite/actions/get_deleted_spec.rb
netsuite-0.7.9 spec/netsuite/actions/get_deleted_spec.rb
netsuite-0.7.8 spec/netsuite/actions/get_deleted_spec.rb
netsuite-0.7.7 spec/netsuite/actions/get_deleted_spec.rb