Sha256: a4876223bed5ab1071edf052acff2fde09cede612b609ed1b98e2c2678223ec6

Contents?: true

Size: 1.74 KB

Versions: 8

Compression:

Stored size: 1.74 KB

Contents

# frozen_string_literal: true
require 'spec_helpers/client'
RSpec.describe FinApps::REST::Institutions do
  include SpecHelpers::Client
  subject(:institutions) { FinApps::REST::Institutions.new(client) }

  describe '#list' do
    context 'when search_term is missing' do
      let(:list) { subject.list(nil) }
      it { expect { list }.to raise_error(FinAppsCore::MissingArgumentsError) }
    end

    context 'when proper search_term is provided' do
      let(:list) { subject.list(:search_term) }

      it { expect { list }.not_to raise_error }
      it('returns an array') { expect(list).to be_a(Array) }
      it('performs a get and returns institution array') { expect(list[0]).to be_a(Array) }
      it('returns no error messages') { expect(list[1]).to be_empty }
    end
  end

  describe '#show' do
    context 'when routing_number is missing' do
      it { expect { subject.show(nil) }.to raise_error(FinAppsCore::MissingArgumentsError) }
    end

    context 'when proper routing_number is provided' do
      # An ABA routing transit number (ABA RTN) is a nine digit code
      let(:show) { subject.show('999999999') }

      it { expect { show }.not_to raise_error }
      it('returns no error messages') { expect(show[ERROR_MESSAGES]).to be_empty }
      it('returns a hash on the results') { expect(show[RESULTS]).to be_a(Hash) }
      it('includes a base_url on the results') { expect(show[RESULTS]).to respond_to(:base_url) }
      it('includes a display_name on the results') { expect(show[RESULTS]).to respond_to(:display_name) }
      it('includes a site_id on the results') { expect(show[RESULTS]).to respond_to(:site_id) }
      it('includes a org_display_name on the results') { expect(show[RESULTS]).to respond_to(:org_display_name) }
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
finapps-2.2.18 spec/rest/institutions_spec.rb
finapps-2.2.17 spec/rest/institutions_spec.rb
finapps-2.2.16 spec/rest/institutions_spec.rb
finapps-2.2.15 spec/rest/institutions_spec.rb
finapps-2.2.14 spec/rest/institutions_spec.rb
finapps-2.2.13 spec/rest/institutions_spec.rb
finapps-2.2.12 spec/rest/institutions_spec.rb
finapps-2.2.11 spec/rest/institutions_spec.rb