Sha256: f8c50f2b18f413dd2062cd76c47ea5b239e5edc7a740ce8b79550954597f35e5

Contents?: true

Size: 869 Bytes

Versions: 1

Compression:

Stored size: 869 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Usps::Imis::Api do
  let(:api) { described_class.new }

  describe '#imis_id_for' do
    it 'gets the iMIS ID' do
      expect(api.imis_id_for('E231625')).to eq('31092')
    end
  end

  describe '#put' do
    before { api.imis_id = 31092 }

    it 'sends an update' do
      expect(api.put_fields('ABC_ASC_Individual_Demog', { 'TotMMS' => 15 })).to be_a(Hash)
    end
  end

  describe '#with' do
    it 'sends an update from put' do
      expect(
        api.with(31092) { put_fields('ABC_ASC_Individual_Demog', { 'TotMMS' => 15 }) }
      ).to be_a(Hash)
    end

    it 'sends an update from update' do
      expect(api.with(31092) { update(mm: 15) }.first).to be_a(Hash)
    end

    it 'uses a panel correctly' do
      expect(api.with(6374) { panels.vsc.get(1433) }).to be_a(Hash)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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