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,12 +6,14 @@ RSpec.describe FinApps::REST::OrderAssignments do
|
|
|
6
6
|
include SpecHelpers::Client
|
|
7
7
|
|
|
8
8
|
describe '#update' do
|
|
9
|
-
subject(:order_assignments) {
|
|
9
|
+
subject(:order_assignments) { described_class.new(client) }
|
|
10
|
+
|
|
10
11
|
let(:results) { update[RESULTS] }
|
|
11
12
|
let(:error_messages) { update[ERROR_MESSAGES] }
|
|
12
13
|
|
|
13
14
|
context 'when missing id' do
|
|
14
15
|
let(:update) { subject.update(nil, []) }
|
|
16
|
+
|
|
15
17
|
it('returns missing argument error') do
|
|
16
18
|
expect { update }.to raise_error(FinAppsCore::MissingArgumentsError)
|
|
17
19
|
end
|
|
@@ -19,6 +21,7 @@ RSpec.describe FinApps::REST::OrderAssignments do
|
|
|
19
21
|
|
|
20
22
|
context 'when missing params' do
|
|
21
23
|
let(:update) { subject.update(:valid_id, nil) }
|
|
24
|
+
|
|
22
25
|
it('returns missing argument error') do
|
|
23
26
|
expect { update }.to raise_error(FinAppsCore::MissingArgumentsError)
|
|
24
27
|
end
|
|
@@ -26,6 +29,7 @@ RSpec.describe FinApps::REST::OrderAssignments do
|
|
|
26
29
|
|
|
27
30
|
context 'with invalid params' do
|
|
28
31
|
let(:update) { subject.update(:valid_id, params: 'params') }
|
|
32
|
+
|
|
29
33
|
it('returns invalid argument error') do
|
|
30
34
|
expect { update }.to raise_error(FinAppsCore::InvalidArgumentsError)
|
|
31
35
|
end
|
|
@@ -36,6 +40,7 @@ RSpec.describe FinApps::REST::OrderAssignments do
|
|
|
36
40
|
|
|
37
41
|
it { expect { update }.not_to raise_error }
|
|
38
42
|
it('results is nil') { expect(results).to be_nil }
|
|
43
|
+
|
|
39
44
|
it('error messages array is populated') do
|
|
40
45
|
expect(error_messages.first.downcase).to eq('resource not found')
|
|
41
46
|
end
|
|
@@ -6,10 +6,11 @@ RSpec.describe FinApps::REST::OrderNotifications do
|
|
|
6
6
|
include SpecHelpers::Client
|
|
7
7
|
|
|
8
8
|
describe '#update' do
|
|
9
|
-
subject(:orders) {
|
|
9
|
+
subject(:orders) { described_class.new(client) }
|
|
10
10
|
|
|
11
11
|
context 'when missing id' do
|
|
12
12
|
let(:update) { subject.update(nil) }
|
|
13
|
+
|
|
13
14
|
it('returns missing argument error') do
|
|
14
15
|
expect { update }.to raise_error(FinAppsCore::MissingArgumentsError)
|
|
15
16
|
end
|
|
@@ -22,6 +23,7 @@ RSpec.describe FinApps::REST::OrderNotifications do
|
|
|
22
23
|
|
|
23
24
|
it { expect { update }.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('resource not found')
|
|
27
29
|
end
|
|
@@ -4,11 +4,12 @@ require 'spec_helpers/client'
|
|
|
4
4
|
|
|
5
5
|
RSpec.describe FinApps::REST::OrderRefreshes do
|
|
6
6
|
include SpecHelpers::Client
|
|
7
|
-
subject {
|
|
7
|
+
subject { described_class.new(client) }
|
|
8
8
|
|
|
9
9
|
describe '#create' do
|
|
10
10
|
context 'when missing id' do
|
|
11
11
|
let(:create) { subject.create(nil) }
|
|
12
|
+
|
|
12
13
|
it do
|
|
13
14
|
expect { create }.to raise_error(FinAppsCore::MissingArgumentsError)
|
|
14
15
|
end
|
|
@@ -16,12 +17,15 @@ RSpec.describe FinApps::REST::OrderRefreshes do
|
|
|
16
17
|
|
|
17
18
|
context 'when valid id is provided' do
|
|
18
19
|
let(:create) { subject.create(:valid_id) }
|
|
20
|
+
|
|
19
21
|
it { expect { create }.not_to raise_error }
|
|
20
22
|
it('returns an array') { expect(create).to be_a(Array) }
|
|
23
|
+
|
|
21
24
|
it('performs a post and returns new refreshed order response') do
|
|
22
25
|
expect(create[RESULTS]).to have_key(:public_id)
|
|
23
26
|
expect(create[RESULTS]).to have_key(:original_order_id)
|
|
24
27
|
end
|
|
28
|
+
|
|
25
29
|
it('returns no error messages') do
|
|
26
30
|
expect(create[ERROR_MESSAGES]).to be_empty
|
|
27
31
|
end
|
|
@@ -29,9 +33,11 @@ RSpec.describe FinApps::REST::OrderRefreshes do
|
|
|
29
33
|
|
|
30
34
|
context 'when invalid id is provided' do
|
|
31
35
|
let(:create) { subject.create(:invalid_id) }
|
|
36
|
+
|
|
32
37
|
it { expect { create }.not_to raise_error }
|
|
33
38
|
it('returns an array') { expect(create).to be_a(Array) }
|
|
34
39
|
it('results is nil') { expect(create[RESULTS]).to be_nil }
|
|
40
|
+
|
|
35
41
|
it('error messages array is populated') do
|
|
36
42
|
expect(create[ERROR_MESSAGES].first.downcase).to eq(
|
|
37
43
|
'resource not found'
|
|
@@ -5,11 +5,12 @@ require 'spec_helpers/client'
|
|
|
5
5
|
RSpec.describe FinApps::REST::OrderReports do
|
|
6
6
|
include SpecHelpers::Client
|
|
7
7
|
|
|
8
|
-
let(:order_report) {
|
|
8
|
+
let(:order_report) { described_class.new client }
|
|
9
9
|
|
|
10
10
|
describe '#show' do
|
|
11
11
|
context 'when missing id' do
|
|
12
12
|
subject { order_report.show(nil, :pdf) }
|
|
13
|
+
|
|
13
14
|
it do
|
|
14
15
|
expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError)
|
|
15
16
|
end
|
|
@@ -17,6 +18,7 @@ RSpec.describe FinApps::REST::OrderReports do
|
|
|
17
18
|
|
|
18
19
|
context 'when missing format' do
|
|
19
20
|
subject { order_report.show(:valid_id, nil) }
|
|
21
|
+
|
|
20
22
|
it do
|
|
21
23
|
expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError)
|
|
22
24
|
end
|
|
@@ -24,6 +26,7 @@ RSpec.describe FinApps::REST::OrderReports do
|
|
|
24
26
|
|
|
25
27
|
context 'when invalid format is provided' do
|
|
26
28
|
subject { order_report.show(:valid_id, :xml) }
|
|
29
|
+
|
|
27
30
|
it do
|
|
28
31
|
expect { subject }.to raise_error(FinAppsCore::InvalidArgumentsError)
|
|
29
32
|
end
|
|
@@ -33,9 +36,11 @@ RSpec.describe FinApps::REST::OrderReports do
|
|
|
33
36
|
subject { order_report.show(:valid_id, :json) }
|
|
34
37
|
|
|
35
38
|
it { expect { subject }.not_to raise_error }
|
|
39
|
+
|
|
36
40
|
it('performs a get and returns the response') do
|
|
37
41
|
expect(subject[0]).to have_key(:days_requested)
|
|
38
42
|
end
|
|
43
|
+
|
|
39
44
|
it('returns no error messages') { expect(subject[1]).to be_empty }
|
|
40
45
|
end
|
|
41
46
|
|
|
@@ -44,6 +49,7 @@ RSpec.describe FinApps::REST::OrderReports do
|
|
|
44
49
|
|
|
45
50
|
it { expect { subject }.not_to raise_error }
|
|
46
51
|
it('results is nil') { expect(subject[0]).to be_nil }
|
|
52
|
+
|
|
47
53
|
it('error messages array is populated') do
|
|
48
54
|
expect(subject[1].first.downcase).to eq('resource not found')
|
|
49
55
|
end
|
|
@@ -5,29 +5,33 @@ RSpec.describe FinApps::REST::OrderStatuses do
|
|
|
5
5
|
|
|
6
6
|
describe '#show' do
|
|
7
7
|
context 'when missing id' do
|
|
8
|
-
subject {
|
|
8
|
+
subject { described_class.new(client).show(nil) }
|
|
9
|
+
|
|
9
10
|
it do
|
|
10
11
|
expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError)
|
|
11
12
|
end
|
|
12
13
|
end
|
|
13
14
|
|
|
14
15
|
context 'when valid id is provided' do
|
|
15
|
-
subject {
|
|
16
|
+
subject { described_class.new(client).show(:valid_id) }
|
|
16
17
|
|
|
17
18
|
it { expect { subject }.not_to raise_error }
|
|
19
|
+
|
|
18
20
|
it('performs a get and returns the response') do
|
|
19
21
|
expect(subject[RESULTS]).to have_key(:status)
|
|
20
22
|
end
|
|
23
|
+
|
|
21
24
|
it('returns no error messages') do
|
|
22
25
|
expect(subject[ERROR_MESSAGES]).to be_empty
|
|
23
26
|
end
|
|
24
27
|
end
|
|
25
28
|
|
|
26
29
|
context 'when invalid id is provided' do
|
|
27
|
-
subject {
|
|
30
|
+
subject { described_class.new(client).show(:invalid_id) }
|
|
28
31
|
|
|
29
32
|
it { expect { subject }.not_to raise_error }
|
|
30
33
|
it('results is nil') { expect(subject[RESULTS]).to be_nil }
|
|
34
|
+
|
|
31
35
|
it('error messages array is populated') do
|
|
32
36
|
expect(subject[ERROR_MESSAGES].first.downcase).to eq(
|
|
33
37
|
'resource not found'
|
|
@@ -7,7 +7,8 @@ RSpec.describe FinApps::REST::OrderTokens,
|
|
|
7
7
|
include SpecHelpers::Client
|
|
8
8
|
|
|
9
9
|
describe '#show' do
|
|
10
|
-
subject(:order_tokens) {
|
|
10
|
+
subject(:order_tokens) { described_class.new(client) }
|
|
11
|
+
|
|
11
12
|
let(:results) { show[RESULTS] }
|
|
12
13
|
let(:error_messages) { show[ERROR_MESSAGES] }
|
|
13
14
|
|
|
@@ -22,18 +23,23 @@ RSpec.describe FinApps::REST::OrderTokens,
|
|
|
22
23
|
|
|
23
24
|
context 'for valid token' do
|
|
24
25
|
let(:show) { subject.show(:valid_token) }
|
|
26
|
+
|
|
25
27
|
it { expect { show }.not_to raise_error }
|
|
26
28
|
it('results is a Hash') { expect(results).to be_a(Hash) }
|
|
29
|
+
|
|
27
30
|
it('results contains a consumer_id') do
|
|
28
31
|
expect(results).to have_key(:consumer_id)
|
|
29
32
|
end
|
|
33
|
+
|
|
30
34
|
it('error_messages array is empty') { expect(error_messages).to eq([]) }
|
|
31
35
|
end
|
|
32
36
|
|
|
33
37
|
context 'for invalid token' do
|
|
34
38
|
let(:show) { subject.show(:invalid_token) }
|
|
39
|
+
|
|
35
40
|
it { expect { show }.not_to raise_error }
|
|
36
41
|
it('results is nil') { expect(results).to be_nil }
|
|
42
|
+
|
|
37
43
|
it('error messages array is populated') do
|
|
38
44
|
expect(error_messages.first.downcase).to eq('resource not found')
|
|
39
45
|
end
|
data/spec/rest/orders_spec.rb
CHANGED
|
@@ -7,21 +7,24 @@ RSpec.describe FinApps::REST::Orders do
|
|
|
7
7
|
|
|
8
8
|
describe '#show' do
|
|
9
9
|
context 'when missing params' do
|
|
10
|
-
subject {
|
|
10
|
+
subject { described_class.new(client).show(nil) }
|
|
11
|
+
|
|
11
12
|
it do
|
|
12
13
|
expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError)
|
|
13
14
|
end
|
|
14
15
|
end
|
|
15
16
|
|
|
16
17
|
context 'when valid params are provided' do
|
|
17
|
-
subject {
|
|
18
|
+
subject { described_class.new(client).show(:valid_id) }
|
|
18
19
|
|
|
19
20
|
it { expect { subject }.not_to raise_error }
|
|
20
21
|
it('returns an array') { expect(subject).to be_a(Array) }
|
|
22
|
+
|
|
21
23
|
it('performs a get and returns the response') do
|
|
22
24
|
expect(subject[RESULTS]).to have_key(:public_id)
|
|
23
25
|
expect(subject[RESULTS]).to have_key(:consumer_id)
|
|
24
26
|
end
|
|
27
|
+
|
|
25
28
|
it('returns no error messages') do
|
|
26
29
|
expect(subject[ERROR_MESSAGES]).to be_empty
|
|
27
30
|
end
|
|
@@ -30,35 +33,41 @@ RSpec.describe FinApps::REST::Orders do
|
|
|
30
33
|
|
|
31
34
|
describe '#create' do
|
|
32
35
|
context 'when missing params' do
|
|
33
|
-
subject {
|
|
36
|
+
subject { described_class.new(client).create(nil) }
|
|
37
|
+
|
|
34
38
|
it do
|
|
35
39
|
expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError)
|
|
36
40
|
end
|
|
37
41
|
end
|
|
38
42
|
|
|
39
43
|
context 'when valid params are provided' do
|
|
40
|
-
subject {
|
|
44
|
+
subject { described_class.new(client).create(valid_params) }
|
|
45
|
+
|
|
41
46
|
let(:valid_params) do
|
|
42
|
-
{
|
|
47
|
+
{applicant: 'valid', institutions: 'valid', product: 'valid'}
|
|
43
48
|
end
|
|
44
49
|
|
|
45
50
|
it { expect { subject }.not_to raise_error }
|
|
46
51
|
it('returns an array') { expect(subject).to be_a(Array) }
|
|
52
|
+
|
|
47
53
|
it('performs a post and returns the response') do
|
|
48
54
|
expect(subject[RESULTS]).to have_key(:public_id)
|
|
49
55
|
expect(subject[RESULTS]).to have_key(:consumer_id)
|
|
50
56
|
end
|
|
57
|
+
|
|
51
58
|
it('returns no error messages') do
|
|
52
59
|
expect(subject[ERROR_MESSAGES]).to be_empty
|
|
53
60
|
end
|
|
54
61
|
end
|
|
55
62
|
|
|
56
63
|
context 'when invalid params are provided' do
|
|
57
|
-
subject {
|
|
58
|
-
|
|
64
|
+
subject { described_class.new(client).create(invalid_params) }
|
|
65
|
+
|
|
66
|
+
let(:invalid_params) { {applicant: 'valid'} }
|
|
59
67
|
|
|
60
68
|
it { expect { subject }.not_to raise_error }
|
|
61
69
|
it('results is nil') { expect(subject[RESULTS]).to be_nil }
|
|
70
|
+
|
|
62
71
|
it('error messages array is populated') do
|
|
63
72
|
expect(subject[ERROR_MESSAGES].first.downcase).to eq(
|
|
64
73
|
'invalid request body'
|
|
@@ -71,20 +80,24 @@ RSpec.describe FinApps::REST::Orders do
|
|
|
71
80
|
context 'when missing params' do
|
|
72
81
|
# use defaults
|
|
73
82
|
|
|
74
|
-
subject {
|
|
83
|
+
subject { described_class.new(client).list }
|
|
84
|
+
|
|
75
85
|
it { expect { subject }.not_to raise_error }
|
|
76
86
|
|
|
77
87
|
it('returns an array') { expect(subject).to be_a(Array) }
|
|
88
|
+
|
|
78
89
|
it('performs a get and returns the response') do
|
|
79
90
|
expect(subject[RESULTS]).to have_key(:orders)
|
|
80
91
|
end
|
|
92
|
+
|
|
81
93
|
it('returns no error messages') do
|
|
82
94
|
expect(subject[ERROR_MESSAGES]).to be_empty
|
|
83
95
|
end
|
|
84
96
|
end
|
|
85
97
|
|
|
86
98
|
context 'when invalid params are provided' do
|
|
87
|
-
subject {
|
|
99
|
+
subject { described_class.new(client).list(invalid_params) }
|
|
100
|
+
|
|
88
101
|
let(:invalid_params) { %w[this is an array] }
|
|
89
102
|
|
|
90
103
|
it do
|
|
@@ -93,7 +106,8 @@ RSpec.describe FinApps::REST::Orders do
|
|
|
93
106
|
end
|
|
94
107
|
|
|
95
108
|
context 'when including valid params' do
|
|
96
|
-
subject {
|
|
109
|
+
subject { described_class.new(client).list(params) }
|
|
110
|
+
|
|
97
111
|
let(:params) do
|
|
98
112
|
{
|
|
99
113
|
page: 2,
|
|
@@ -109,52 +123,65 @@ RSpec.describe FinApps::REST::Orders do
|
|
|
109
123
|
|
|
110
124
|
it { expect { subject }.not_to raise_error }
|
|
111
125
|
it('returns an array') { expect(subject).to be_a(Array) }
|
|
126
|
+
|
|
112
127
|
it('performs a get and returns the response') do
|
|
113
128
|
expect(subject[RESULTS]).to have_key(:orders)
|
|
114
129
|
end
|
|
130
|
+
|
|
115
131
|
it('each order contains a consumer_id') do
|
|
116
132
|
expect(subject[RESULTS][:orders]).to all(have_key(:consumer_id))
|
|
117
133
|
end
|
|
134
|
+
|
|
118
135
|
it('returns no error messages') do
|
|
119
136
|
expect(subject[ERROR_MESSAGES]).to be_empty
|
|
120
137
|
end
|
|
138
|
+
|
|
121
139
|
it 'builds query and sends proper request' do
|
|
122
140
|
subject
|
|
123
|
-
url =
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
141
|
+
url = "#{versioned_api_path}/orders?"\
|
|
142
|
+
'filter=%7B%22$or%22:%5B%7B%22public_id%22:' \
|
|
143
|
+
'%7B%22$regex%22:%22%5Eterm%22,%22$options%22:%22i%22%7D%7D,'\
|
|
144
|
+
'%7B%22applicant.last_name%22:%22' \
|
|
145
|
+
'term%22%7D,%7B%22assignment.last_name%22:%22term%22%7D,'\
|
|
146
|
+
'%7B%22requestor.reference_no%22:%7B%22' \
|
|
147
|
+
'$regex%22:%22%5Eterm%22,%22$options%22:%22i%22%7D%7D%5D,'\
|
|
148
|
+
'%22status%22:%7B%22$in%22:%5B1,7%5D%7D,' \
|
|
149
|
+
'%22assignment.operator_id%22:%22valid_operator%22,'\
|
|
150
|
+
'%22consumer_id%22:%22valid_consumer_id%22%7D' \
|
|
151
|
+
'&page=2&requested=25&sort=status'
|
|
130
152
|
expect(WebMock).to have_requested(:get, url)
|
|
131
153
|
end
|
|
154
|
+
|
|
132
155
|
it 'builds query and sends proper request with searchTerm/relation exclusivity' do
|
|
133
156
|
params[:searchTerm] = nil
|
|
134
157
|
subject
|
|
135
|
-
url =
|
|
136
|
-
|
|
137
|
-
'%22assignment.operator_id%22:%22valid_operator%22
|
|
138
|
-
'%
|
|
139
|
-
'%7B%22$in%22:%5B%22valid_order_id%22%5D%7D%7D
|
|
158
|
+
url = "#{versioned_api_path}/orders?"\
|
|
159
|
+
'filter=%7B%22status%22:%7B%22$in%22:%5B1,7%5D%7D,' \
|
|
160
|
+
'%22assignment.operator_id%22:%22valid_operator%22,'\
|
|
161
|
+
'%22consumer_id%22:%22valid_consumer_id%22,' \
|
|
162
|
+
'%22$or%22:%5B%7B%22public_id%22:%7B%22$in%22:%5B%22valid_order_id%22%5D%7D%7D,'\
|
|
163
|
+
'%7B%22original_order_id%22:%7B%22$in%22:%5B%22valid_order_id%22%5D%7D%7D%5D%7D&'\
|
|
164
|
+
'page=2&requested=25&sort=status'
|
|
140
165
|
expect(WebMock).to have_requested(:get, url)
|
|
141
166
|
end
|
|
167
|
+
|
|
142
168
|
it 'builds null assignment query properly when supplied w/ empty string' do
|
|
143
|
-
|
|
169
|
+
described_class.new(client).list(assignment: '')
|
|
144
170
|
|
|
145
|
-
url =
|
|
146
|
-
|
|
171
|
+
url = "#{versioned_api_path}/orders?"\
|
|
172
|
+
'filter=%7B%22assignment.operator_id%22:null%7D'
|
|
147
173
|
expect(WebMock).to have_requested(:get, url)
|
|
148
174
|
end
|
|
149
175
|
end
|
|
150
176
|
end
|
|
151
177
|
|
|
152
178
|
describe '#update' do
|
|
153
|
-
subject(:orders) {
|
|
179
|
+
subject(:orders) { described_class.new(client) }
|
|
154
180
|
|
|
155
181
|
context 'with nil params' do
|
|
156
182
|
context 'when missing id' do
|
|
157
183
|
let(:update) { subject.update(nil) }
|
|
184
|
+
|
|
158
185
|
it('returns missing argument error') do
|
|
159
186
|
expect { update }.to raise_error(FinAppsCore::MissingArgumentsError)
|
|
160
187
|
end
|
|
@@ -177,6 +204,7 @@ RSpec.describe FinApps::REST::Orders do
|
|
|
177
204
|
|
|
178
205
|
it { expect { update }.not_to raise_error }
|
|
179
206
|
it('results is nil') { expect(results).to be_nil }
|
|
207
|
+
|
|
180
208
|
it('error messages array is populated') do
|
|
181
209
|
expect(error_messages.first.downcase).to eq('resource not found')
|
|
182
210
|
end
|
|
@@ -186,6 +214,7 @@ RSpec.describe FinApps::REST::Orders do
|
|
|
186
214
|
context 'with params' do
|
|
187
215
|
context 'when missing id' do
|
|
188
216
|
let(:update) { subject.update(nil, params: 'valid') }
|
|
217
|
+
|
|
189
218
|
it('does not raise error') do
|
|
190
219
|
expect { update }.not_to raise_error
|
|
191
220
|
end
|
|
@@ -208,6 +237,7 @@ RSpec.describe FinApps::REST::Orders do
|
|
|
208
237
|
|
|
209
238
|
it { expect { update }.not_to raise_error }
|
|
210
239
|
it('results is nil') { expect(results).to be_nil }
|
|
240
|
+
|
|
211
241
|
it('error messages array is populated') do
|
|
212
242
|
expect(error_messages.first.downcase).to eq('invalid request body')
|
|
213
243
|
end
|
|
@@ -216,8 +246,10 @@ RSpec.describe FinApps::REST::Orders do
|
|
|
216
246
|
end
|
|
217
247
|
|
|
218
248
|
describe '#create_and_submit' do
|
|
219
|
-
subject(:orders) {
|
|
220
|
-
|
|
249
|
+
subject(:orders) { described_class.new(client) }
|
|
250
|
+
|
|
251
|
+
let(:params) { {params: 'valid'} }
|
|
252
|
+
|
|
221
253
|
it('calls #update') do
|
|
222
254
|
expect(subject).to receive(:update).with(nil, params)
|
|
223
255
|
subject.create_and_submit(params)
|
|
@@ -225,10 +257,11 @@ RSpec.describe FinApps::REST::Orders do
|
|
|
225
257
|
end
|
|
226
258
|
|
|
227
259
|
describe '#destroy' do
|
|
228
|
-
subject(:orders) {
|
|
260
|
+
subject(:orders) { described_class.new(client) }
|
|
229
261
|
|
|
230
262
|
context 'when missing id' do
|
|
231
263
|
let(:destroy) { subject.destroy(nil) }
|
|
264
|
+
|
|
232
265
|
it('returns missing argument error') do
|
|
233
266
|
expect { destroy }.to raise_error(FinAppsCore::MissingArgumentsError)
|
|
234
267
|
end
|
|
@@ -241,6 +274,7 @@ RSpec.describe FinApps::REST::Orders do
|
|
|
241
274
|
|
|
242
275
|
it { expect { destroy }.not_to raise_error }
|
|
243
276
|
it('results is nil') { expect(results).to be_nil }
|
|
277
|
+
|
|
244
278
|
it('error messages array is populated') do
|
|
245
279
|
expect(error_messages.first.downcase).to eq('resource not found')
|
|
246
280
|
end
|