finapps 5.0.33 → 5.0.41
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/.github/release-drafter.yml +49 -0
- data/.github/workflows/main.yaml +38 -0
- data/.github/workflows/release-drafter.yml +15 -0
- data/.github/workflows/release.yml +43 -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 +1 -2
- 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 +70 -79
- data/lib/tasks/releaser.rake +0 -12
@@ -29,7 +29,7 @@ RSpec.describe FinApps::REST::DocumentsOrdersNotifications do
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
context '
|
32
|
+
context 'with valid id' do
|
33
33
|
let(:create) { subject.create(:valid_id) }
|
34
34
|
let(:results) { create[RESULTS] }
|
35
35
|
let(:error_messages) { create[ERROR_MESSAGES] }
|
@@ -98,7 +98,7 @@ RSpec.describe FinApps::REST::DocumentsOrders do
|
|
98
98
|
|
99
99
|
it_behaves_like 'an API request'
|
100
100
|
it_behaves_like 'a successful request'
|
101
|
-
it { expect(
|
101
|
+
it { expect(list.first[:records]).not_to be_empty }
|
102
102
|
end
|
103
103
|
|
104
104
|
context 'when filtering by closed status ordes' do
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helpers/client'
|
4
|
+
require 'rest/api_request'
|
5
|
+
|
6
|
+
RSpec.describe FinApps::REST::DocumentsUploadTypes do
|
7
|
+
include SpecHelpers::Client
|
8
|
+
subject(:upload_types) { described_class.new(client).list }
|
9
|
+
|
10
|
+
let(:results) { upload_types[0] }
|
11
|
+
|
12
|
+
describe '#list' do
|
13
|
+
context 'when called' do
|
14
|
+
it_behaves_like 'an API request'
|
15
|
+
it_behaves_like 'a successful request'
|
16
|
+
it('performs a get and returns the response') do
|
17
|
+
expect(results[0]).to have_key(:type)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helpers/client'
|
4
|
+
require 'rest/api_request'
|
5
|
+
|
6
|
+
RSpec.describe FinApps::REST::DocumentsUploads do
|
7
|
+
include SpecHelpers::Client
|
8
|
+
|
9
|
+
describe '#show' do
|
10
|
+
let(:upload) { described_class.new(client) }
|
11
|
+
|
12
|
+
context 'when missing doc id' do
|
13
|
+
subject(:show) { upload.show(:consumer_id, nil) }
|
14
|
+
|
15
|
+
it 'raises an error' do
|
16
|
+
expect { show }.to raise_error(FinAppsCore::MissingArgumentsError)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'when missing consumer id' do
|
21
|
+
subject(:show) { upload.show(nil, :doc_id) }
|
22
|
+
|
23
|
+
it 'raises an error' do
|
24
|
+
expect { show }.to raise_error(FinAppsCore::MissingArgumentsError)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
context 'when thumbnail is not included' do
|
29
|
+
subject(:show) do
|
30
|
+
upload.show(
|
31
|
+
:consumer_id,
|
32
|
+
:doc_id
|
33
|
+
)
|
34
|
+
end
|
35
|
+
|
36
|
+
it_behaves_like 'an API request'
|
37
|
+
it_behaves_like 'a successful request'
|
38
|
+
end
|
39
|
+
|
40
|
+
context 'when thumbnail is included' do
|
41
|
+
subject(:show) do
|
42
|
+
upload.show(
|
43
|
+
:consumer_id,
|
44
|
+
:doc_id,
|
45
|
+
true
|
46
|
+
)
|
47
|
+
end
|
48
|
+
|
49
|
+
it_behaves_like 'an API request'
|
50
|
+
it_behaves_like 'a successful request'
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe '#destroy' do
|
55
|
+
subject(:destroy) { described_class.new(client).destroy(order_id, doc_id) }
|
56
|
+
|
57
|
+
let(:results) { destroy[0] }
|
58
|
+
let(:error_messages) { destroy[1] }
|
59
|
+
|
60
|
+
context 'with valid id' do
|
61
|
+
let(:order_id) { :valid_order_id }
|
62
|
+
let(:doc_id) { :valid_doc_id }
|
63
|
+
|
64
|
+
it_behaves_like 'an API request'
|
65
|
+
it_behaves_like 'a successful request'
|
66
|
+
it('results is nil') { expect(results).to be_nil }
|
67
|
+
end
|
68
|
+
|
69
|
+
context 'with invalid order id' do
|
70
|
+
let(:order_id) { :invalid_order_id }
|
71
|
+
let(:doc_id) { :valid_doc_id }
|
72
|
+
|
73
|
+
it_behaves_like 'an API request'
|
74
|
+
it('results is nil') { expect(results).to be_nil }
|
75
|
+
|
76
|
+
it('error messages array is populated') do
|
77
|
+
expect(error_messages.first.downcase).to eq('resource not found')
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
context 'with invalid doc id' do
|
82
|
+
let(:order_id) { :valid_order_id }
|
83
|
+
let(:doc_id) { :invalid_doc_id }
|
84
|
+
|
85
|
+
it_behaves_like 'an API request'
|
86
|
+
it('results is nil') { expect(results).to be_nil }
|
87
|
+
|
88
|
+
it('error messages array is populated') do
|
89
|
+
expect(error_messages.first.downcase).to eq('resource not found')
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
context 'with missing id' do
|
94
|
+
let(:order_id) { nil }
|
95
|
+
let(:doc_id) { nil }
|
96
|
+
|
97
|
+
it do
|
98
|
+
expect { destroy }.to raise_error(
|
99
|
+
FinAppsCore::MissingArgumentsError
|
100
|
+
)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -2,84 +2,77 @@
|
|
2
2
|
|
3
3
|
require 'spec_helpers/client'
|
4
4
|
|
5
|
-
RSpec.describe FinApps::REST::OperatorsPasswordResets
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
RSpec.describe FinApps::REST::OperatorsPasswordResets do
|
6
|
+
context 'when initialized with valid FinApps::Client object' do
|
7
|
+
include SpecHelpers::Client
|
8
|
+
subject(:operators_password_resets) do
|
9
|
+
described_class.new(client)
|
10
|
+
end
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
describe '#create' do
|
13
|
+
let(:results) { create[0] }
|
14
|
+
let(:error_messages) { create[1] }
|
15
15
|
|
16
|
-
|
17
|
-
|
16
|
+
context 'when missing params' do
|
17
|
+
let(:create) { subject.create(nil) }
|
18
18
|
|
19
|
-
|
20
|
-
|
19
|
+
it do
|
20
|
+
expect { create }.to raise_error(FinAppsCore::MissingArgumentsError)
|
21
|
+
end
|
21
22
|
end
|
22
|
-
end
|
23
23
|
|
24
|
-
|
25
|
-
|
24
|
+
context 'with invalid params' do
|
25
|
+
let(:create) { subject.create(params: 'invalid params') }
|
26
26
|
|
27
|
-
|
28
|
-
|
27
|
+
it do
|
28
|
+
expect { create }.to raise_error(FinAppsCore::InvalidArgumentsError)
|
29
|
+
end
|
29
30
|
end
|
30
|
-
end
|
31
|
-
|
32
|
-
context 'for valid params' do
|
33
|
-
let(:create) { subject.create(email: 'valid email') }
|
34
31
|
|
35
|
-
|
36
|
-
|
32
|
+
context 'with valid params' do
|
33
|
+
let(:create) { subject.create(email: 'valid email') }
|
37
34
|
|
38
|
-
|
39
|
-
expect(
|
40
|
-
expect(results).to have_key(:
|
41
|
-
expect(results).to have_key(:
|
35
|
+
it { expect { create }.not_to raise_error }
|
36
|
+
it('returns an array') { expect(create).to be_a(Array) }
|
37
|
+
it { expect(results).to have_key(:public_id) }
|
38
|
+
it { expect(results).to have_key(:token) }
|
39
|
+
it { expect(results).to have_key(:expiry_date) }
|
40
|
+
it('returns no error messages') { expect(error_messages).to be_empty }
|
42
41
|
end
|
43
|
-
|
44
|
-
it('returns no error messages') { expect(error_messages).to be_empty }
|
45
42
|
end
|
46
|
-
end
|
47
43
|
|
48
|
-
|
49
|
-
|
50
|
-
|
44
|
+
describe '#update' do
|
45
|
+
let(:results) { update[0] }
|
46
|
+
let(:error_messages) { update[1] }
|
51
47
|
|
52
|
-
|
53
|
-
|
48
|
+
context 'when missing params' do
|
49
|
+
let(:update) { subject.update(nil) }
|
54
50
|
|
55
|
-
|
56
|
-
|
51
|
+
it do
|
52
|
+
expect { update }.to raise_error(FinAppsCore::MissingArgumentsError)
|
53
|
+
end
|
57
54
|
end
|
58
|
-
end
|
59
55
|
|
60
|
-
|
61
|
-
|
56
|
+
context 'with invalid params' do
|
57
|
+
let(:update) { subject.update(params: 'invalid') }
|
62
58
|
|
63
|
-
|
64
|
-
|
59
|
+
it { expect { update }.not_to raise_error }
|
60
|
+
it('results is nil') { expect(results).to be_nil }
|
65
61
|
|
66
|
-
|
67
|
-
|
62
|
+
it('error messages array is populated') do
|
63
|
+
expect(error_messages.first.downcase).to eq('invalid request body')
|
64
|
+
end
|
68
65
|
end
|
69
|
-
end
|
70
66
|
|
71
|
-
|
72
|
-
|
67
|
+
context 'with valid params' do
|
68
|
+
let(:update) { subject.update(params: 'valid') }
|
73
69
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
expect(
|
79
|
-
expect(results).to have_key(:role)
|
70
|
+
it { expect { update }.not_to raise_error }
|
71
|
+
it('returns an array') { expect(update).to be_a(Array) }
|
72
|
+
it { expect(results).to have_key(:public_id) }
|
73
|
+
it { expect(results).to have_key(:role) }
|
74
|
+
it('returns no error messages') { expect(error_messages).to be_empty }
|
80
75
|
end
|
81
|
-
|
82
|
-
it('returns no error messages') { expect(error_messages).to be_empty }
|
83
76
|
end
|
84
77
|
end
|
85
78
|
end
|
data/spec/rest/operators_spec.rb
CHANGED
@@ -2,261 +2,250 @@
|
|
2
2
|
|
3
3
|
require 'spec_helpers/client'
|
4
4
|
|
5
|
-
RSpec.describe FinApps::REST::Operators
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
RSpec.describe FinApps::REST::Operators do
|
6
|
+
context 'when initialized with valid FinApps::Client object' do
|
7
|
+
include SpecHelpers::Client
|
8
|
+
subject(:operators) { described_class.new(client) }
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
describe '#list' do
|
11
|
+
let(:list) { subject.list(params) }
|
12
|
+
let(:results) { list[0] }
|
13
|
+
let(:error_messages) { list[1] }
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
context 'when missing params' do
|
16
|
+
let(:params) { nil }
|
17
17
|
|
18
|
-
|
18
|
+
it { expect { list }.not_to raise_error }
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
it('returns an array of records') do
|
25
|
-
expect(results[:records]).to be_a(Array)
|
26
|
-
end
|
27
|
-
|
28
|
-
it('returns no error messages') { expect(error_messages).to be_empty }
|
29
|
-
end
|
20
|
+
it('performs a get and returns the response') do
|
21
|
+
expect(results).to have_key(:records)
|
22
|
+
end
|
30
23
|
|
31
|
-
|
32
|
-
|
24
|
+
it('returns an array of records') do
|
25
|
+
expect(results[:records]).to be_a(Array)
|
26
|
+
end
|
33
27
|
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
context 'when including valid params' do
|
38
|
-
let(:params) do
|
39
|
-
{
|
40
|
-
page: 2,
|
41
|
-
sort: 'date_created',
|
42
|
-
requested: 25,
|
43
|
-
searchTerm: 'term',
|
44
|
-
role: 2
|
45
|
-
}
|
28
|
+
it('returns no error messages') { expect(error_messages).to be_empty }
|
46
29
|
end
|
47
30
|
|
48
|
-
|
31
|
+
context 'when invalid params are provided' do
|
32
|
+
let(:params) { ['invalid array'] }
|
49
33
|
|
50
|
-
|
51
|
-
expect(results).to have_key(:records)
|
34
|
+
it { expect { list }.to raise_error(FinAppsCore::InvalidArgumentsError) }
|
52
35
|
end
|
53
36
|
|
54
|
-
|
55
|
-
|
56
|
-
|
37
|
+
context 'when including valid params' do
|
38
|
+
let(:params) do
|
39
|
+
{
|
40
|
+
page: 2,
|
41
|
+
sort: 'date_created',
|
42
|
+
requested: 25,
|
43
|
+
searchTerm: 'term',
|
44
|
+
role: 2
|
45
|
+
}
|
46
|
+
end
|
57
47
|
|
58
|
-
|
48
|
+
it { expect { list }.not_to raise_error }
|
59
49
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
"#{versioned_api_path}/operators?filter=%7B%22last_name%22:%22term%22," \
|
64
|
-
'%22role%22:2%7D&page=2&requested=25&sort=date_created'
|
65
|
-
expect(WebMock).to have_requested(:get, url)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
50
|
+
it('performs a get and returns the response') do
|
51
|
+
expect(results).to have_key(:records)
|
52
|
+
end
|
69
53
|
|
70
|
-
|
71
|
-
|
72
|
-
|
54
|
+
it('returns an array of records') do
|
55
|
+
expect(results[:records]).to be_a(Array)
|
56
|
+
end
|
73
57
|
|
74
|
-
|
75
|
-
let(:show) { subject.show(nil) }
|
58
|
+
it('returns no error messages') { expect(error_messages).to be_empty }
|
76
59
|
|
77
|
-
|
60
|
+
it 'builds query and sends proper request' do
|
61
|
+
list
|
62
|
+
url =
|
63
|
+
"#{versioned_api_path}/operators?filter=%7B%22last_name%22:%22term%22," \
|
64
|
+
'%22role%22:2%7D&page=2&requested=25&sort=date_created'
|
65
|
+
expect(WebMock).to have_requested(:get, url)
|
66
|
+
end
|
67
|
+
end
|
78
68
|
end
|
79
69
|
|
80
|
-
|
81
|
-
let(:
|
70
|
+
describe '#show' do
|
71
|
+
let(:results) { show[0] }
|
72
|
+
let(:error_messages) { show[1] }
|
82
73
|
|
83
|
-
|
84
|
-
|
74
|
+
context 'when missing id' do
|
75
|
+
let(:show) { subject.show(nil) }
|
85
76
|
|
86
|
-
|
87
|
-
expect(error_messages.first.downcase).to eq('resource not found')
|
77
|
+
it { expect { show }.to raise_error(FinAppsCore::MissingArgumentsError) }
|
88
78
|
end
|
89
|
-
end
|
90
79
|
|
91
|
-
|
92
|
-
|
80
|
+
context 'with invalid id' do
|
81
|
+
let(:show) { subject.show(:invalid_id) }
|
93
82
|
|
94
|
-
|
95
|
-
|
83
|
+
it { expect { show }.not_to raise_error }
|
84
|
+
it('results is nil') { expect(results).to be_nil }
|
96
85
|
|
97
|
-
|
98
|
-
|
86
|
+
it('error messages array is populated') do
|
87
|
+
expect(error_messages.first.downcase).to eq('resource not found')
|
88
|
+
end
|
99
89
|
end
|
100
90
|
|
101
|
-
|
102
|
-
|
103
|
-
end
|
91
|
+
context 'with valid id' do
|
92
|
+
let(:show) { subject.show(:valid_id) }
|
104
93
|
|
105
|
-
|
106
|
-
|
107
|
-
let(:error_messages) { create[1] }
|
94
|
+
it { expect { show }.not_to raise_error }
|
95
|
+
it('returns an array') { expect(show).to be_a(Array) }
|
108
96
|
|
109
|
-
|
110
|
-
|
97
|
+
it('performs a get and returns the response') do
|
98
|
+
expect(results).to have_key(:public_id)
|
99
|
+
end
|
111
100
|
|
112
|
-
|
113
|
-
expect { create }.to raise_error(FinAppsCore::MissingArgumentsError)
|
101
|
+
it('returns no error messages') { expect(error_messages).to be_empty }
|
114
102
|
end
|
115
103
|
end
|
116
104
|
|
117
|
-
|
118
|
-
let(:
|
105
|
+
describe '#create' do
|
106
|
+
let(:results) { create[0] }
|
107
|
+
let(:error_messages) { create[1] }
|
119
108
|
|
120
|
-
|
121
|
-
|
109
|
+
context 'when missing params' do
|
110
|
+
let(:create) { subject.create(nil) }
|
122
111
|
|
123
|
-
|
124
|
-
|
112
|
+
it do
|
113
|
+
expect { create }.to raise_error(FinAppsCore::MissingArgumentsError)
|
114
|
+
end
|
125
115
|
end
|
126
|
-
end
|
127
116
|
|
128
|
-
|
129
|
-
|
117
|
+
context 'when invalid params are provided' do
|
118
|
+
let(:create) { subject.create(params: 'invalid') }
|
130
119
|
|
131
|
-
|
132
|
-
|
120
|
+
it { expect { create }.not_to raise_error }
|
121
|
+
it('results is nil') { expect(results).to be_nil }
|
133
122
|
|
134
|
-
|
135
|
-
|
136
|
-
|
123
|
+
it('error messages array is populated') do
|
124
|
+
expect(error_messages.first.downcase).to eq('invalid request body')
|
125
|
+
end
|
137
126
|
end
|
138
127
|
|
139
|
-
|
128
|
+
context 'when valid params are provided' do
|
129
|
+
let(:create) { subject.create(params: 'valid') }
|
130
|
+
|
131
|
+
it { expect { create }.not_to raise_error }
|
132
|
+
it('returns an array') { expect(create).to be_a(Array) }
|
133
|
+
it { expect(results).to have_key(:public_id) }
|
134
|
+
it { expect(results).to have_key(:role) }
|
135
|
+
it('returns no error messages') { expect(error_messages).to be_empty }
|
136
|
+
end
|
140
137
|
end
|
141
|
-
end
|
142
138
|
|
143
|
-
|
144
|
-
|
145
|
-
|
139
|
+
describe '#update' do
|
140
|
+
let(:results) { update[0] }
|
141
|
+
let(:error_messages) { update[1] }
|
146
142
|
|
147
|
-
|
148
|
-
|
143
|
+
context 'when missing id' do
|
144
|
+
let(:update) { subject.update(nil, params: 'params') }
|
149
145
|
|
150
|
-
|
151
|
-
|
146
|
+
it do
|
147
|
+
expect { update }.to raise_error(FinAppsCore::MissingArgumentsError)
|
148
|
+
end
|
152
149
|
end
|
153
|
-
end
|
154
150
|
|
155
|
-
|
156
|
-
|
151
|
+
context 'when missing params' do
|
152
|
+
let(:update) { subject.update(:valid_id, nil) }
|
157
153
|
|
158
|
-
|
159
|
-
|
154
|
+
it do
|
155
|
+
expect { update }.to raise_error(FinAppsCore::MissingArgumentsError)
|
156
|
+
end
|
160
157
|
end
|
161
|
-
end
|
162
158
|
|
163
|
-
|
164
|
-
|
159
|
+
context 'with invalid params' do
|
160
|
+
let(:update) { subject.update(:invalid_id, params: 'params') }
|
165
161
|
|
166
|
-
|
167
|
-
|
162
|
+
it { expect { update }.not_to raise_error }
|
163
|
+
it('results is nil') { expect(results).to be_nil }
|
168
164
|
|
169
|
-
|
170
|
-
|
165
|
+
it('error messages array is populated') do
|
166
|
+
expect(error_messages.first.downcase).to eq('resource not found')
|
167
|
+
end
|
171
168
|
end
|
172
|
-
end
|
173
169
|
|
174
|
-
|
175
|
-
|
170
|
+
context 'with valid params' do
|
171
|
+
let(:update) { subject.update(:valid_id, params: 'valid params') }
|
176
172
|
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
expect(
|
182
|
-
expect(results).to have_key(:role)
|
173
|
+
it { expect { update }.not_to raise_error }
|
174
|
+
it('returns an array') { expect(update).to be_a(Array) }
|
175
|
+
it { expect(results).to have_key(:email) }
|
176
|
+
it { expect(results).to have_key(:role) }
|
177
|
+
it('returns no error messages') { expect(error_messages).to be_empty }
|
183
178
|
end
|
184
|
-
|
185
|
-
it('returns no error messages') { expect(error_messages).to be_empty }
|
186
179
|
end
|
187
|
-
end
|
188
180
|
|
189
|
-
|
190
|
-
|
191
|
-
|
181
|
+
describe '#update_password' do
|
182
|
+
let(:results) { update_password[0] }
|
183
|
+
let(:error_messages) { update_password[1] }
|
192
184
|
|
193
|
-
|
194
|
-
|
185
|
+
context 'when missing params' do
|
186
|
+
let(:update_password) { subject.update_password(nil) }
|
195
187
|
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
188
|
+
it do
|
189
|
+
expect { update_password }.to raise_error(
|
190
|
+
FinAppsCore::MissingArgumentsError
|
191
|
+
)
|
192
|
+
end
|
200
193
|
end
|
201
|
-
end
|
202
194
|
|
203
|
-
|
204
|
-
|
195
|
+
context 'with invalid params' do
|
196
|
+
let(:update_password) { subject.update_password(password: 'invalid') }
|
205
197
|
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
198
|
+
it do
|
199
|
+
expect { update_password }.to raise_error(
|
200
|
+
FinAppsCore::InvalidArgumentsError
|
201
|
+
)
|
202
|
+
end
|
210
203
|
end
|
211
|
-
end
|
212
|
-
|
213
|
-
context 'with valid params' do
|
214
|
-
let(:valid_params) do
|
215
|
-
{password: 'valid password', password_confirm: 'valid_password'}
|
216
|
-
end
|
217
|
-
let(:update_password) { subject.update_password(valid_params) }
|
218
204
|
|
219
|
-
|
220
|
-
|
205
|
+
context 'with valid params' do
|
206
|
+
let(:valid_params) do
|
207
|
+
{password: 'valid password', password_confirm: 'valid_password'}
|
208
|
+
end
|
209
|
+
let(:update_password) { subject.update_password(valid_params) }
|
221
210
|
|
222
|
-
|
223
|
-
expect(
|
224
|
-
expect(results).to have_key(:
|
211
|
+
it { expect { update_password }.not_to raise_error }
|
212
|
+
it('returns an array') { expect(update_password).to be_a(Array) }
|
213
|
+
it { expect(results).to have_key(:public_id) }
|
214
|
+
it { expect(results).to have_key(:role) }
|
215
|
+
it('returns no error messages') { expect(error_messages).to be_empty }
|
225
216
|
end
|
226
|
-
|
227
|
-
it('returns no error messages') { expect(error_messages).to be_empty }
|
228
217
|
end
|
229
|
-
end
|
230
218
|
|
231
|
-
|
232
|
-
|
233
|
-
|
219
|
+
describe '#destroy' do
|
220
|
+
let(:results) { destroy[0] }
|
221
|
+
let(:error_messages) { destroy[1] }
|
234
222
|
|
235
|
-
|
236
|
-
|
223
|
+
context 'when missing id' do
|
224
|
+
let(:destroy) { subject.destroy(nil) }
|
237
225
|
|
238
|
-
|
239
|
-
|
226
|
+
it do
|
227
|
+
expect { destroy }.to raise_error(FinAppsCore::MissingArgumentsError)
|
228
|
+
end
|
240
229
|
end
|
241
|
-
end
|
242
230
|
|
243
|
-
|
244
|
-
|
231
|
+
context 'with invalid id' do
|
232
|
+
let(:destroy) { subject.destroy(:invalid_id) }
|
245
233
|
|
246
|
-
|
247
|
-
|
234
|
+
it { expect { destroy }.not_to raise_error }
|
235
|
+
it('results is nil') { expect(results).to be_nil }
|
248
236
|
|
249
|
-
|
250
|
-
|
237
|
+
it('error messages array is populated') do
|
238
|
+
expect(error_messages.first.downcase).to eq('resource not found')
|
239
|
+
end
|
251
240
|
end
|
252
|
-
end
|
253
241
|
|
254
|
-
|
255
|
-
|
242
|
+
context 'with valid id' do
|
243
|
+
let(:destroy) { subject.destroy(:valid_id) }
|
256
244
|
|
257
|
-
|
258
|
-
|
259
|
-
|
245
|
+
it { expect { destroy }.not_to raise_error }
|
246
|
+
it('results is nil') { expect(results).to be_nil }
|
247
|
+
it('error_messages array is empty') { expect(error_messages).to eq([]) }
|
248
|
+
end
|
260
249
|
end
|
261
250
|
end
|
262
251
|
end
|