# 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