spec/rest/orders_spec.rb in finapps-2.1.4 vs spec/rest/orders_spec.rb in finapps-2.2.1
- old
+ new
@@ -1,12 +1,13 @@
# frozen_string_literal: true
RSpec.describe FinApps::REST::Orders do
- let(:client) { FinApps::REST::Client.new(:company_identifier, :company_token) }
+ include SpecHelpers::Client
+
describe '#show' do
context 'when missing params' do
subject { FinApps::REST::Orders.new(client).show(nil) }
- it { expect { subject }.to raise_error(FinApps::MissingArgumentsError) }
+ it { expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError) }
end
context 'when valid params are provided' do
subject { FinApps::REST::Orders.new(client).show(:valid_id) }
@@ -18,11 +19,11 @@
end
describe '#create' do
context 'when missing params' do
subject { FinApps::REST::Orders.new(client).create(nil) }
- it { expect { subject }.to raise_error(FinApps::MissingArgumentsError) }
+ it { expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError) }
end
context 'when valid params are provided' do
subject { FinApps::REST::Orders.new(client).create(valid_params) }
let(:valid_params) { {applicant: 'valid', institutions: 'valid', product: 'valid'} }
@@ -69,15 +70,15 @@
describe '#update' do
subject(:orders) { FinApps::REST::Orders.new(client) }
context 'when missing id' do
let(:update) { subject.update(nil, :params) }
- it('returns missing argument error') { expect { update }.to raise_error(FinApps::MissingArgumentsError) }
+ it('returns missing argument error') { expect { update }.to raise_error(FinAppsCore::MissingArgumentsError) }
end
context 'when missing params' do
let(:update) { subject.update(:id, nil) }
- it('returns missing argument error') { expect { update }.to raise_error(FinApps::MissingArgumentsError) }
+ it('returns missing argument error') { expect { update }.to raise_error(FinAppsCore::MissingArgumentsError) }
end
context 'when valid id and params are provided' do
let(:update) { subject.update('valid_id', accounts: 'valid_account') } # how to stub params
let(:results) { update[0] }