Sha256: fb91f1ffc631c169bcd29eec62cb7a6db283291bf5b7688bd5c98afa8a8c4c46

Contents?: true

Size: 1.62 KB

Versions: 32

Compression:

Stored size: 1.62 KB

Contents

# frozen_string_literal: true

require 'spec_helpers/client'

RSpec.describe FinApps::REST::UserInstitutionsStatuses do
  include SpecHelpers::Client

  describe '#show' do
    context 'when missing id' do
      subject { FinApps::REST::UserInstitutionsStatuses.new(client).show(nil) }
      it { expect { subject }.to raise_error(FinAppsCore::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[RESULTS]).to respond_to(:_id) }
      it('returns no error messages') { expect(subject[ERROR_MESSAGES]).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[RESULTS]).to be_nil }
      it('error messages array is populated') do
        expect(subject[ERROR_MESSAGES].first.downcase).to eq('invalid user institution id')
      end
    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[RESULTS]).to be_a(Array) }
      it('returns no error messages') { expect(subject[ERROR_MESSAGES]).to be_empty }
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
finapps-5.0.3 spec/rest/user_institutions_statuses_spec.rb
finapps-5.0.2 spec/rest/user_institutions_statuses_spec.rb
finapps-5.0.1 spec/rest/user_institutions_statuses_spec.rb
finapps-5.0.0 spec/rest/user_institutions_statuses_spec.rb
finapps-4.0.16 spec/rest/user_institutions_statuses_spec.rb
finapps-4.0.15 spec/rest/user_institutions_statuses_spec.rb
finapps-4.0.14 spec/rest/user_institutions_statuses_spec.rb
finapps-4.0.12 spec/rest/user_institutions_statuses_spec.rb
finapps-4.0.11 spec/rest/user_institutions_statuses_spec.rb
finapps-4.0.10 spec/rest/user_institutions_statuses_spec.rb
finapps-4.0.9 spec/rest/user_institutions_statuses_spec.rb
finapps-4.0.8 spec/rest/user_institutions_statuses_spec.rb
finapps-4.0.7 spec/rest/user_institutions_statuses_spec.rb
finapps-4.0.6 spec/rest/user_institutions_statuses_spec.rb
finapps-4.0.5 spec/rest/user_institutions_statuses_spec.rb
finapps-4.0.4 spec/rest/user_institutions_statuses_spec.rb
finapps-4.0.3 spec/rest/user_institutions_statuses_spec.rb
finapps-4.0.2 spec/rest/user_institutions_statuses_spec.rb
finapps-4.0.1 spec/rest/user_institutions_statuses_spec.rb
finapps-3.0.7 spec/rest/user_institutions_statuses_spec.rb