Sha256: 93df0196163d33a78e1314febad517fae76762d212402c1487776b0d045562ef

Contents?: true

Size: 863 Bytes

Versions: 1

Compression:

Stored size: 863 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe 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.2.1 spec/lib/imis/api_spec.rb