spec/rest/user_institutions_spec.rb in finapps-2.0.23 vs spec/rest/user_institutions_spec.rb in finapps-2.0.24
- old
+ new
@@ -9,9 +9,33 @@
it('performs a get and returns array of user institutions') { expect(subject[0]).to be_a(Array) }
it('returns no error messages') { expect(subject[1]).to be_empty }
end
end
+ describe '#create' do
+ subject(:institutions) { FinApps::REST::UserInstitutions.new(client) }
+
+ context 'when missing site_id' do
+ let(:create) { subject.create(nil, :params) }
+ it { expect { create }.to raise_error(FinApps::MissingArgumentsError) }
+ end
+
+ context 'when missing params' do
+ let(:create) { subject.create(:site_id, nil) }
+ it { expect { create }.to raise_error(FinApps::MissingArgumentsError) }
+ end
+
+ 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 }
+ end
+
+ # No tests for invalid site_id/params because of API/Yodlee flow
+ end
+
describe '#show' do
context 'when missing id' do
subject { FinApps::REST::UserInstitutions.new(client).show(nil) }
it { expect { subject }.to raise_error(FinApps::MissingArgumentsError) }
end