finapps 5.0.32 → 5.0.33
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.
- checksums.yaml +4 -4
- data/.rubocop.yml +134 -61
- data/.rubocop_todo.yml +120 -0
- data/.tmuxinator.yml +1 -0
- data/.travis.yml +3 -1
- data/finapps.gemspec +3 -3
- data/lib/finapps/rest/alert_definitions.rb +1 -1
- data/lib/finapps/rest/alert_occurrences.rb +1 -1
- data/lib/finapps/rest/consumers.rb +5 -5
- data/lib/finapps/rest/consumers_portfolios.rb +1 -1
- data/lib/finapps/rest/documents_orders.rb +25 -24
- data/lib/finapps/rest/operators.rb +5 -5
- data/lib/finapps/rest/operators_password_resets.rb +1 -1
- data/lib/finapps/rest/order_assignments.rb +1 -1
- data/lib/finapps/rest/order_reports.rb +1 -1
- data/lib/finapps/rest/orders.rb +10 -10
- data/lib/finapps/rest/plaid/plaid_consumer_institutions.rb +1 -1
- data/lib/finapps/rest/portfolio_reports.rb +1 -1
- data/lib/finapps/rest/portfolios.rb +1 -1
- data/lib/finapps/rest/portfolios_available_consumers.rb +1 -1
- data/lib/finapps/rest/portfolios_consumers.rb +1 -1
- data/lib/finapps/rest/sessions.rb +1 -1
- data/lib/finapps/rest/signed_documents_downloads.rb +3 -1
- data/lib/finapps/version.rb +1 -1
- data/spec/rest/alert_definitions_spec.rb +10 -2
- data/spec/rest/alert_occurrences_spec.rb +6 -1
- data/spec/rest/api_request.rb +1 -0
- data/spec/rest/client_spec.rb +2 -2
- data/spec/rest/consumers_portfolios_spec.rb +7 -2
- data/spec/rest/consumers_spec.rb +39 -11
- data/spec/rest/documents_orders_notifications_spec.rb +3 -1
- data/spec/rest/documents_orders_spec.rb +85 -23
- data/spec/rest/esign_templates_spec.rb +2 -1
- data/spec/rest/operators_password_resets_spec.rb +6 -1
- data/spec/rest/operators_spec.rb +22 -2
- data/spec/rest/order_assignments_spec.rb +6 -1
- data/spec/rest/order_notifications_spec.rb +3 -1
- data/spec/rest/order_refreshes_spec.rb +7 -1
- data/spec/rest/order_reports_spec.rb +7 -1
- data/spec/rest/order_statuses_spec.rb +7 -3
- data/spec/rest/order_tokens_spec.rb +7 -1
- data/spec/rest/orders_spec.rb +63 -29
- data/spec/rest/password_resets_spec.rb +20 -10
- data/spec/rest/plaid/plaid_account_permissions_spec.rb +5 -4
- data/spec/rest/plaid/plaid_accounts_spec.rb +9 -4
- data/spec/rest/plaid/plaid_consumer_institutions_spec.rb +10 -10
- data/spec/rest/plaid/plaid_institution_logos_spec.rb +1 -1
- data/spec/rest/plaid/plaid_webhooks_spec.rb +3 -1
- data/spec/rest/portfolio_reports_spec.rb +7 -2
- data/spec/rest/portfolios_alerts_spec.rb +6 -1
- data/spec/rest/portfolios_available_consumers_spec.rb +7 -2
- data/spec/rest/portfolios_consumers_spec.rb +13 -2
- data/spec/rest/portfolios_spec.rb +20 -5
- data/spec/rest/products_spec.rb +3 -1
- data/spec/rest/sessions_spec.rb +8 -4
- data/spec/rest/signed_documents_downloads_spec.rb +3 -3
- data/spec/rest/tenant_app_settings_spec.rb +9 -3
- data/spec/rest/tenant_settings_spec.rb +9 -3
- data/spec/rest/verix/verix_documents_spec.rb +13 -20
- data/spec/rest/verix/verix_metadata_spec.rb +1 -1
- data/spec/rest/verix/verix_pdf_documents_spec.rb +14 -19
- data/spec/rest/verix/verix_records_spec.rb +31 -10
- data/spec/rest/version_spec.rb +3 -1
- data/spec/spec_helper.rb +2 -2
- data/spec/support/fake_api.rb +9 -3
- data/spec/support/fixtures/documents_orders_none.json +6 -0
- data/spec/utils/query_builder_spec.rb +40 -14
- metadata +17 -15
|
@@ -6,10 +6,11 @@ RSpec.describe FinApps::REST::DocumentsOrdersNotifications do
|
|
|
6
6
|
include SpecHelpers::Client
|
|
7
7
|
|
|
8
8
|
describe '#create' do
|
|
9
|
-
subject(:notifications) {
|
|
9
|
+
subject(:notifications) { described_class.new(client) }
|
|
10
10
|
|
|
11
11
|
context 'when missing id' do
|
|
12
12
|
let(:create) { subject.create(nil) }
|
|
13
|
+
|
|
13
14
|
it('returns missing argument error') do
|
|
14
15
|
expect { create }.to raise_error(FinAppsCore::MissingArgumentsError)
|
|
15
16
|
end
|
|
@@ -22,6 +23,7 @@ RSpec.describe FinApps::REST::DocumentsOrdersNotifications do
|
|
|
22
23
|
|
|
23
24
|
it { expect { create }.not_to raise_error }
|
|
24
25
|
it('results is nil') { expect(results).to be_nil }
|
|
26
|
+
|
|
25
27
|
it('error messages array is populated') do
|
|
26
28
|
expect(error_messages.first.downcase).to eq('order id is invalid')
|
|
27
29
|
end
|
|
@@ -15,7 +15,8 @@ RSpec.describe FinApps::REST::DocumentsOrders do
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
describe '#list' do
|
|
18
|
-
subject(:list) {
|
|
18
|
+
subject(:list) { described_class.new(client).list(params) }
|
|
19
|
+
|
|
19
20
|
let(:results) { list[0] }
|
|
20
21
|
let(:error_messages) { list[1] }
|
|
21
22
|
|
|
@@ -31,12 +32,14 @@ RSpec.describe FinApps::REST::DocumentsOrders do
|
|
|
31
32
|
end
|
|
32
33
|
|
|
33
34
|
context 'without searchTerm' do
|
|
34
|
-
let(:params) { {
|
|
35
|
+
let(:params) { {searchTerm: nil, page: 2} }
|
|
36
|
+
|
|
35
37
|
it_behaves_like 'an API request'
|
|
36
38
|
it_behaves_like 'a successful request'
|
|
37
39
|
it 'performs a get and returns the response' do
|
|
38
40
|
expect(results).to have_key(:records)
|
|
39
41
|
end
|
|
42
|
+
|
|
40
43
|
it 'builds query and sends proper request' do
|
|
41
44
|
list
|
|
42
45
|
url = "#{versioned_api_path}/documents/orders?page=2"
|
|
@@ -50,41 +53,72 @@ RSpec.describe FinApps::REST::DocumentsOrders do
|
|
|
50
53
|
it 'performs a get and returns the response' do
|
|
51
54
|
expect(results).to have_key(:records)
|
|
52
55
|
end
|
|
56
|
+
|
|
53
57
|
it 'builds query and sends proper request' do
|
|
54
58
|
list
|
|
55
59
|
url =
|
|
56
|
-
"#{versioned_api_path}/documents/orders?
|
|
57
|
-
'%
|
|
58
|
-
'%22term%22%7D,%7B%
|
|
59
|
-
'%
|
|
60
|
+
"#{versioned_api_path}/documents/orders?"\
|
|
61
|
+
'filter=%7B%22$or%22:%5B%7B%22applicant.email%22:'\
|
|
62
|
+
'%22term%22%7D,%7B%22applicant.first_name%22:%22term%22%7D,'\
|
|
63
|
+
'%7B%22applicant.last_name%22:'\
|
|
64
|
+
'%22term%22%7D,%7B%22reference_no%22:%7B%22$regex%22:%22%5Eterm%22,'\
|
|
65
|
+
'%22$options%22:%22i%22%7D%7D%5D,'\
|
|
66
|
+
'%22consumer_id%22:%22valid_consumer_id%22%7D&'\
|
|
67
|
+
'page=2&requested=25&sort=tag '
|
|
60
68
|
|
|
61
69
|
expect(WebMock).to have_requested(:get, url)
|
|
62
70
|
end
|
|
63
71
|
|
|
64
72
|
context 'with search term containing spaces' do
|
|
65
|
-
let(:params) { {
|
|
73
|
+
let(:params) { {"searchTerm": 'Blue Jay', "page": 2} }
|
|
74
|
+
|
|
66
75
|
it 'builds query and sends proper request' do
|
|
67
76
|
list
|
|
68
77
|
url =
|
|
69
|
-
"#{versioned_api_path}/documents/orders?
|
|
70
|
-
'%
|
|
71
|
-
'%22Blue%20Jay%22%7D
|
|
72
|
-
'%
|
|
73
|
-
'%7B%22applicant.
|
|
78
|
+
"#{versioned_api_path}/documents/orders?"\
|
|
79
|
+
'filter=%7B%22$or%22:%5B%7B%22applicant.email%22:'\
|
|
80
|
+
'%22Blue%20Jay%22%7D,'\
|
|
81
|
+
'%7B%22applicant.first_name%22:%22Blue%20Jay%22%7D,'\
|
|
82
|
+
'%7B%22applicant.last_name%22:'\
|
|
83
|
+
'%22Blue%20Jay%22%7D,'\
|
|
84
|
+
'%7B%22reference_no%22:%7B%22$regex%22:%22%5EBlue%20Jay%22,'\
|
|
85
|
+
'%22$options%22:'\
|
|
86
|
+
'%22i%22%7D%7D,%7B%22applicant.first_name%22:%22Blue%22%7D,'\
|
|
87
|
+
'%7B%22applicant.last_name%22:%22Blue%22%7D,'\
|
|
88
|
+
'%7B%22applicant.first_name%22:%22Jay%22%7D,'\
|
|
89
|
+
'%7B%22applicant.last_name%22:%22Jay%22%7D%5D%7D&page=2'
|
|
74
90
|
|
|
75
91
|
expect(WebMock).to have_requested(:get, url)
|
|
76
92
|
end
|
|
77
93
|
end
|
|
78
94
|
end
|
|
95
|
+
|
|
96
|
+
context 'when filtering by open status ordes' do
|
|
97
|
+
let(:params) { {status: 1} }
|
|
98
|
+
|
|
99
|
+
it_behaves_like 'an API request'
|
|
100
|
+
it_behaves_like 'a successful request'
|
|
101
|
+
it { expect(subject.first[:records]).not_to be_empty }
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
context 'when filtering by closed status ordes' do
|
|
105
|
+
let(:params) { {status: 2, searchTerm: 'term'} }
|
|
106
|
+
|
|
107
|
+
it_behaves_like 'an API request'
|
|
108
|
+
it_behaves_like 'a successful request'
|
|
109
|
+
it { expect(results[:records]).to be_empty }
|
|
110
|
+
end
|
|
79
111
|
end
|
|
80
112
|
|
|
81
113
|
context 'with invalid params' do
|
|
82
114
|
let(:params) { ['invalid array'] }
|
|
115
|
+
|
|
83
116
|
it { expect { list }.to raise_error(FinAppsCore::InvalidArgumentsError) }
|
|
84
117
|
end
|
|
85
118
|
|
|
86
119
|
context 'with missing params' do
|
|
87
120
|
let(:params) { nil }
|
|
121
|
+
|
|
88
122
|
it_behaves_like 'an API request'
|
|
89
123
|
it_behaves_like 'a successful request'
|
|
90
124
|
it('performs a get and returns the response') do
|
|
@@ -94,15 +128,18 @@ RSpec.describe FinApps::REST::DocumentsOrders do
|
|
|
94
128
|
end
|
|
95
129
|
|
|
96
130
|
describe '#show' do
|
|
97
|
-
subject(:show) {
|
|
131
|
+
subject(:show) { described_class.new(client).show(id) }
|
|
132
|
+
|
|
98
133
|
let(:results) { show[0] }
|
|
99
134
|
let(:error_messages) { show[1] }
|
|
100
135
|
|
|
101
136
|
context 'with valid id' do
|
|
102
137
|
let(:id) { :valid_order_id }
|
|
138
|
+
|
|
103
139
|
it_behaves_like 'an API request'
|
|
104
140
|
it_behaves_like 'a successful request'
|
|
105
141
|
it('results is a Hash') { expect(results).to be_a(Hash) }
|
|
142
|
+
|
|
106
143
|
it('performs a get and returns the response') do
|
|
107
144
|
expect(results).to have_key(:order_id)
|
|
108
145
|
end
|
|
@@ -110,18 +147,21 @@ RSpec.describe FinApps::REST::DocumentsOrders do
|
|
|
110
147
|
|
|
111
148
|
context 'with invalid id' do
|
|
112
149
|
let(:id) { :invalid_order_id }
|
|
150
|
+
|
|
113
151
|
it { expect(results).to be_nil }
|
|
114
|
-
it { expect(error_messages).
|
|
152
|
+
it { expect(error_messages).not_to be_empty }
|
|
115
153
|
end
|
|
116
154
|
|
|
117
155
|
context 'when missing id' do
|
|
118
156
|
let(:id) { nil }
|
|
157
|
+
|
|
119
158
|
it_behaves_like 'a request that raises an error'
|
|
120
159
|
end
|
|
121
160
|
end
|
|
122
161
|
|
|
123
162
|
describe '#create' do
|
|
124
|
-
subject(:create) {
|
|
163
|
+
subject(:create) { described_class.new(client).create(params) }
|
|
164
|
+
|
|
125
165
|
let(:results) { create[0] }
|
|
126
166
|
let(:error_messages) { create[1] }
|
|
127
167
|
|
|
@@ -141,9 +181,11 @@ RSpec.describe FinApps::REST::DocumentsOrders do
|
|
|
141
181
|
"tag": 'new'
|
|
142
182
|
}
|
|
143
183
|
end
|
|
184
|
+
|
|
144
185
|
it_behaves_like 'an API request'
|
|
145
186
|
it_behaves_like 'a successful request'
|
|
146
187
|
it('results is a Hash') { expect(results).to be_a(Hash) }
|
|
188
|
+
|
|
147
189
|
it('performs a post and returns the response') do
|
|
148
190
|
expect(results).to have_key(:order_id)
|
|
149
191
|
end
|
|
@@ -161,8 +203,10 @@ RSpec.describe FinApps::REST::DocumentsOrders do
|
|
|
161
203
|
"reference_no": 'REFNO'
|
|
162
204
|
}
|
|
163
205
|
end
|
|
206
|
+
|
|
164
207
|
it { expect { create }.not_to raise_error }
|
|
165
208
|
it('results is nil') { expect(results).to be_nil }
|
|
209
|
+
|
|
166
210
|
it('error messages array is populated') do
|
|
167
211
|
expect(error_messages.first.downcase).to eq('invalid request body')
|
|
168
212
|
end
|
|
@@ -170,12 +214,14 @@ RSpec.describe FinApps::REST::DocumentsOrders do
|
|
|
170
214
|
|
|
171
215
|
context 'with missing params' do
|
|
172
216
|
let(:params) { nil }
|
|
217
|
+
|
|
173
218
|
it_behaves_like 'a request that raises an error'
|
|
174
219
|
end
|
|
175
220
|
end
|
|
176
221
|
|
|
177
222
|
describe '#update' do
|
|
178
|
-
subject(:update) {
|
|
223
|
+
subject(:update) { described_class.new(client).update(id, params) }
|
|
224
|
+
|
|
179
225
|
let(:params) { {} }
|
|
180
226
|
let(:results) { update[0] }
|
|
181
227
|
let(:error_messages) { update[1] }
|
|
@@ -184,16 +230,19 @@ RSpec.describe FinApps::REST::DocumentsOrders do
|
|
|
184
230
|
let(:id) { :valid_order_id }
|
|
185
231
|
|
|
186
232
|
context 'with valid params' do
|
|
187
|
-
let(:params) { {
|
|
233
|
+
let(:params) { {"tag": 'pending'} }
|
|
234
|
+
|
|
188
235
|
it_behaves_like 'an API request'
|
|
189
236
|
it_behaves_like 'a successful request'
|
|
190
237
|
it('results is nil') { expect(results).to be_nil }
|
|
191
238
|
end
|
|
192
239
|
|
|
193
240
|
context 'with invalid params' do
|
|
194
|
-
let(:params) { {
|
|
241
|
+
let(:params) { {"tag": 'invalid'} }
|
|
242
|
+
|
|
195
243
|
it_behaves_like 'an API request'
|
|
196
244
|
it('results is nil') { expect(results).to be_nil }
|
|
245
|
+
|
|
197
246
|
it('error messages array is populated') do
|
|
198
247
|
expect(error_messages.first.downcase).to eq('invalid request body')
|
|
199
248
|
end
|
|
@@ -202,9 +251,11 @@ RSpec.describe FinApps::REST::DocumentsOrders do
|
|
|
202
251
|
|
|
203
252
|
context 'with invalid id' do
|
|
204
253
|
let(:id) { :invalid_order_id }
|
|
205
|
-
let(:params) { {
|
|
254
|
+
let(:params) { {applicant: {first_name: 'Quasar'}} }
|
|
255
|
+
|
|
206
256
|
it_behaves_like 'an API request'
|
|
207
257
|
it('results is nil') { expect(results).to be_nil }
|
|
258
|
+
|
|
208
259
|
it('error messages array is populated') do
|
|
209
260
|
expect(error_messages.first.downcase).to eq(
|
|
210
261
|
'order id is invalid'
|
|
@@ -214,17 +265,20 @@ RSpec.describe FinApps::REST::DocumentsOrders do
|
|
|
214
265
|
|
|
215
266
|
context 'with missing id' do
|
|
216
267
|
let(:id) { nil }
|
|
268
|
+
|
|
217
269
|
it_behaves_like 'a request that raises an error'
|
|
218
270
|
end
|
|
219
271
|
end
|
|
220
272
|
|
|
221
273
|
describe '#destroy' do
|
|
222
|
-
subject(:destroy) {
|
|
274
|
+
subject(:destroy) { described_class.new(client).destroy(id) }
|
|
275
|
+
|
|
223
276
|
let(:results) { destroy[0] }
|
|
224
277
|
let(:error_messages) { destroy[1] }
|
|
225
278
|
|
|
226
279
|
context 'with valid id' do
|
|
227
280
|
let(:id) { :valid_order_id }
|
|
281
|
+
|
|
228
282
|
it_behaves_like 'an API request'
|
|
229
283
|
it_behaves_like 'a successful request'
|
|
230
284
|
it('results is nil') { expect(results).to be_nil }
|
|
@@ -232,8 +286,10 @@ RSpec.describe FinApps::REST::DocumentsOrders do
|
|
|
232
286
|
|
|
233
287
|
context 'with invalid id' do
|
|
234
288
|
let(:id) { :invalid_order_id }
|
|
289
|
+
|
|
235
290
|
it_behaves_like 'an API request'
|
|
236
291
|
it('results is nil') { expect(results).to be_nil }
|
|
292
|
+
|
|
237
293
|
it('error messages array is populated') do
|
|
238
294
|
expect(error_messages.first.downcase).to eq('resource not found')
|
|
239
295
|
end
|
|
@@ -241,12 +297,14 @@ RSpec.describe FinApps::REST::DocumentsOrders do
|
|
|
241
297
|
|
|
242
298
|
context 'with missing id' do
|
|
243
299
|
let(:id) { nil }
|
|
300
|
+
|
|
244
301
|
it_behaves_like 'a request that raises an error'
|
|
245
302
|
end
|
|
246
303
|
end
|
|
247
304
|
|
|
248
305
|
describe '#show_signing_url' do
|
|
249
|
-
subject(:sign_url) {
|
|
306
|
+
subject(:sign_url) { described_class.new(client).show_signing_url(order_id, signature_id) }
|
|
307
|
+
|
|
250
308
|
let(:results) { sign_url[0] }
|
|
251
309
|
let(:error_messages) { sign_url[1] }
|
|
252
310
|
let(:order_id) { :valid_order_id }
|
|
@@ -263,24 +321,28 @@ RSpec.describe FinApps::REST::DocumentsOrders do
|
|
|
263
321
|
|
|
264
322
|
context 'with invalid signature id' do
|
|
265
323
|
let(:signature_id) { :invalid_signature_id }
|
|
324
|
+
|
|
266
325
|
it { expect(results).to be_nil }
|
|
267
|
-
it { expect(error_messages).
|
|
326
|
+
it { expect(error_messages).not_to be_empty }
|
|
268
327
|
end
|
|
269
328
|
end
|
|
270
329
|
|
|
271
330
|
context 'with invalid order id' do
|
|
272
331
|
let(:order_id) { :invalid_order_id }
|
|
332
|
+
|
|
273
333
|
it { expect(results).to be_nil }
|
|
274
|
-
it { expect(error_messages).
|
|
334
|
+
it { expect(error_messages).not_to be_empty }
|
|
275
335
|
end
|
|
276
336
|
|
|
277
337
|
context 'with missing order id' do
|
|
278
338
|
let(:order_id) { nil }
|
|
339
|
+
|
|
279
340
|
it_behaves_like 'a request that raises an error'
|
|
280
341
|
end
|
|
281
342
|
|
|
282
343
|
context 'with missing signature id' do
|
|
283
344
|
let(:signature_id) { nil }
|
|
345
|
+
|
|
284
346
|
it_behaves_like 'a request that raises an error'
|
|
285
347
|
end
|
|
286
348
|
end
|
|
@@ -5,7 +5,8 @@ require 'rest/api_request'
|
|
|
5
5
|
|
|
6
6
|
RSpec.describe FinApps::REST::EsignTemplates do
|
|
7
7
|
include SpecHelpers::Client
|
|
8
|
-
subject(:templates) {
|
|
8
|
+
subject(:templates) { described_class.new(client).list }
|
|
9
|
+
|
|
9
10
|
let(:results) { templates[0] }
|
|
10
11
|
|
|
11
12
|
describe '#list' do
|
|
@@ -6,7 +6,7 @@ RSpec.describe FinApps::REST::OperatorsPasswordResets,
|
|
|
6
6
|
'initialized with valid FinApps::Client object' do
|
|
7
7
|
include SpecHelpers::Client
|
|
8
8
|
subject(:operators_password_resets) do
|
|
9
|
-
|
|
9
|
+
described_class.new(client)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
describe '#create' do
|
|
@@ -34,11 +34,13 @@ RSpec.describe FinApps::REST::OperatorsPasswordResets,
|
|
|
34
34
|
|
|
35
35
|
it { expect { create }.not_to raise_error }
|
|
36
36
|
it('returns an array') { expect(create).to be_a(Array) }
|
|
37
|
+
|
|
37
38
|
it('performs a post and returns the response') do
|
|
38
39
|
expect(results).to have_key(:public_id)
|
|
39
40
|
expect(results).to have_key(:token)
|
|
40
41
|
expect(results).to have_key(:expiry_date)
|
|
41
42
|
end
|
|
43
|
+
|
|
42
44
|
it('returns no error messages') { expect(error_messages).to be_empty }
|
|
43
45
|
end
|
|
44
46
|
end
|
|
@@ -60,6 +62,7 @@ RSpec.describe FinApps::REST::OperatorsPasswordResets,
|
|
|
60
62
|
|
|
61
63
|
it { expect { update }.not_to raise_error }
|
|
62
64
|
it('results is nil') { expect(results).to be_nil }
|
|
65
|
+
|
|
63
66
|
it('error messages array is populated') do
|
|
64
67
|
expect(error_messages.first.downcase).to eq('invalid request body')
|
|
65
68
|
end
|
|
@@ -70,10 +73,12 @@ RSpec.describe FinApps::REST::OperatorsPasswordResets,
|
|
|
70
73
|
|
|
71
74
|
it { expect { update }.not_to raise_error }
|
|
72
75
|
it('returns an array') { expect(update).to be_a(Array) }
|
|
76
|
+
|
|
73
77
|
it('performs a post and returns the response') do
|
|
74
78
|
expect(results).to have_key(:public_id)
|
|
75
79
|
expect(results).to have_key(:role)
|
|
76
80
|
end
|
|
81
|
+
|
|
77
82
|
it('returns no error messages') { expect(error_messages).to be_empty }
|
|
78
83
|
end
|
|
79
84
|
end
|
data/spec/rest/operators_spec.rb
CHANGED
|
@@ -5,7 +5,7 @@ require 'spec_helpers/client'
|
|
|
5
5
|
RSpec.describe FinApps::REST::Operators,
|
|
6
6
|
'initialized with valid FinApps::Client object' do
|
|
7
7
|
include SpecHelpers::Client
|
|
8
|
-
subject(:operators) {
|
|
8
|
+
subject(:operators) { described_class.new(client) }
|
|
9
9
|
|
|
10
10
|
describe '#list' do
|
|
11
11
|
let(:list) { subject.list(params) }
|
|
@@ -14,13 +14,17 @@ RSpec.describe FinApps::REST::Operators,
|
|
|
14
14
|
|
|
15
15
|
context 'when missing params' do
|
|
16
16
|
let(:params) { nil }
|
|
17
|
+
|
|
17
18
|
it { expect { list }.not_to raise_error }
|
|
19
|
+
|
|
18
20
|
it('performs a get and returns the response') do
|
|
19
21
|
expect(results).to have_key(:records)
|
|
20
22
|
end
|
|
23
|
+
|
|
21
24
|
it('returns an array of records') do
|
|
22
25
|
expect(results[:records]).to be_a(Array)
|
|
23
26
|
end
|
|
27
|
+
|
|
24
28
|
it('returns no error messages') { expect(error_messages).to be_empty }
|
|
25
29
|
end
|
|
26
30
|
|
|
@@ -42,13 +46,17 @@ RSpec.describe FinApps::REST::Operators,
|
|
|
42
46
|
end
|
|
43
47
|
|
|
44
48
|
it { expect { list }.not_to raise_error }
|
|
49
|
+
|
|
45
50
|
it('performs a get and returns the response') do
|
|
46
51
|
expect(results).to have_key(:records)
|
|
47
52
|
end
|
|
53
|
+
|
|
48
54
|
it('returns an array of records') do
|
|
49
55
|
expect(results[:records]).to be_a(Array)
|
|
50
56
|
end
|
|
57
|
+
|
|
51
58
|
it('returns no error messages') { expect(error_messages).to be_empty }
|
|
59
|
+
|
|
52
60
|
it 'builds query and sends proper request' do
|
|
53
61
|
list
|
|
54
62
|
url =
|
|
@@ -74,6 +82,7 @@ RSpec.describe FinApps::REST::Operators,
|
|
|
74
82
|
|
|
75
83
|
it { expect { show }.not_to raise_error }
|
|
76
84
|
it('results is nil') { expect(results).to be_nil }
|
|
85
|
+
|
|
77
86
|
it('error messages array is populated') do
|
|
78
87
|
expect(error_messages.first.downcase).to eq('resource not found')
|
|
79
88
|
end
|
|
@@ -84,9 +93,11 @@ RSpec.describe FinApps::REST::Operators,
|
|
|
84
93
|
|
|
85
94
|
it { expect { show }.not_to raise_error }
|
|
86
95
|
it('returns an array') { expect(show).to be_a(Array) }
|
|
96
|
+
|
|
87
97
|
it('performs a get and returns the response') do
|
|
88
98
|
expect(results).to have_key(:public_id)
|
|
89
99
|
end
|
|
100
|
+
|
|
90
101
|
it('returns no error messages') { expect(error_messages).to be_empty }
|
|
91
102
|
end
|
|
92
103
|
end
|
|
@@ -108,6 +119,7 @@ RSpec.describe FinApps::REST::Operators,
|
|
|
108
119
|
|
|
109
120
|
it { expect { create }.not_to raise_error }
|
|
110
121
|
it('results is nil') { expect(results).to be_nil }
|
|
122
|
+
|
|
111
123
|
it('error messages array is populated') do
|
|
112
124
|
expect(error_messages.first.downcase).to eq('invalid request body')
|
|
113
125
|
end
|
|
@@ -118,10 +130,12 @@ RSpec.describe FinApps::REST::Operators,
|
|
|
118
130
|
|
|
119
131
|
it { expect { create }.not_to raise_error }
|
|
120
132
|
it('returns an array') { expect(create).to be_a(Array) }
|
|
133
|
+
|
|
121
134
|
it('performs a post and returns the response') do
|
|
122
135
|
expect(results).to have_key(:public_id)
|
|
123
136
|
expect(results).to have_key(:role)
|
|
124
137
|
end
|
|
138
|
+
|
|
125
139
|
it('returns no error messages') { expect(error_messages).to be_empty }
|
|
126
140
|
end
|
|
127
141
|
end
|
|
@@ -151,6 +165,7 @@ RSpec.describe FinApps::REST::Operators,
|
|
|
151
165
|
|
|
152
166
|
it { expect { update }.not_to raise_error }
|
|
153
167
|
it('results is nil') { expect(results).to be_nil }
|
|
168
|
+
|
|
154
169
|
it('error messages array is populated') do
|
|
155
170
|
expect(error_messages.first.downcase).to eq('resource not found')
|
|
156
171
|
end
|
|
@@ -161,10 +176,12 @@ RSpec.describe FinApps::REST::Operators,
|
|
|
161
176
|
|
|
162
177
|
it { expect { update }.not_to raise_error }
|
|
163
178
|
it('returns an array') { expect(update).to be_a(Array) }
|
|
179
|
+
|
|
164
180
|
it('performs a put and returns the response') do
|
|
165
181
|
expect(results).to have_key(:email)
|
|
166
182
|
expect(results).to have_key(:role)
|
|
167
183
|
end
|
|
184
|
+
|
|
168
185
|
it('returns no error messages') { expect(error_messages).to be_empty }
|
|
169
186
|
end
|
|
170
187
|
end
|
|
@@ -195,16 +212,18 @@ RSpec.describe FinApps::REST::Operators,
|
|
|
195
212
|
|
|
196
213
|
context 'with valid params' do
|
|
197
214
|
let(:valid_params) do
|
|
198
|
-
{
|
|
215
|
+
{password: 'valid password', password_confirm: 'valid_password'}
|
|
199
216
|
end
|
|
200
217
|
let(:update_password) { subject.update_password(valid_params) }
|
|
201
218
|
|
|
202
219
|
it { expect { update_password }.not_to raise_error }
|
|
203
220
|
it('returns an array') { expect(update_password).to be_a(Array) }
|
|
221
|
+
|
|
204
222
|
it('performs a post and returns the response') do
|
|
205
223
|
expect(results).to have_key(:public_id)
|
|
206
224
|
expect(results).to have_key(:role)
|
|
207
225
|
end
|
|
226
|
+
|
|
208
227
|
it('returns no error messages') { expect(error_messages).to be_empty }
|
|
209
228
|
end
|
|
210
229
|
end
|
|
@@ -226,6 +245,7 @@ RSpec.describe FinApps::REST::Operators,
|
|
|
226
245
|
|
|
227
246
|
it { expect { destroy }.not_to raise_error }
|
|
228
247
|
it('results is nil') { expect(results).to be_nil }
|
|
248
|
+
|
|
229
249
|
it('error messages array is populated') do
|
|
230
250
|
expect(error_messages.first.downcase).to eq('resource not found')
|
|
231
251
|
end
|