finapps 5.0.34 → 5.0.43
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/release-drafter.yml +49 -0
- data/.github/workflows/main.yaml +5 -10
- data/.github/workflows/release-drafter.yml +15 -0
- data/.github/workflows/release.yml +54 -0
- data/.github/workflows/verify-pr-labeled.yml +14 -0
- data/.rubocop.yml +5 -12
- data/.rubocop_todo.yml +4 -95
- data/README.md +1 -0
- data/RELEASES.md +20 -0
- data/finapps.gemspec +0 -1
- data/lib/finapps.rb +2 -0
- data/lib/finapps/rest/client.rb +8 -5
- data/lib/finapps/rest/documents_orders.rb +1 -1
- data/lib/finapps/rest/documents_upload_types.rb +11 -0
- data/lib/finapps/rest/documents_uploads.rb +23 -0
- data/lib/finapps/rest/orders.rb +26 -15
- data/lib/finapps/rest/sessions.rb +10 -8
- data/lib/finapps/utils/query_builder.rb +13 -4
- data/lib/finapps/version.rb +1 -1
- data/spec/rest/alert_definitions_spec.rb +2 -6
- data/spec/rest/client_spec.rb +32 -40
- data/spec/rest/consumers_spec.rb +221 -220
- data/spec/rest/documents_orders_notifications_spec.rb +1 -1
- data/spec/rest/documents_orders_spec.rb +1 -1
- data/spec/rest/documents_upload_types_spec.rb +21 -0
- data/spec/rest/documents_uploads_spec.rb +104 -0
- data/spec/rest/operators_password_resets_spec.rb +49 -56
- data/spec/rest/operators_spec.rb +167 -178
- data/spec/rest/order_notifications_spec.rb +1 -1
- data/spec/rest/order_refreshes_spec.rb +2 -5
- data/spec/rest/order_reports_spec.rb +14 -14
- data/spec/rest/order_statuses_spec.rb +10 -10
- data/spec/rest/order_tokens_spec.rb +33 -32
- data/spec/rest/orders_spec.rb +78 -64
- data/spec/rest/password_resets_spec.rb +28 -28
- data/spec/rest/plaid/plaid_consumer_institutions_spec.rb +1 -1
- data/spec/rest/portfolios_alerts_spec.rb +3 -3
- data/spec/rest/portfolios_consumers_spec.rb +2 -2
- data/spec/rest/portfolios_spec.rb +6 -18
- data/spec/rest/products_spec.rb +16 -15
- data/spec/rest/sessions_spec.rb +61 -60
- data/spec/rest/signed_documents_downloads_spec.rb +8 -4
- data/spec/rest/verix/verix_documents_spec.rb +2 -2
- data/spec/rest/version_spec.rb +4 -4
- data/spec/support/fake_api.rb +16 -1
- data/spec/support/fixtures/upload_types.json +9 -0
- metadata +67 -77
- data/lib/tasks/releaser.rake +0 -12
@@ -29,7 +29,7 @@ RSpec.describe FinApps::REST::OrderNotifications do
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
context '
|
32
|
+
context 'with valid id' do
|
33
33
|
let(:update) { subject.update(:valid_id) }
|
34
34
|
let(:results) { update[RESULTS] }
|
35
35
|
let(:error_messages) { update[ERROR_MESSAGES] }
|
@@ -20,11 +20,8 @@ RSpec.describe FinApps::REST::OrderRefreshes do
|
|
20
20
|
|
21
21
|
it { expect { create }.not_to raise_error }
|
22
22
|
it('returns an array') { expect(create).to be_a(Array) }
|
23
|
-
|
24
|
-
it
|
25
|
-
expect(create[RESULTS]).to have_key(:public_id)
|
26
|
-
expect(create[RESULTS]).to have_key(:original_order_id)
|
27
|
-
end
|
23
|
+
it { expect(create[RESULTS]).to have_key(:public_id) }
|
24
|
+
it { expect(create[RESULTS]).to have_key(:original_order_id) }
|
28
25
|
|
29
26
|
it('returns no error messages') do
|
30
27
|
expect(create[ERROR_MESSAGES]).to be_empty
|
@@ -9,49 +9,49 @@ RSpec.describe FinApps::REST::OrderReports do
|
|
9
9
|
|
10
10
|
describe '#show' do
|
11
11
|
context 'when missing id' do
|
12
|
-
subject { order_report.show(nil, :pdf) }
|
12
|
+
subject(:show) { order_report.show(nil, :pdf) }
|
13
13
|
|
14
14
|
it do
|
15
|
-
expect {
|
15
|
+
expect { show }.to raise_error(FinAppsCore::MissingArgumentsError)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
19
|
context 'when missing format' do
|
20
|
-
subject { order_report.show(:valid_id, nil) }
|
20
|
+
subject(:show) { order_report.show(:valid_id, nil) }
|
21
21
|
|
22
22
|
it do
|
23
|
-
expect {
|
23
|
+
expect { show }.to raise_error(FinAppsCore::MissingArgumentsError)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
27
|
context 'when invalid format is provided' do
|
28
|
-
subject { order_report.show(:valid_id, :xml) }
|
28
|
+
subject(:show) { order_report.show(:valid_id, :xml) }
|
29
29
|
|
30
30
|
it do
|
31
|
-
expect {
|
31
|
+
expect { show }.to raise_error(FinAppsCore::InvalidArgumentsError)
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
35
|
context 'when valid params are provided' do
|
36
|
-
subject { order_report.show(:valid_id, :json) }
|
36
|
+
subject(:show) { order_report.show(:valid_id, :json) }
|
37
37
|
|
38
|
-
it { expect {
|
38
|
+
it { expect { show }.not_to raise_error }
|
39
39
|
|
40
40
|
it('performs a get and returns the response') do
|
41
|
-
expect(
|
41
|
+
expect(show[0]).to have_key(:days_requested)
|
42
42
|
end
|
43
43
|
|
44
|
-
it('returns no error messages') { expect(
|
44
|
+
it('returns no error messages') { expect(show[1]).to be_empty }
|
45
45
|
end
|
46
46
|
|
47
47
|
context 'when invalid id is provided' do
|
48
|
-
subject { order_report.show(:invalid_id, :json) }
|
48
|
+
subject(:show) { order_report.show(:invalid_id, :json) }
|
49
49
|
|
50
|
-
it { expect {
|
51
|
-
it('results is nil') { expect(
|
50
|
+
it { expect { show }.not_to raise_error }
|
51
|
+
it('results is nil') { expect(show[0]).to be_nil }
|
52
52
|
|
53
53
|
it('error messages array is populated') do
|
54
|
-
expect(
|
54
|
+
expect(show[1].first.downcase).to eq('resource not found')
|
55
55
|
end
|
56
56
|
end
|
57
57
|
end
|
@@ -5,35 +5,35 @@ RSpec.describe FinApps::REST::OrderStatuses do
|
|
5
5
|
|
6
6
|
describe '#show' do
|
7
7
|
context 'when missing id' do
|
8
|
-
subject { described_class.new(client).show(nil) }
|
8
|
+
subject(:show) { described_class.new(client).show(nil) }
|
9
9
|
|
10
10
|
it do
|
11
|
-
expect {
|
11
|
+
expect { show }.to raise_error(FinAppsCore::MissingArgumentsError)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
context 'when valid id is provided' do
|
16
|
-
subject { described_class.new(client).show(:valid_id) }
|
16
|
+
subject(:show) { described_class.new(client).show(:valid_id) }
|
17
17
|
|
18
|
-
it { expect {
|
18
|
+
it { expect { show }.not_to raise_error }
|
19
19
|
|
20
20
|
it('performs a get and returns the response') do
|
21
|
-
expect(
|
21
|
+
expect(show[RESULTS]).to have_key(:status)
|
22
22
|
end
|
23
23
|
|
24
24
|
it('returns no error messages') do
|
25
|
-
expect(
|
25
|
+
expect(show[ERROR_MESSAGES]).to be_empty
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
29
|
context 'when invalid id is provided' do
|
30
|
-
subject { described_class.new(client).show(:invalid_id) }
|
30
|
+
subject(:show) { described_class.new(client).show(:invalid_id) }
|
31
31
|
|
32
|
-
it { expect {
|
33
|
-
it('results is nil') { expect(
|
32
|
+
it { expect { show }.not_to raise_error }
|
33
|
+
it('results is nil') { expect(show[RESULTS]).to be_nil }
|
34
34
|
|
35
35
|
it('error messages array is populated') do
|
36
|
-
expect(
|
36
|
+
expect(show[ERROR_MESSAGES].first.downcase).to eq(
|
37
37
|
'resource not found'
|
38
38
|
)
|
39
39
|
end
|
@@ -2,46 +2,47 @@
|
|
2
2
|
|
3
3
|
require 'spec_helpers/client'
|
4
4
|
|
5
|
-
RSpec.describe FinApps::REST::OrderTokens
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
5
|
+
RSpec.describe FinApps::REST::OrderTokens do
|
6
|
+
context 'when initialized with valid FinApps::Client object' do
|
7
|
+
include SpecHelpers::Client
|
8
|
+
|
9
|
+
describe '#show' do
|
10
|
+
subject(:order_tokens) { described_class.new(client) }
|
11
|
+
|
12
|
+
let(:results) { show[RESULTS] }
|
13
|
+
let(:error_messages) { show[ERROR_MESSAGES] }
|
14
|
+
|
15
|
+
context 'when missing token' do
|
16
|
+
it do
|
17
|
+
expect { order_tokens.show(nil) }.to raise_error(
|
18
|
+
FinAppsCore::MissingArgumentsError,
|
19
|
+
': token'
|
20
|
+
)
|
21
|
+
end
|
21
22
|
end
|
22
|
-
end
|
23
23
|
|
24
|
-
|
25
|
-
|
24
|
+
context 'with valid token' do
|
25
|
+
let(:show) { subject.show(:valid_token) }
|
26
26
|
|
27
|
-
|
28
|
-
|
27
|
+
it { expect { show }.not_to raise_error }
|
28
|
+
it('results is a Hash') { expect(results).to be_a(Hash) }
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
it('results contains a consumer_id') do
|
31
|
+
expect(results).to have_key(:consumer_id)
|
32
|
+
end
|
33
33
|
|
34
|
-
|
35
|
-
|
34
|
+
it('error_messages array is empty') { expect(error_messages).to eq([]) }
|
35
|
+
end
|
36
36
|
|
37
|
-
|
38
|
-
|
37
|
+
context 'with invalid token' do
|
38
|
+
let(:show) { subject.show(:invalid_token) }
|
39
39
|
|
40
|
-
|
41
|
-
|
40
|
+
it { expect { show }.not_to raise_error }
|
41
|
+
it('results is nil') { expect(results).to be_nil }
|
42
42
|
|
43
|
-
|
44
|
-
|
43
|
+
it('error messages array is populated') do
|
44
|
+
expect(error_messages.first.downcase).to eq('resource not found')
|
45
|
+
end
|
45
46
|
end
|
46
47
|
end
|
47
48
|
end
|
data/spec/rest/orders_spec.rb
CHANGED
@@ -7,69 +7,63 @@ RSpec.describe FinApps::REST::Orders do
|
|
7
7
|
|
8
8
|
describe '#show' do
|
9
9
|
context 'when missing params' do
|
10
|
-
subject { described_class.new(client).show(nil) }
|
10
|
+
subject(:show) { described_class.new(client).show(nil) }
|
11
11
|
|
12
12
|
it do
|
13
|
-
expect {
|
13
|
+
expect { show }.to raise_error(FinAppsCore::MissingArgumentsError)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
17
|
context 'when valid params are provided' do
|
18
|
-
subject { described_class.new(client).show(:valid_id) }
|
18
|
+
subject(:show) { described_class.new(client).show(:valid_id) }
|
19
19
|
|
20
|
-
it { expect {
|
21
|
-
it('returns an array') { expect(
|
22
|
-
|
23
|
-
it
|
24
|
-
expect(subject[RESULTS]).to have_key(:public_id)
|
25
|
-
expect(subject[RESULTS]).to have_key(:consumer_id)
|
26
|
-
end
|
20
|
+
it { expect { show }.not_to raise_error }
|
21
|
+
it('returns an array') { expect(show).to be_a(Array) }
|
22
|
+
it { expect(show[RESULTS]).to have_key(:public_id) }
|
23
|
+
it { expect(show[RESULTS]).to have_key(:consumer_id) }
|
27
24
|
|
28
25
|
it('returns no error messages') do
|
29
|
-
expect(
|
26
|
+
expect(show[ERROR_MESSAGES]).to be_empty
|
30
27
|
end
|
31
28
|
end
|
32
29
|
end
|
33
30
|
|
34
31
|
describe '#create' do
|
35
32
|
context 'when missing params' do
|
36
|
-
subject { described_class.new(client).create(nil) }
|
33
|
+
subject(:create) { described_class.new(client).create(nil) }
|
37
34
|
|
38
35
|
it do
|
39
|
-
expect {
|
36
|
+
expect { create }.to raise_error(FinAppsCore::MissingArgumentsError)
|
40
37
|
end
|
41
38
|
end
|
42
39
|
|
43
40
|
context 'when valid params are provided' do
|
44
|
-
subject { described_class.new(client).create(valid_params) }
|
41
|
+
subject(:create) { described_class.new(client).create(valid_params) }
|
45
42
|
|
46
43
|
let(:valid_params) do
|
47
44
|
{applicant: 'valid', institutions: 'valid', product: 'valid'}
|
48
45
|
end
|
49
46
|
|
50
|
-
it { expect {
|
51
|
-
it('returns an array') { expect(
|
52
|
-
|
53
|
-
it
|
54
|
-
expect(subject[RESULTS]).to have_key(:public_id)
|
55
|
-
expect(subject[RESULTS]).to have_key(:consumer_id)
|
56
|
-
end
|
47
|
+
it { expect { create }.not_to raise_error }
|
48
|
+
it('returns an array') { expect(create).to be_a(Array) }
|
49
|
+
it { expect(create[RESULTS]).to have_key(:public_id) }
|
50
|
+
it { expect(create[RESULTS]).to have_key(:consumer_id) }
|
57
51
|
|
58
52
|
it('returns no error messages') do
|
59
|
-
expect(
|
53
|
+
expect(create[ERROR_MESSAGES]).to be_empty
|
60
54
|
end
|
61
55
|
end
|
62
56
|
|
63
57
|
context 'when invalid params are provided' do
|
64
|
-
subject { described_class.new(client).create(invalid_params) }
|
58
|
+
subject(:create) { described_class.new(client).create(invalid_params) }
|
65
59
|
|
66
60
|
let(:invalid_params) { {applicant: 'valid'} }
|
67
61
|
|
68
|
-
it { expect {
|
69
|
-
it('results is nil') { expect(
|
62
|
+
it { expect { create }.not_to raise_error }
|
63
|
+
it('results is nil') { expect(create[RESULTS]).to be_nil }
|
70
64
|
|
71
65
|
it('error messages array is populated') do
|
72
|
-
expect(
|
66
|
+
expect(create[ERROR_MESSAGES].first.downcase).to eq(
|
73
67
|
'invalid request body'
|
74
68
|
)
|
75
69
|
end
|
@@ -80,33 +74,33 @@ RSpec.describe FinApps::REST::Orders do
|
|
80
74
|
context 'when missing params' do
|
81
75
|
# use defaults
|
82
76
|
|
83
|
-
subject { described_class.new(client).list }
|
77
|
+
subject(:list) { described_class.new(client).list }
|
84
78
|
|
85
|
-
it { expect {
|
79
|
+
it { expect { list }.not_to raise_error }
|
86
80
|
|
87
|
-
it('returns an array') { expect(
|
81
|
+
it('returns an array') { expect(list).to be_a(Array) }
|
88
82
|
|
89
83
|
it('performs a get and returns the response') do
|
90
|
-
expect(
|
84
|
+
expect(list[RESULTS]).to have_key(:orders)
|
91
85
|
end
|
92
86
|
|
93
87
|
it('returns no error messages') do
|
94
|
-
expect(
|
88
|
+
expect(list[ERROR_MESSAGES]).to be_empty
|
95
89
|
end
|
96
90
|
end
|
97
91
|
|
98
92
|
context 'when invalid params are provided' do
|
99
|
-
subject { described_class.new(client).list(invalid_params) }
|
93
|
+
subject(:list) { described_class.new(client).list(invalid_params) }
|
100
94
|
|
101
95
|
let(:invalid_params) { %w[this is an array] }
|
102
96
|
|
103
97
|
it do
|
104
|
-
expect {
|
98
|
+
expect { list }.to raise_error(FinAppsCore::InvalidArgumentsError)
|
105
99
|
end
|
106
100
|
end
|
107
101
|
|
108
102
|
context 'when including valid params' do
|
109
|
-
subject { described_class.new(client).list(params) }
|
103
|
+
subject(:list) { described_class.new(client).list(params) }
|
110
104
|
|
111
105
|
let(:params) do
|
112
106
|
{
|
@@ -121,40 +115,37 @@ RSpec.describe FinApps::REST::Orders do
|
|
121
115
|
}
|
122
116
|
end
|
123
117
|
|
124
|
-
it { expect {
|
125
|
-
it('returns an array') { expect(
|
118
|
+
it { expect { list }.not_to raise_error }
|
119
|
+
it('returns an array') { expect(list).to be_a(Array) }
|
126
120
|
|
127
121
|
it('performs a get and returns the response') do
|
128
|
-
expect(
|
122
|
+
expect(list[RESULTS]).to have_key(:orders)
|
129
123
|
end
|
130
124
|
|
131
125
|
it('each order contains a consumer_id') do
|
132
|
-
expect(
|
126
|
+
expect(list[RESULTS][:orders]).to all(have_key(:consumer_id))
|
133
127
|
end
|
134
128
|
|
135
129
|
it('returns no error messages') do
|
136
|
-
expect(
|
130
|
+
expect(list[ERROR_MESSAGES]).to be_empty
|
137
131
|
end
|
138
132
|
|
139
133
|
it 'builds query and sends proper request' do
|
140
|
-
|
134
|
+
list
|
141
135
|
url = "#{versioned_api_path}/orders?"\
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
'%22assignment.operator_id%22:%22valid_operator%22,'\
|
150
|
-
'%22consumer_id%22:%22valid_consumer_id%22%7D' \
|
151
|
-
'&page=2&requested=25&sort=status'
|
136
|
+
'filter=%7B%22$or%22:%5B%7B%22public_id%22:%7B%22$regex%22:%22%5E'\
|
137
|
+
'term%22,%22$options%22:%22i%22%7D%7D,%7B%22assignment.last_name%22:%22'\
|
138
|
+
'term%22%7D,%7B%22applicant.first_name%22:%22term%22%7D,%7B%22'\
|
139
|
+
'applicant.last_name%22:%22term%22%7D,%7B%22requestor.reference_no'\
|
140
|
+
'%22:%7B%22$regex%22:%22%5Eterm%22,%22$options%22:%22i%22%7D%7D%5D,%22'\
|
141
|
+
'status%22:%7B%22$in%22:%5B1,7%5D%7D,%22assignment.operator_id%22:%22'\
|
142
|
+
'valid_operator%22,%22consumer_id%22:%22valid_consumer_id%22%7D&page=2&requested=25&sort=status'
|
152
143
|
expect(WebMock).to have_requested(:get, url)
|
153
144
|
end
|
154
145
|
|
155
146
|
it 'builds query and sends proper request with searchTerm/relation exclusivity' do
|
156
147
|
params[:searchTerm] = nil
|
157
|
-
|
148
|
+
list
|
158
149
|
url = "#{versioned_api_path}/orders?"\
|
159
150
|
'filter=%7B%22status%22:%7B%22$in%22:%5B1,7%5D%7D,' \
|
160
151
|
'%22assignment.operator_id%22:%22valid_operator%22,'\
|
@@ -165,6 +156,23 @@ RSpec.describe FinApps::REST::Orders do
|
|
165
156
|
expect(WebMock).to have_requested(:get, url)
|
166
157
|
end
|
167
158
|
|
159
|
+
it 'handles space in search term for consumer' do
|
160
|
+
params[:searchTerm] = 'Spacing Out'
|
161
|
+
list
|
162
|
+
url = "#{versioned_api_path}/orders?"\
|
163
|
+
'filter=%7B%22$or%22:%5B%7B%22public_id%22:%7B%22$regex%22:%22%5E'\
|
164
|
+
'Spacing%20Out%22,%22$options%22:%22i%22%7D%7D,%7B%22assignment.last_name'\
|
165
|
+
'%22:%22Spacing%20Out%22%7D,%7B%22applicant.first_name%22:%22'\
|
166
|
+
'Spacing%20Out%22%7D,%7B%22applicant.last_name%22:%22Spacing%20Out'\
|
167
|
+
'%22%7D,%7B%22requestor.reference_no%22:%7B%22$regex%22:%22%5ESpacing%20Out'\
|
168
|
+
'%22,%22$options%22:%22i%22%7D%7D,%7B%22applicant.first_name%22:%22Spacing'\
|
169
|
+
'%22%7D,%7B%22applicant.last_name%22:%22Spacing%22%7D,%7B%22applicant.first_name'\
|
170
|
+
'%22:%22Out%22%7D,%7B%22applicant.last_name%22:%22Out%22%7D%5D,%22status'\
|
171
|
+
'%22:%7B%22$in%22:%5B1,7%5D%7D,%22assignment.operator_id%22:%22valid_operator'\
|
172
|
+
'%22,%22consumer_id%22:%22valid_consumer_id%22%7D&page=2&requested=25&sort=status'
|
173
|
+
expect(WebMock).to have_requested(:get, url)
|
174
|
+
end
|
175
|
+
|
168
176
|
it 'builds null assignment query properly when supplied w/ empty string' do
|
169
177
|
described_class.new(client).list(assignment: '')
|
170
178
|
|
@@ -180,7 +188,7 @@ RSpec.describe FinApps::REST::Orders do
|
|
180
188
|
|
181
189
|
context 'with nil params' do
|
182
190
|
context 'when missing id' do
|
183
|
-
let(:update) {
|
191
|
+
let(:update) { orders.update(nil) }
|
184
192
|
|
185
193
|
it('returns missing argument error') do
|
186
194
|
expect { update }.to raise_error(FinAppsCore::MissingArgumentsError)
|
@@ -188,7 +196,7 @@ RSpec.describe FinApps::REST::Orders do
|
|
188
196
|
end
|
189
197
|
|
190
198
|
context 'when valid id is provided' do
|
191
|
-
let(:update) {
|
199
|
+
let(:update) { orders.update('valid_id') } # how to stub params
|
192
200
|
let(:results) { update[RESULTS] }
|
193
201
|
let(:error_messages) { update[ERROR_MESSAGES] }
|
194
202
|
|
@@ -198,7 +206,7 @@ RSpec.describe FinApps::REST::Orders do
|
|
198
206
|
end
|
199
207
|
|
200
208
|
context 'when invalid id is provided' do
|
201
|
-
let(:update) {
|
209
|
+
let(:update) { orders.update('invalid_id') }
|
202
210
|
let(:results) { update[RESULTS] }
|
203
211
|
let(:error_messages) { update[ERROR_MESSAGES] }
|
204
212
|
|
@@ -213,7 +221,7 @@ RSpec.describe FinApps::REST::Orders do
|
|
213
221
|
|
214
222
|
context 'with params' do
|
215
223
|
context 'when missing id' do
|
216
|
-
let(:update) {
|
224
|
+
let(:update) { orders.update(nil, params: 'valid') }
|
217
225
|
|
218
226
|
it('does not raise error') do
|
219
227
|
expect { update }.not_to raise_error
|
@@ -221,7 +229,7 @@ RSpec.describe FinApps::REST::Orders do
|
|
221
229
|
end
|
222
230
|
|
223
231
|
context 'when valid params are provided' do
|
224
|
-
let(:update) {
|
232
|
+
let(:update) { orders.update(nil, params: 'valid') }
|
225
233
|
let(:results) { update[RESULTS] }
|
226
234
|
let(:error_messages) { update[ERROR_MESSAGES] }
|
227
235
|
|
@@ -231,7 +239,7 @@ RSpec.describe FinApps::REST::Orders do
|
|
231
239
|
end
|
232
240
|
|
233
241
|
context 'when invalid params are provided' do
|
234
|
-
let(:update) {
|
242
|
+
let(:update) { orders.update(nil, params: 'invalid') }
|
235
243
|
let(:results) { update[RESULTS] }
|
236
244
|
let(:error_messages) { update[ERROR_MESSAGES] }
|
237
245
|
|
@@ -245,14 +253,20 @@ RSpec.describe FinApps::REST::Orders do
|
|
245
253
|
end
|
246
254
|
end
|
247
255
|
|
256
|
+
# Test it calls update while making rubocop happy
|
248
257
|
describe '#create_and_submit' do
|
249
258
|
subject(:orders) { described_class.new(client) }
|
250
259
|
|
260
|
+
let(:create_submit) { orders.create_and_submit(params) }
|
251
261
|
let(:params) { {params: 'valid'} }
|
262
|
+
let(:results) { create_submit[RESULTS] }
|
263
|
+
let(:error_messages) { create_submit[ERROR_MESSAGES] }
|
264
|
+
|
265
|
+
it { expect { create_submit }.not_to raise_error }
|
266
|
+
it('results is nil') { expect(results).to be_nil }
|
252
267
|
|
253
|
-
it('
|
254
|
-
expect(
|
255
|
-
subject.create_and_submit(params)
|
268
|
+
it('error messages array is empty') do
|
269
|
+
expect(error_messages).to eq([])
|
256
270
|
end
|
257
271
|
end
|
258
272
|
|
@@ -260,7 +274,7 @@ RSpec.describe FinApps::REST::Orders do
|
|
260
274
|
subject(:orders) { described_class.new(client) }
|
261
275
|
|
262
276
|
context 'when missing id' do
|
263
|
-
let(:destroy) {
|
277
|
+
let(:destroy) { orders.destroy(nil) }
|
264
278
|
|
265
279
|
it('returns missing argument error') do
|
266
280
|
expect { destroy }.to raise_error(FinAppsCore::MissingArgumentsError)
|
@@ -268,7 +282,7 @@ RSpec.describe FinApps::REST::Orders do
|
|
268
282
|
end
|
269
283
|
|
270
284
|
context 'when invalid id is provided' do
|
271
|
-
let(:destroy) {
|
285
|
+
let(:destroy) { orders.destroy(:invalid_id) }
|
272
286
|
let(:results) { destroy[RESULTS] }
|
273
287
|
let(:error_messages) { destroy[ERROR_MESSAGES] }
|
274
288
|
|
@@ -280,8 +294,8 @@ RSpec.describe FinApps::REST::Orders do
|
|
280
294
|
end
|
281
295
|
end
|
282
296
|
|
283
|
-
context '
|
284
|
-
let(:destroy) {
|
297
|
+
context 'with valid id' do
|
298
|
+
let(:destroy) { orders.destroy(:valid_id) }
|
285
299
|
let(:results) { destroy[RESULTS] }
|
286
300
|
let(:error_messages) { destroy[ERROR_MESSAGES] }
|
287
301
|
|