spec/rest/user_institutions_spec.rb in finapps-2.2.4 vs spec/rest/user_institutions_spec.rb in finapps-2.2.5
- old
+ new
@@ -1,9 +1,14 @@
# frozen_string_literal: true
+require 'spec_helpers/client'
+
RSpec.describe FinApps::REST::UserInstitutions do
include SpecHelpers::Client
+ RESULT = 0
+ ERROR_MESSAGES = 1
+
describe '#list' do
context 'when successful' do
subject { FinApps::REST::UserInstitutions.new(client).list }
it('returns an array') { expect(subject).to be_a(Array) }
@@ -27,12 +32,12 @@
context 'when valid site_id and params are provided' do
let(:create) { subject.create('valid_site_id', :params) }
it { expect { create }.not_to raise_error }
- it('performs a post and returns the response') { expect(create[0]).to respond_to(:user_institution) }
- it('returns no error messages') { expect(create[1]).to be_empty }
+ it('performs a post and returns the response') { expect(create[RESULT]).to respond_to(:consumer_institution) }
+ it('returns no error messages') { expect(create[ERROR_MESSAGES]).to be_empty }
end
# No tests for invalid site_id/params because of API/Yodlee flow
end
@@ -73,12 +78,12 @@
context 'when valid id and params are provided' do
subject { FinApps::REST::UserInstitutions.new(client).mfa_update('valid_id', :params) }
it { expect { subject }.not_to raise_error }
- it('performs a post and returns the response') { expect(subject[0]).to respond_to(:user_institution) }
- it('returns no error messages') { expect(subject[1]).to be_empty }
+ it('performs a post and returns the response') { expect(subject[RESULT]).to respond_to(:consumer_institution) }
+ it('returns no error messages') { expect(subject[ERROR_MESSAGES]).to be_empty }
end
context 'when invalid id is provided w/ params' do
subject { FinApps::REST::UserInstitutions.new(client).mfa_update('invalid_id', :params) }
@@ -101,11 +106,11 @@
context 'when valid id and params are provided' do
subject { FinApps::REST::UserInstitutions.new(client).credentials_update('valid_id', :params) }
it { expect { subject }.not_to raise_error }
- it('performs a post and returns the response') { expect(subject[0]).to respond_to(:user_institution) }
- it('returns no error messages') { expect(subject[1]).to be_empty }
+ it('performs a post and returns the response') { expect(subject[RESULT]).to respond_to(:consumer_institution) }
+ it('returns no error messages') { expect(subject[ERROR_MESSAGES]).to be_empty }
end
context 'when invalid id is provided w/ params' do
subject { FinApps::REST::UserInstitutions.new(client).credentials_update('invalid_id', :params) }