finapps 5.0.30 → 5.0.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/main.yaml +37 -0
  3. data/.rubocop.yml +134 -61
  4. data/.rubocop_todo.yml +29 -0
  5. data/.tmuxinator.yml +1 -0
  6. data/.travis.yml +3 -1
  7. data/README.md +1 -0
  8. data/RELEASES.md +29 -0
  9. data/finapps.gemspec +4 -4
  10. data/lib/finapps/rest/alert_definitions.rb +1 -1
  11. data/lib/finapps/rest/alert_occurrences.rb +1 -1
  12. data/lib/finapps/rest/client.rb +6 -5
  13. data/lib/finapps/rest/consumers.rb +22 -6
  14. data/lib/finapps/rest/consumers_portfolios.rb +1 -1
  15. data/lib/finapps/rest/documents_orders.rb +43 -26
  16. data/lib/finapps/rest/operators.rb +5 -5
  17. data/lib/finapps/rest/operators_password_resets.rb +1 -1
  18. data/lib/finapps/rest/order_assignments.rb +1 -1
  19. data/lib/finapps/rest/order_reports.rb +1 -1
  20. data/lib/finapps/rest/orders.rb +33 -22
  21. data/lib/finapps/rest/plaid/plaid_consumer_institutions.rb +1 -1
  22. data/lib/finapps/rest/portfolio_reports.rb +1 -1
  23. data/lib/finapps/rest/portfolios.rb +1 -1
  24. data/lib/finapps/rest/portfolios_available_consumers.rb +1 -1
  25. data/lib/finapps/rest/portfolios_consumers.rb +1 -1
  26. data/lib/finapps/rest/sessions.rb +11 -9
  27. data/lib/finapps/rest/signed_documents_downloads.rb +3 -1
  28. data/lib/finapps/utils/query_builder.rb +13 -4
  29. data/lib/finapps/version.rb +1 -1
  30. data/spec/rest/alert_definitions_spec.rb +10 -6
  31. data/spec/rest/alert_occurrences_spec.rb +6 -1
  32. data/spec/rest/api_request.rb +1 -0
  33. data/spec/rest/client_spec.rb +33 -41
  34. data/spec/rest/consumers_portfolios_spec.rb +7 -2
  35. data/spec/rest/consumers_spec.rb +240 -192
  36. data/spec/rest/documents_orders_notifications_spec.rb +4 -2
  37. data/spec/rest/documents_orders_spec.rb +94 -17
  38. data/spec/rest/esign_templates_spec.rb +2 -1
  39. data/spec/rest/operators_password_resets_spec.rb +50 -52
  40. data/spec/rest/operators_spec.rb +181 -172
  41. data/spec/rest/order_assignments_spec.rb +6 -1
  42. data/spec/rest/order_notifications_spec.rb +4 -2
  43. data/spec/rest/order_refreshes_spec.rb +8 -5
  44. data/spec/rest/order_reports_spec.rb +21 -15
  45. data/spec/rest/order_statuses_spec.rb +14 -10
  46. data/spec/rest/order_tokens_spec.rb +37 -30
  47. data/spec/rest/orders_spec.rb +121 -73
  48. data/spec/rest/password_resets_spec.rb +46 -36
  49. data/spec/rest/plaid/plaid_account_permissions_spec.rb +5 -4
  50. data/spec/rest/plaid/plaid_accounts_spec.rb +9 -4
  51. data/spec/rest/plaid/plaid_consumer_institutions_spec.rb +11 -11
  52. data/spec/rest/plaid/plaid_institution_logos_spec.rb +1 -1
  53. data/spec/rest/plaid/plaid_webhooks_spec.rb +3 -1
  54. data/spec/rest/portfolio_reports_spec.rb +7 -2
  55. data/spec/rest/portfolios_alerts_spec.rb +9 -4
  56. data/spec/rest/portfolios_available_consumers_spec.rb +7 -2
  57. data/spec/rest/portfolios_consumers_spec.rb +15 -4
  58. data/spec/rest/portfolios_spec.rb +20 -17
  59. data/spec/rest/products_spec.rb +17 -14
  60. data/spec/rest/sessions_spec.rb +63 -58
  61. data/spec/rest/signed_documents_downloads_spec.rb +10 -6
  62. data/spec/rest/tenant_app_settings_spec.rb +9 -3
  63. data/spec/rest/tenant_settings_spec.rb +9 -3
  64. data/spec/rest/verix/verix_documents_spec.rb +15 -22
  65. data/spec/rest/verix/verix_metadata_spec.rb +1 -1
  66. data/spec/rest/verix/verix_pdf_documents_spec.rb +14 -19
  67. data/spec/rest/verix/verix_records_spec.rb +31 -10
  68. data/spec/rest/version_spec.rb +6 -4
  69. data/spec/spec_helper.rb +2 -2
  70. data/spec/support/fake_api.rb +9 -3
  71. data/spec/support/fixtures/documents_orders_none.json +6 -0
  72. data/spec/utils/query_builder_spec.rb +40 -14
  73. metadata +20 -17
@@ -5,102 +5,112 @@ RSpec.describe FinApps::REST::PasswordResets do
5
5
 
6
6
  describe '#create' do
7
7
  context 'when missing id' do
8
- subject { FinApps::REST::PasswordResets.new(client).create(nil) }
8
+ subject(:create) { described_class.new(client).create(nil) }
9
+
9
10
  it do
10
- expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError)
11
+ expect { create }.to raise_error(FinAppsCore::MissingArgumentsError)
11
12
  end
12
13
  end
13
14
 
14
15
  context 'when invalid id is provided' do
15
- subject do
16
- FinApps::REST::PasswordResets.new(client).create(:invalid_user_id)
16
+ subject(:create) do
17
+ described_class.new(client).create(:invalid_user_id)
17
18
  end
18
19
 
19
- it { expect { subject }.not_to raise_error }
20
- it('results is nil') { expect(subject[0]).to be_nil }
20
+ it { expect { create }.not_to raise_error }
21
+ it('results is nil') { expect(create[0]).to be_nil }
22
+
21
23
  it('error messages array is populated') do
22
- expect(subject[1]).not_to be_nil
24
+ expect(create[1]).not_to be_nil
23
25
  end
24
26
  end
25
27
 
26
28
  context 'when valid id is provided' do
27
- subject do
28
- FinApps::REST::PasswordResets.new(client).create(:valid_user_id)
29
+ subject(:create) do
30
+ described_class.new(client).create(:valid_user_id)
29
31
  end
30
32
 
31
- it { expect { subject }.not_to raise_error }
32
- it('returns an array') { expect(subject).to be_a(Array) }
33
+ it { expect { create }.not_to raise_error }
34
+ it('returns an array') { expect(create).to be_a(Array) }
35
+
33
36
  it('performs a post and returns the response') do
34
- expect(subject[0]).to have_key(:token)
37
+ expect(create[0]).to have_key(:token)
35
38
  end
36
- it('returns no error messages') { expect(subject[1]).to be_empty }
39
+
40
+ it('returns no error messages') { expect(create[1]).to be_empty }
37
41
  end
38
42
  end
39
43
 
40
44
  describe '#update' do
41
- let(:valid_params) { { token: 'valid_token' } }
42
- let(:invalid_params) { { token: 'invalid_token' } }
45
+ let(:valid_params) { {token: 'valid_token'} }
46
+ let(:invalid_params) { {token: 'invalid_token'} }
43
47
 
44
48
  context 'when missing id' do
45
- subject { FinApps::REST::PasswordResets.new(client).update(nil, :params) }
49
+ subject(:update) { described_class.new(client).update(nil, :params) }
50
+
46
51
  it do
47
- expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError)
52
+ expect { update }.to raise_error(FinAppsCore::MissingArgumentsError)
48
53
  end
49
54
  end
50
55
 
51
56
  context 'when missing params' do
52
- subject do
53
- FinApps::REST::PasswordResets.new(client).update(:valid_user_id, nil)
57
+ subject(:update) do
58
+ described_class.new(client).update(:valid_user_id, nil)
54
59
  end
60
+
55
61
  it do
56
- expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError)
62
+ expect { update }.to raise_error(FinAppsCore::MissingArgumentsError)
57
63
  end
58
64
  end
59
65
 
60
66
  context 'when invalid id is provided' do
61
- subject do
62
- FinApps::REST::PasswordResets.new(client).update(
67
+ subject(:update) do
68
+ described_class.new(client).update(
63
69
  :invalid_user_id,
64
70
  valid_params
65
71
  )
66
72
  end
67
73
 
68
- it { expect { subject }.not_to raise_error }
69
- it('results is nil') { expect(subject[0]).to be_nil }
74
+ it { expect { update }.not_to raise_error }
75
+ it('results is nil') { expect(update[0]).to be_nil }
76
+
70
77
  it('error messages array is populated') do
71
- expect(subject[1]).not_to be_nil
78
+ expect(update[1]).not_to be_nil
72
79
  end
73
80
  end
74
81
 
75
82
  context 'when invalid params are provided' do
76
- subject do
77
- FinApps::REST::PasswordResets.new(client).update(
83
+ subject(:update) do
84
+ described_class.new(client).update(
78
85
  :valid_user_id,
79
86
  invalid_params
80
87
  )
81
88
  end
82
89
 
83
- it { expect { subject }.not_to raise_error }
84
- it('results is nil') { expect(subject[0]).to be_nil }
90
+ it { expect { update }.not_to raise_error }
91
+ it('results is nil') { expect(update[0]).to be_nil }
92
+
85
93
  it('error messages array is populated') do
86
- expect(subject[1]).not_to be_nil
94
+ expect(update[1]).not_to be_nil
87
95
  end
88
96
  end
89
97
 
90
98
  context 'when valid params are provided' do
91
- subject do
92
- FinApps::REST::PasswordResets.new(client).update(
99
+ subject(:update) do
100
+ described_class.new(client).update(
93
101
  :valid_user_id,
94
102
  valid_params
95
103
  )
96
104
  end
97
105
 
98
- it { expect { subject }.not_to raise_error }
99
- it('returns an array') { expect(subject).to be_a(Array) }
106
+ it { expect { update }.not_to raise_error }
107
+ it('returns an array') { expect(update).to be_a(Array) }
108
+
100
109
  it('performs a post and returns the response') do
101
- expect(subject[0]).to have_key(:token)
110
+ expect(update[0]).to have_key(:token)
102
111
  end
103
- it('returns no error messages') { expect(subject[1]).to be_empty }
112
+
113
+ it('returns no error messages') { expect(update[1]).to be_empty }
104
114
  end
105
115
  end
106
116
  end
@@ -13,6 +13,7 @@ RSpec.describe FinApps::REST::PlaidAccountPermissions do
13
13
  it('returns no content') do
14
14
  expect(subject[RESULTS]).to be_nil
15
15
  end
16
+
16
17
  it('returns no error messages') do
17
18
  expect(subject[ERROR_MESSAGES]).to be_empty
18
19
  end
@@ -20,8 +21,8 @@ RSpec.describe FinApps::REST::PlaidAccountPermissions do
20
21
 
21
22
  describe '#create' do
22
23
  subject(:show) do
23
- FinApps::REST::PlaidAccountPermissions.new(api_client)
24
- .create(:account_id)
24
+ described_class.new(api_client)
25
+ .create(:account_id)
25
26
  end
26
27
 
27
28
  it_behaves_like 'an API request'
@@ -31,8 +32,8 @@ RSpec.describe FinApps::REST::PlaidAccountPermissions do
31
32
 
32
33
  describe '#destroy' do
33
34
  subject(:destroy) do
34
- FinApps::REST::PlaidAccountPermissions.new(api_client)
35
- .destroy(:account_id)
35
+ described_class.new(api_client)
36
+ .destroy(:account_id)
36
37
  end
37
38
 
38
39
  it_behaves_like 'an API request'
@@ -17,7 +17,7 @@ RSpec.describe FinApps::REST::PlaidAccounts do
17
17
 
18
18
  describe '#show' do
19
19
  subject(:show) do
20
- FinApps::REST::PlaidAccounts.new(api_client).show(
20
+ described_class.new(api_client).show(
21
21
  :account_id
22
22
  )
23
23
  end
@@ -28,11 +28,16 @@ RSpec.describe FinApps::REST::PlaidAccounts do
28
28
  end
29
29
 
30
30
  describe '#list' do
31
- subject(:list) { FinApps::REST::PlaidAccounts.new(api_client).list }
31
+ subject(:list) { described_class.new(api_client).list }
32
32
 
33
33
  it_behaves_like 'an API request'
34
34
  it_behaves_like 'a successful request'
35
- it('returns an Array of institution data') { expect(list[RESULTS].first).to have_key(:plaid_institution_id) }
36
- it('returns institution account data') { expect(list[RESULTS].first).to have_key(:accounts) }
35
+ it('returns an Array of institution data') {
36
+ expect(list[RESULTS].first).to have_key(:plaid_institution_id)
37
+ }
38
+
39
+ it('returns institution account data') {
40
+ expect(list[RESULTS].first).to have_key(:accounts)
41
+ }
37
42
  end
38
43
  end
@@ -17,7 +17,7 @@ RSpec.describe FinApps::REST::PlaidConsumerInstitutions do
17
17
 
18
18
  describe '#create' do
19
19
  subject(:create) do
20
- FinApps::REST::PlaidConsumerInstitutions.new(api_client).create(
20
+ described_class.new(api_client).create(
21
21
  public_token: 'le-token'
22
22
  )
23
23
  end
@@ -29,7 +29,7 @@ RSpec.describe FinApps::REST::PlaidConsumerInstitutions do
29
29
 
30
30
  describe '#show' do
31
31
  subject(:show) do
32
- FinApps::REST::PlaidConsumerInstitutions.new(api_client).show(
32
+ described_class.new(api_client).show(
33
33
  :consumer_institution_id
34
34
  )
35
35
  end
@@ -39,7 +39,7 @@ RSpec.describe FinApps::REST::PlaidConsumerInstitutions do
39
39
  it_behaves_like 'a request that returns institution data'
40
40
  context 'when requesting accounts information' do
41
41
  subject(:show) do
42
- FinApps::REST::PlaidConsumerInstitutions.new(api_client).show(
42
+ described_class.new(api_client).show(
43
43
  :consumer_institution_id, show_accounts: true
44
44
  )
45
45
  end
@@ -48,14 +48,14 @@ RSpec.describe FinApps::REST::PlaidConsumerInstitutions do
48
48
  it_behaves_like 'a successful request'
49
49
  it_behaves_like 'a request that returns institution data'
50
50
  it('returns institution account data') do
51
- expect(subject[RESULTS]).to have_key(:accounts)
51
+ expect(show[RESULTS]).to have_key(:accounts)
52
52
  end
53
53
  end
54
54
  end
55
55
 
56
56
  describe '#list' do
57
57
  subject(:list) do
58
- FinApps::REST::PlaidConsumerInstitutions.new(api_client).list
58
+ described_class.new(api_client).list
59
59
  end
60
60
 
61
61
  it_behaves_like 'an API request'
@@ -67,8 +67,8 @@ RSpec.describe FinApps::REST::PlaidConsumerInstitutions do
67
67
 
68
68
  describe '#destroy' do
69
69
  subject(:destroy) do
70
- FinApps::REST::PlaidConsumerInstitutions.new(api_client)
71
- .destroy(:consumer_institution_id)
70
+ described_class.new(api_client)
71
+ .destroy(:consumer_institution_id)
72
72
  end
73
73
 
74
74
  it_behaves_like 'an API request'
@@ -80,8 +80,8 @@ RSpec.describe FinApps::REST::PlaidConsumerInstitutions do
80
80
 
81
81
  describe '#update_status' do
82
82
  subject(:update_status) do
83
- FinApps::REST::PlaidConsumerInstitutions.new(api_client)
84
- .update_status(:consumer_institution_id)
83
+ described_class.new(api_client)
84
+ .update_status(:consumer_institution_id)
85
85
  end
86
86
 
87
87
  it_behaves_like 'an API request'
@@ -91,8 +91,8 @@ RSpec.describe FinApps::REST::PlaidConsumerInstitutions do
91
91
 
92
92
  describe '#public_token' do
93
93
  subject(:public_token) do
94
- FinApps::REST::PlaidConsumerInstitutions.new(api_client)
95
- .public_token(:consumer_institution_id)
94
+ described_class.new(api_client)
95
+ .public_token(:consumer_institution_id)
96
96
  end
97
97
 
98
98
  it_behaves_like 'an API request'
@@ -11,7 +11,7 @@ RSpec.describe FinApps::REST::PlaidInstitutionLogos do
11
11
 
12
12
  describe '#show' do
13
13
  subject(:show) do
14
- FinApps::REST::PlaidInstitutionLogos.new(api_client).show(
14
+ described_class.new(api_client).show(
15
15
  :inst_id
16
16
  )
17
17
  end
@@ -6,8 +6,9 @@ require 'rest/api_request'
6
6
  RSpec.describe FinApps::REST::PlaidWebhooks do
7
7
  include SpecHelpers::Client
8
8
 
9
+ subject(:show) { described_class.new(api_client).show }
10
+
9
11
  let(:api_client) { client }
10
- subject(:show) { FinApps::REST::PlaidWebhooks.new(api_client).show }
11
12
 
12
13
  describe '#show' do
13
14
  context 'when valid tenant token is provided' do
@@ -25,6 +26,7 @@ RSpec.describe FinApps::REST::PlaidWebhooks do
25
26
  it_behaves_like 'an API request'
26
27
 
27
28
  it('results is nil') { expect(show[RESULTS]).to be_nil }
29
+
28
30
  it('error messages array is populated') do
29
31
  expect(show[ERROR_MESSAGES].first.downcase).to eq(
30
32
  'invalid tenant api key or secret'
@@ -4,7 +4,7 @@ require 'spec_helpers/client'
4
4
 
5
5
  RSpec.describe FinApps::REST::PortfolioReports do
6
6
  include SpecHelpers::Client
7
- subject { FinApps::REST::PortfolioReports.new(client) }
7
+ subject { described_class.new(client) }
8
8
 
9
9
  describe '#list' do
10
10
  let(:list) { subject.list(params) }
@@ -16,9 +16,11 @@ RSpec.describe FinApps::REST::PortfolioReports do
16
16
 
17
17
  it { expect { list }.not_to raise_error }
18
18
  it('returns an array') { expect(list).to be_a(Array) }
19
+
19
20
  it('performs a get and returns the response') do
20
21
  expect(results).to have_key(:records)
21
22
  end
23
+
22
24
  it('returns no error messages') { expect(errors).to be_empty }
23
25
  end
24
26
 
@@ -29,14 +31,17 @@ RSpec.describe FinApps::REST::PortfolioReports do
29
31
  end
30
32
 
31
33
  context 'when including valid params' do
32
- let(:params) { { page: 2, sort: '-created_date', requested: 25 } }
34
+ let(:params) { {page: 2, sort: '-created_date', requested: 25} }
33
35
 
34
36
  it { expect { list }.not_to raise_error }
35
37
  it('returns an array') { expect(list).to be_a(Array) }
38
+
36
39
  it('performs a get and returns the response') do
37
40
  expect(results).to have_key(:records)
38
41
  end
42
+
39
43
  it('returns no error messages') { expect(errors).to be_empty }
44
+
40
45
  it 'builds query and sends proper request' do
41
46
  list
42
47
  url =
@@ -4,7 +4,7 @@ require 'spec_helpers/client'
4
4
 
5
5
  RSpec.describe FinApps::REST::PortfoliosAlerts do
6
6
  include SpecHelpers::Client
7
- subject { FinApps::REST::PortfoliosAlerts.new(client) }
7
+ subject { described_class.new(client) }
8
8
 
9
9
  describe '#list' do
10
10
  let(:list) { subject.list(id) }
@@ -22,11 +22,13 @@ RSpec.describe FinApps::REST::PortfoliosAlerts do
22
22
 
23
23
  it { expect { list }.not_to raise_error }
24
24
  it('returns an array') { expect(list).to be_a(Array) }
25
- it('performs a get and returns array of alert definitions') do
25
+
26
+ it('performs a get and returns a results array') do
26
27
  expect(results).to be_a(Array)
27
- expect(results.first).to have_key(:_id)
28
- expect(results.first).to have_key(:rule_name)
29
28
  end
29
+
30
+ it { expect(results.first).to have_key(:_id) }
31
+ it { expect(results.first).to have_key(:rule_name) }
30
32
  it('returns no error messages') { expect(errors).to be_empty }
31
33
  end
32
34
 
@@ -35,6 +37,7 @@ RSpec.describe FinApps::REST::PortfoliosAlerts do
35
37
 
36
38
  it { expect { list }.not_to raise_error }
37
39
  it('results is nil') { expect(results).to be_nil }
40
+
38
41
  it('error messages array is populated') do
39
42
  expect(errors.first.downcase).to eq('resource not found')
40
43
  end
@@ -80,6 +83,7 @@ RSpec.describe FinApps::REST::PortfoliosAlerts do
80
83
 
81
84
  it { expect { create }.not_to raise_error }
82
85
  it('results is nil') { expect(results).to be_nil }
86
+
83
87
  it('error messages array is populated') do
84
88
  expect(errors.first.downcase).to eq('resource not found')
85
89
  end
@@ -125,6 +129,7 @@ RSpec.describe FinApps::REST::PortfoliosAlerts do
125
129
 
126
130
  it { expect { destroy }.not_to raise_error }
127
131
  it('results is nil') { expect(results).to be_nil }
132
+
128
133
  it('error messages array is populated') do
129
134
  expect(errors.first.downcase).to eq('resource not found')
130
135
  end
@@ -4,7 +4,7 @@ require 'spec_helpers/client'
4
4
 
5
5
  RSpec.describe FinApps::REST::PortfoliosAvailableConsumers do
6
6
  include SpecHelpers::Client
7
- subject { FinApps::REST::PortfoliosAvailableConsumers.new(client) }
7
+ subject { described_class.new(client) }
8
8
 
9
9
  describe '#list' do
10
10
  let(:list) { subject.list(id, params) }
@@ -24,9 +24,11 @@ RSpec.describe FinApps::REST::PortfoliosAvailableConsumers do
24
24
 
25
25
  it { expect { list }.not_to raise_error }
26
26
  it('returns an array') { expect(list).to be_a(Array) }
27
+
27
28
  it('performs a get and returns the response') do
28
29
  expect(results).to have_key(:records)
29
30
  end
31
+
30
32
  it('returns no error messages') { expect(errors).to be_empty }
31
33
  end
32
34
 
@@ -39,14 +41,17 @@ RSpec.describe FinApps::REST::PortfoliosAvailableConsumers do
39
41
 
40
42
  context 'when including valid params' do
41
43
  let(:id) { 'valid_id' }
42
- let(:params) { { page: 2, sort: '-created_date', requested: 25 } }
44
+ let(:params) { {page: 2, sort: '-created_date', requested: 25} }
43
45
 
44
46
  it { expect { list }.not_to raise_error }
45
47
  it('returns an array') { expect(list).to be_a(Array) }
48
+
46
49
  it('performs a get and returns the response') do
47
50
  expect(results).to have_key(:records)
48
51
  end
52
+
49
53
  it('returns no error messages') { expect(errors).to be_empty }
54
+
50
55
  it 'builds query and sends proper request' do
51
56
  list
52
57
  url =
@@ -4,7 +4,7 @@ require 'spec_helpers/client'
4
4
 
5
5
  RSpec.describe FinApps::REST::PortfoliosConsumers do
6
6
  include SpecHelpers::Client
7
- subject { FinApps::REST::PortfoliosConsumers.new(client) }
7
+ subject { described_class.new(client) }
8
8
 
9
9
  describe '#list' do
10
10
  let(:list) { subject.list(portfolio_id, params) }
@@ -31,22 +31,27 @@ RSpec.describe FinApps::REST::PortfoliosConsumers do
31
31
 
32
32
  it { expect { list }.not_to raise_error }
33
33
  it('returns an array') { expect(list).to be_a(Array) }
34
+
34
35
  it('performs a get and returns the response') do
35
36
  expect(results).to have_key(:records)
36
37
  end
38
+
37
39
  it('returns no error messages') { expect(errors).to be_empty }
38
40
  end
39
41
 
40
42
  context 'when valid id is provided w/ valid params' do
41
43
  let(:portfolio_id) { 'valid_id' }
42
- let(:params) { { page: 2, sort: '-created_date', requested: 25 } }
44
+ let(:params) { {page: 2, sort: '-created_date', requested: 25} }
43
45
 
44
46
  it { expect { list }.not_to raise_error }
45
47
  it('returns an array') { expect(list).to be_a(Array) }
48
+
46
49
  it('performs a get and returns the response') do
47
50
  expect(results).to have_key(:records)
48
51
  end
52
+
49
53
  it('returns no error messages') { expect(errors).to be_empty }
54
+
50
55
  it 'builds query and sends proper request' do
51
56
  list
52
57
  url =
@@ -62,6 +67,7 @@ RSpec.describe FinApps::REST::PortfoliosConsumers do
62
67
 
63
68
  it { expect { list }.not_to raise_error }
64
69
  it('results is nil') { expect(results).to be_nil }
70
+
65
71
  it('error messages array is populated') do
66
72
  expect(errors.first.downcase).to eq('resource not found')
67
73
  end
@@ -91,7 +97,7 @@ RSpec.describe FinApps::REST::PortfoliosConsumers do
91
97
  end
92
98
  end
93
99
 
94
- context 'for bulk subscribe' do
100
+ context 'with bulk subscribe' do
95
101
  context 'when valid id and params are provided' do
96
102
  let(:portfolio_id) { 'valid_id' }
97
103
  let(:params) { %w[id1 id2 id3] }
@@ -100,6 +106,7 @@ RSpec.describe FinApps::REST::PortfoliosConsumers do
100
106
  it('returns an array') { expect(create).to be_a(Array) }
101
107
  it('results is nil') { expect(results).to be_nil }
102
108
  it('returns no error messages') { expect(errors).to be_empty }
109
+
103
110
  it('builds correct url') do
104
111
  create
105
112
  url = "#{versioned_api_path}/portfolios/#{portfolio_id}/consumers"
@@ -113,6 +120,7 @@ RSpec.describe FinApps::REST::PortfoliosConsumers do
113
120
 
114
121
  it { expect { create }.not_to raise_error }
115
122
  it('results is nil') { expect(results).to be_nil }
123
+
116
124
  it('error messages array is populated') do
117
125
  # this will break when client is fixed to expect new array error response
118
126
  expect(errors.first.downcase).to eq(
@@ -122,7 +130,7 @@ RSpec.describe FinApps::REST::PortfoliosConsumers do
122
130
  end
123
131
  end
124
132
 
125
- context 'for single subscribe' do
133
+ context 'with single subscribe' do
126
134
  context 'when valid ids are provided' do
127
135
  let(:portfolio_id) { 'valid_id' }
128
136
  let(:params) { portfolio_id }
@@ -131,6 +139,7 @@ RSpec.describe FinApps::REST::PortfoliosConsumers do
131
139
  it('returns an array') { expect(create).to be_a(Array) }
132
140
  it('results is nil') { expect(results).to be_nil }
133
141
  it('returns no error messages') { expect(errors).to be_empty }
142
+
134
143
  it('builds correct url') do
135
144
  create
136
145
  url =
@@ -145,6 +154,7 @@ RSpec.describe FinApps::REST::PortfoliosConsumers do
145
154
 
146
155
  it { expect { create }.not_to raise_error }
147
156
  it('results is nil') { expect(results).to be_nil }
157
+
148
158
  it('error messages array is populated') do
149
159
  expect(errors.first.downcase).to eq(
150
160
  'consumer not eligible, no completed orders.'
@@ -193,6 +203,7 @@ RSpec.describe FinApps::REST::PortfoliosConsumers do
193
203
 
194
204
  it { expect { destroy }.not_to raise_error }
195
205
  it('results is nil') { expect(results).to be_nil }
206
+
196
207
  it('error messages array is populated') do
197
208
  expect(errors.first.downcase).to eq('resource not found')
198
209
  end