Sha256: fa2533fe603a3ac9f048feb7f284c878d712ee69083f76b0ec044d40a4323d48

Contents?: true

Size: 935 Bytes

Versions: 1

Compression:

Stored size: 935 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Usps::Imis::Panel::Vsc do
  let(:vsc) { described_class.new }

  let(:details) do
    {
      certificate: 'E136924',
      year: 2024,
      count: 42
    }
  end

  before { vsc.api.imis_id = 6374 }

  describe '#get' do
    it 'loads a specific object' do
      expect(vsc.get(1433)).to be_a(Hash)
    end
  end

  # rubocop:disable RSpec/ExampleLength
  it 'handles new records correctly', :aggregate_failures do
    new_record = vsc.create(details)
    expect(new_record).to be_a(Hash)

    ordinal = new_record['Properties']['$values'][1]['Value']['$value']

    update_result = vsc.update(details.merge(count: 43, ordinal: ordinal))
    updated = update_result['Properties']['$values'].find { |v| v['Name'] == 'Quantity' }
    expect(updated['Value']['$value']).to eq(43)

    expect(vsc.destroy(ordinal)).to eq('')
  end
  # rubocop:enable RSpec/ExampleLength
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
usps-imis-api-0.3.0 spec/lib/usps/imis/panel/vsc_spec.rb