Sha256: 2724f5f3be55eefde5388a4977e4e4a91c1a39ee3c6ae084ec481f47b2c9a65a

Contents?: true

Size: 1.6 KB

Versions: 11

Compression:

Stored size: 1.6 KB

Contents

# frozen_string_literal: true

require 'spec_helpers/client'

RSpec.describe FinApps::REST::ConsumerInstitutionRefresh, 'initialized with valid FinApps::Client object' do
  include SpecHelpers::Client
  let(:refresh) { FinApps::REST::ConsumerInstitutionRefresh.new client }

  describe '#update' do
    let(:valid_params) { { token: 'valid_token' } }
    let(:invalid_params) { { token: 'invalid_token' } }

    context 'when missing id' do
      it { expect { refresh.update(nil) }.to raise_error(FinAppsCore::MissingArgumentsError) }
    end

    context 'when invalid id is provided' do
      subject { refresh.update(:invalid_consumer_institution_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]).not_to be_nil }
    end

    context 'when invalid params are provided' do
      subject { refresh.update(:valid_consumer_institution_id, invalid_params) }

      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]).not_to be_nil }
    end

    context 'when valid id is provided' do
      subject { refresh.update(:valid_consumer_institution_id) }

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

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
finapps-5.0.3 spec/rest/consumer_institution_refresh_spec.rb
finapps-5.0.2 spec/rest/consumer_institution_refresh_spec.rb
finapps-5.0.1 spec/rest/consumer_institution_refresh_spec.rb
finapps-5.0.0 spec/rest/consumer_institution_refresh_spec.rb
finapps-4.0.16 spec/rest/consumer_institution_refresh_spec.rb
finapps-4.0.15 spec/rest/consumer_institution_refresh_spec.rb
finapps-4.0.14 spec/rest/consumer_institution_refresh_spec.rb
finapps-4.0.12 spec/rest/consumer_institution_refresh_spec.rb
finapps-4.0.11 spec/rest/consumer_institution_refresh_spec.rb
finapps-4.0.10 spec/rest/consumer_institution_refresh_spec.rb
finapps-4.0.9 spec/rest/consumer_institution_refresh_spec.rb