spec/rest/client_spec.rb in finapps-2.1.4 vs spec/rest/client_spec.rb in finapps-2.2.1
- old
+ new
@@ -1,22 +1,17 @@
# frozen_string_literal: true
RSpec.describe FinApps::REST::Client do
describe '#new' do
- it 'raises for missing company_identifier' do
- expect { FinApps::REST::Client.new nil, :company_token }.to raise_error(FinApps::MissingArgumentsError)
- end
-
it 'raises for missing company_token' do
- expect { FinApps::REST::Client.new :company_identifier, nil }.to raise_error(FinApps::MissingArgumentsError)
+ expect { FinApps::REST::Client.new nil }.to raise_error(FinAppsCore::MissingArgumentsError)
end
end
context 'an instance of Client' do
- subject { FinApps::REST::Client.new(:company_identifier, :company_token) }
+ subject { FinApps::REST::Client.new(:company_token) }
- %i(version users sessions orders order_tokens order_reports order_statuses institutions institutions_forms
- user_institutions_statuses user_institutions user_institutions_forms password_resets).each do |method|
+ FinApps::REST::Client::RESOURCES.each do |method|
it "responds to #{method}" do
expect(subject).to respond_to(method)
end
end
@@ -70,14 +65,10 @@
describe '#password_resets' do
it { expect(subject.password_resets).to be_an_instance_of(FinApps::REST::PasswordResets) }
end
- # [:users, :institutions, :user_institutions, :transactions, :categories,
- # :budget_models, :budget_calculation, :budgets, :cashflows,
- # :alert, :alert_definition, :alert_preferences, :alert_settings, :rule_sets]
- %i(version users sessions orders order_tokens order_reports order_statuses institutions institutions_forms
- user_institutions_statuses user_institutions user_institutions_forms password_resets).each do |method|
+ FinApps::REST::Client::RESOURCES.each do |method|
it "memoizes the result of #{method}" do
first = subject.send(method)
second = subject.send(method)
expect(first.object_id).to eq(second.object_id)
end