Sha256: e91a89033dd15b682dfdd0ae32063a184630051d3707c1652efc52f6be9ca630

Contents?: true

Size: 1.55 KB

Versions: 1

Compression:

Stored size: 1.55 KB

Contents

# frozen_string_literal: true
RSpec.describe FinApps::REST::UserInstitutionsStatuses do
  let(:client) { FinApps::REST::Client.new(:company_identifier, :company_token) }
  describe '#show' do
    context 'when missing id' do
      subject { FinApps::REST::UserInstitutionsStatuses.new(client).show(nil) }
      it { expect { subject }.to raise_error(FinApps::MissingArgumentsError) }
    end

    context 'when valid id is provided' do
      subject { FinApps::REST::UserInstitutionsStatuses.new(client).show('valid_id') }

      it { expect { subject }.not_to raise_error }
      it('returns an array') { expect(subject).to be_a(Array) }
      it('performs a get and returns the response') { expect(subject[0]).to respond_to(:_id) }
      it('returns no error messages') { expect(subject[1]).to be_empty }
    end

    context 'when invalid id is provided' do
      subject { FinApps::REST::UserInstitutionsStatuses.new(client).show('invalid_id') }

      it { expect { subject }.not_to raise_error }
      it('results is nil') { expect(subject[0]).to be_nil }
      it('error messages array is populated') { expect(subject[1].first.downcase).to eq('invalid user institution id') }
    end
  end

  describe '#update' do
    context 'when successful' do
      subject { FinApps::REST::UserInstitutions.new(client).list }

      it('returns an array') { expect(subject).to be_a(Array) }
      it('performs a get and returns array of user institutions statuses') { expect(subject[0]).to be_a(Array) }
      it('returns no error messages') { expect(subject[1]).to be_empty }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
finapps-2.0.21 spec/rest/user_institutions_statuses_spec.rb