spec/rest/user_institutions_spec.rb in finapps-2.1.4 vs spec/rest/user_institutions_spec.rb in finapps-2.2.1
- old
+ new
@@ -1,8 +1,9 @@
# frozen_string_literal: true
RSpec.describe FinApps::REST::UserInstitutions do
- let(:client) { FinApps::REST::Client.new(:company_identifier, :company_token) }
+ include SpecHelpers::Client
+
describe '#list' do
context 'when successful' do
subject { FinApps::REST::UserInstitutions.new(client).list }
it('returns an array') { expect(subject).to be_a(Array) }
@@ -14,16 +15,16 @@
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) }
+ it { expect { create }.to raise_error(FinAppsCore::MissingArgumentsError) }
end
context 'when missing params' do
let(:create) { subject.create(:site_id, nil) }
- it { expect { create }.to raise_error(FinApps::MissingArgumentsError) }
+ it { expect { create }.to raise_error(FinAppsCore::MissingArgumentsError) }
end
context 'when valid site_id and params are provided' do
let(:create) { subject.create('valid_site_id', :params) }
@@ -36,11 +37,11 @@
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) }
+ it { expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError) }
end
context 'when valid id is provided' do
subject { FinApps::REST::UserInstitutions.new(client).show('valid_id') }
@@ -60,16 +61,16 @@
end
describe '#mfa_update' do
context 'when missing id' do
subject { FinApps::REST::UserInstitutions.new(client).mfa_update(nil, :params) }
- it { expect { subject }.to raise_error(FinApps::MissingArgumentsError) }
+ it { expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError) }
end
context 'when missing params' do
subject { FinApps::REST::UserInstitutions.new(client).mfa_update(:id, nil) }
- it { expect { subject }.to raise_error(FinApps::MissingArgumentsError) }
+ it { expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError) }
end
context 'when valid id and params are provided' do
subject { FinApps::REST::UserInstitutions.new(client).mfa_update('valid_id', :params) }
@@ -88,16 +89,16 @@
end
describe '#credentials_update' do
context 'when missing id' do
subject { FinApps::REST::UserInstitutions.new(client).credentials_update(nil, :params) }
- it { expect { subject }.to raise_error(FinApps::MissingArgumentsError) }
+ it { expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError) }
end
context 'when missing params' do
subject { FinApps::REST::UserInstitutions.new(client).credentials_update(:id, nil) }
- it { expect { subject }.to raise_error(FinApps::MissingArgumentsError) }
+ it { expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError) }
end
context 'when valid id and params are provided' do
subject { FinApps::REST::UserInstitutions.new(client).credentials_update('valid_id', :params) }
@@ -116,10 +117,10 @@
end
describe '#destroy' do
context 'when missing id' do
subject { FinApps::REST::UserInstitutions.new(client).destroy(nil) }
- it { expect { subject }.to raise_error(FinApps::MissingArgumentsError) }
+ it { expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError) }
end
context 'when valid id is provided' do
subject { FinApps::REST::UserInstitutions.new(client).destroy('valid_id') }