Sha256: b359d0d39cbfb7ba290179ee56f5418f6328ea148030f6c7f5c547a96073e37f

Contents?: true

Size: 1.56 KB

Versions: 13

Compression:

Stored size: 1.56 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::UserInstitutionsStatuses.new(client).update }

      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

13 entries across 13 versions & 1 rubygems

Version Path
finapps-2.1.4 spec/rest/user_institutions_statuses_spec.rb
finapps-2.1.3 spec/rest/user_institutions_statuses_spec.rb
finapps-2.1.2 spec/rest/user_institutions_statuses_spec.rb
finapps-2.1.1 spec/rest/user_institutions_statuses_spec.rb
finapps-2.0.30 spec/rest/user_institutions_statuses_spec.rb
finapps-2.0.29 spec/rest/user_institutions_statuses_spec.rb
finapps-2.0.28 spec/rest/user_institutions_statuses_spec.rb
finapps-2.0.27 spec/rest/user_institutions_statuses_spec.rb
finapps-2.0.26 spec/rest/user_institutions_statuses_spec.rb
finapps-2.0.25 spec/rest/user_institutions_statuses_spec.rb
finapps-2.0.24 spec/rest/user_institutions_statuses_spec.rb
finapps-2.0.23 spec/rest/user_institutions_statuses_spec.rb
finapps-2.0.22 spec/rest/user_institutions_statuses_spec.rb