finapps 5.0.3 → 5.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -0
  3. data/.rubocop.yml +1 -7
  4. data/.tmuxinator.yml +19 -0
  5. data/Guardfile +42 -0
  6. data/finapps.gemspec +3 -1
  7. data/lib/finapps.rb +1 -7
  8. data/lib/finapps/rest/client.rb +5 -10
  9. data/lib/finapps/rest/consumers.rb +2 -1
  10. data/lib/finapps/rest/operators.rb +8 -2
  11. data/lib/finapps/rest/order_reports.rb +2 -1
  12. data/lib/finapps/rest/orders.rb +11 -9
  13. data/lib/finapps/rest/plaid/plaid_consumer_institutions.rb +15 -0
  14. data/lib/finapps/rest/portfolios_alerts.rb +2 -1
  15. data/lib/finapps/rest/portfolios_available_consumers.rb +2 -1
  16. data/lib/finapps/rest/portfolios_consumers.rb +6 -1
  17. data/lib/finapps/rest/products.rb +1 -2
  18. data/lib/finapps/rest/sessions.rb +8 -2
  19. data/lib/finapps/rest/statements.rb +2 -1
  20. data/lib/finapps/version.rb +1 -1
  21. data/spec/rest/alert_definitions_spec.rb +12 -7
  22. data/spec/rest/alert_occurrences_spec.rb +17 -5
  23. data/spec/rest/client_spec.rb +115 -57
  24. data/spec/rest/consumers_portfolios_spec.rb +9 -4
  25. data/spec/rest/consumers_spec.rb +76 -20
  26. data/spec/rest/operators_password_resets_spec.rb +19 -10
  27. data/spec/rest/operators_spec.rb +60 -22
  28. data/spec/rest/order_assignments_spec.rb +11 -5
  29. data/spec/rest/order_notifications_spec.rb +6 -2
  30. data/spec/rest/order_refreshes_spec.rb +11 -5
  31. data/spec/rest/order_reports_spec.rb +15 -5
  32. data/spec/rest/order_statuses_spec.rb +12 -4
  33. data/spec/rest/order_tokens_spec.rb +17 -5
  34. data/spec/rest/orders_spec.rb +80 -34
  35. data/spec/rest/password_resets_spec.rb +51 -14
  36. data/spec/rest/plaid/plaid_webhooks_spec.rb +7 -3
  37. data/spec/rest/portfolio_reports_spec.rb +9 -4
  38. data/spec/rest/portfolios_alerts_spec.rb +18 -10
  39. data/spec/rest/portfolios_available_consumers_spec.rb +9 -4
  40. data/spec/rest/portfolios_consumers_spec.rb +29 -11
  41. data/spec/rest/portfolios_spec.rb +51 -22
  42. data/spec/rest/products_spec.rb +5 -2
  43. data/spec/rest/sessions_spec.rb +36 -14
  44. data/spec/rest/statements_spec.rb +6 -2
  45. data/spec/rest/tenant_app_settings_spec.rb +13 -5
  46. data/spec/rest/tenant_settings_spec.rb +13 -5
  47. data/spec/rest/version_spec.rb +3 -1
  48. data/spec/spec_helper.rb +6 -4
  49. data/spec/spec_helpers/client.rb +2 -1
  50. data/spec/support/fake_api.rb +253 -119
  51. data/spec/utils/query_builder_spec.rb +8 -3
  52. data/tags +6 -0
  53. metadata +48 -25
  54. data/lib/finapps/rest/consumer_institution_refresh.rb +0 -14
  55. data/lib/finapps/rest/consumer_institution_refreshes.rb +0 -12
  56. data/lib/finapps/rest/institutions.rb +0 -34
  57. data/lib/finapps/rest/institutions_forms.rb +0 -14
  58. data/lib/finapps/rest/user_institutions.rb +0 -54
  59. data/lib/finapps/rest/user_institutions_forms.rb +0 -14
  60. data/lib/finapps/rest/user_institutions_statuses.rb +0 -19
  61. data/spec/rest/consumer_institution_refresh_spec.rb +0 -44
  62. data/spec/rest/consumer_institution_refreshes_spec.rb +0 -20
  63. data/spec/rest/institutions_forms_spec.rb +0 -29
  64. data/spec/rest/institutions_spec.rb +0 -55
  65. data/spec/rest/user_institutions_forms_spec.rb +0 -30
  66. data/spec/rest/user_institutions_spec.rb +0 -144
  67. data/spec/rest/user_institutions_statuses_spec.rb +0 -43
@@ -2,9 +2,12 @@
2
2
 
3
3
  require 'spec_helpers/client'
4
4
 
5
- RSpec.describe FinApps::REST::OperatorsPasswordResets, 'initialized with valid FinApps::Client object' do
5
+ RSpec.describe FinApps::REST::OperatorsPasswordResets,
6
+ 'initialized with valid FinApps::Client object' do
6
7
  include SpecHelpers::Client
7
- subject(:operators_password_resets) { FinApps::REST::OperatorsPasswordResets.new(client) }
8
+ subject(:operators_password_resets) do
9
+ FinApps::REST::OperatorsPasswordResets.new(client)
10
+ end
8
11
 
9
12
  describe '#create' do
10
13
  let(:results) { create[0] }
@@ -13,13 +16,17 @@ RSpec.describe FinApps::REST::OperatorsPasswordResets, 'initialized with valid F
13
16
  context 'when missing params' do
14
17
  let(:create) { subject.create(nil) }
15
18
 
16
- it { expect { create }.to raise_error(FinAppsCore::MissingArgumentsError) }
19
+ it do
20
+ expect { create }.to raise_error(FinAppsCore::MissingArgumentsError)
21
+ end
17
22
  end
18
23
 
19
24
  context 'for invalid params' do
20
25
  let(:create) { subject.create(params: 'invalid params') }
21
26
 
22
- it { expect { create }.to raise_error(FinAppsCore::InvalidArgumentsError) }
27
+ it do
28
+ expect { create }.to raise_error(FinAppsCore::InvalidArgumentsError)
29
+ end
23
30
  end
24
31
 
25
32
  context 'for valid params' do
@@ -28,9 +35,9 @@ RSpec.describe FinApps::REST::OperatorsPasswordResets, 'initialized with valid F
28
35
  it { expect { create }.not_to raise_error }
29
36
  it('returns an array') { expect(create).to be_a(Array) }
30
37
  it('performs a post and returns the response') do
31
- expect(results).to respond_to(:public_id)
32
- expect(results).to respond_to(:token)
33
- expect(results).to respond_to(:expiry_date)
38
+ expect(results).to have_key(:public_id)
39
+ expect(results).to have_key(:token)
40
+ expect(results).to have_key(:expiry_date)
34
41
  end
35
42
  it('returns no error messages') { expect(error_messages).to be_empty }
36
43
  end
@@ -43,7 +50,9 @@ RSpec.describe FinApps::REST::OperatorsPasswordResets, 'initialized with valid F
43
50
  context 'when missing params' do
44
51
  let(:update) { subject.update(nil) }
45
52
 
46
- it { expect { update }.to raise_error(FinAppsCore::MissingArgumentsError) }
53
+ it do
54
+ expect { update }.to raise_error(FinAppsCore::MissingArgumentsError)
55
+ end
47
56
  end
48
57
 
49
58
  context 'for invalid params' do
@@ -62,8 +71,8 @@ RSpec.describe FinApps::REST::OperatorsPasswordResets, 'initialized with valid F
62
71
  it { expect { update }.not_to raise_error }
63
72
  it('returns an array') { expect(update).to be_a(Array) }
64
73
  it('performs a post and returns the response') do
65
- expect(results).to respond_to(:public_id)
66
- expect(results).to respond_to(:role)
74
+ expect(results).to have_key(:public_id)
75
+ expect(results).to have_key(:role)
67
76
  end
68
77
  it('returns no error messages') { expect(error_messages).to be_empty }
69
78
  end
@@ -2,7 +2,8 @@
2
2
 
3
3
  require 'spec_helpers/client'
4
4
 
5
- RSpec.describe FinApps::REST::Operators, 'initialized with valid FinApps::Client object' do
5
+ RSpec.describe FinApps::REST::Operators,
6
+ 'initialized with valid FinApps::Client object' do
6
7
  include SpecHelpers::Client
7
8
  subject(:operators) { FinApps::REST::Operators.new(client) }
8
9
 
@@ -14,8 +15,12 @@ RSpec.describe FinApps::REST::Operators, 'initialized with valid FinApps::Client
14
15
  context 'when missing params' do
15
16
  let(:params) { nil }
16
17
  it { expect { list }.not_to raise_error }
17
- it('performs a get and returns the response') { expect(results).to respond_to(:records) }
18
- it('returns an array of records') { expect(results.records).to be_a(Array) }
18
+ it('performs a get and returns the response') do
19
+ expect(results).to have_key(:records)
20
+ end
21
+ it('returns an array of records') do
22
+ expect(results[:records]).to be_a(Array)
23
+ end
19
24
  it('returns no error messages') { expect(error_messages).to be_empty }
20
25
  end
21
26
 
@@ -26,16 +31,29 @@ RSpec.describe FinApps::REST::Operators, 'initialized with valid FinApps::Client
26
31
  end
27
32
 
28
33
  context 'when including valid params' do
29
- let(:params) { { page: 2, sort: 'date_created', requested: 25, searchTerm: 'term', role: 2 } }
34
+ let(:params) do
35
+ {
36
+ page: 2,
37
+ sort: 'date_created',
38
+ requested: 25,
39
+ searchTerm: 'term',
40
+ role: 2
41
+ }
42
+ end
30
43
 
31
44
  it { expect { list }.not_to raise_error }
32
- it('performs a get and returns the response') { expect(results).to respond_to(:records) }
33
- it('returns an array of records') { expect(results.records).to be_a(Array) }
45
+ it('performs a get and returns the response') do
46
+ expect(results).to have_key(:records)
47
+ end
48
+ it('returns an array of records') do
49
+ expect(results[:records]).to be_a(Array)
50
+ end
34
51
  it('returns no error messages') { expect(error_messages).to be_empty }
35
52
  it 'builds query and sends proper request' do
36
53
  list
37
- url = "#{versioned_api_path}/operators?filter=%7B%22last_name%22:%22term%22," \
38
- '%22role%22:2%7D&page=2&requested=25&sort=date_created'
54
+ url =
55
+ "#{versioned_api_path}/operators?filter=%7B%22last_name%22:%22term%22," \
56
+ '%22role%22:2%7D&page=2&requested=25&sort=date_created'
39
57
  expect(WebMock).to have_requested(:get, url)
40
58
  end
41
59
  end
@@ -66,7 +84,9 @@ RSpec.describe FinApps::REST::Operators, 'initialized with valid FinApps::Client
66
84
 
67
85
  it { expect { show }.not_to raise_error }
68
86
  it('returns an array') { expect(show).to be_a(Array) }
69
- it('performs a get and returns the response') { expect(results).to respond_to(:public_id) }
87
+ it('performs a get and returns the response') do
88
+ expect(results).to have_key(:public_id)
89
+ end
70
90
  it('returns no error messages') { expect(error_messages).to be_empty }
71
91
  end
72
92
  end
@@ -78,7 +98,9 @@ RSpec.describe FinApps::REST::Operators, 'initialized with valid FinApps::Client
78
98
  context 'when missing params' do
79
99
  let(:create) { subject.create(nil) }
80
100
 
81
- it { expect { create }.to raise_error(FinAppsCore::MissingArgumentsError) }
101
+ it do
102
+ expect { create }.to raise_error(FinAppsCore::MissingArgumentsError)
103
+ end
82
104
  end
83
105
 
84
106
  context 'when invalid params are provided' do
@@ -97,8 +119,8 @@ RSpec.describe FinApps::REST::Operators, 'initialized with valid FinApps::Client
97
119
  it { expect { create }.not_to raise_error }
98
120
  it('returns an array') { expect(create).to be_a(Array) }
99
121
  it('performs a post and returns the response') do
100
- expect(results).to respond_to(:public_id)
101
- expect(results).to respond_to(:role)
122
+ expect(results).to have_key(:public_id)
123
+ expect(results).to have_key(:role)
102
124
  end
103
125
  it('returns no error messages') { expect(error_messages).to be_empty }
104
126
  end
@@ -111,13 +133,17 @@ RSpec.describe FinApps::REST::Operators, 'initialized with valid FinApps::Client
111
133
  context 'when missing id' do
112
134
  let(:update) { subject.update(nil, params: 'params') }
113
135
 
114
- it { expect { update }.to raise_error(FinAppsCore::MissingArgumentsError) }
136
+ it do
137
+ expect { update }.to raise_error(FinAppsCore::MissingArgumentsError)
138
+ end
115
139
  end
116
140
 
117
141
  context 'when missing params' do
118
142
  let(:update) { subject.update(:valid_id, nil) }
119
143
 
120
- it { expect { update }.to raise_error(FinAppsCore::MissingArgumentsError) }
144
+ it do
145
+ expect { update }.to raise_error(FinAppsCore::MissingArgumentsError)
146
+ end
121
147
  end
122
148
 
123
149
  context 'with invalid params' do
@@ -136,8 +162,8 @@ RSpec.describe FinApps::REST::Operators, 'initialized with valid FinApps::Client
136
162
  it { expect { update }.not_to raise_error }
137
163
  it('returns an array') { expect(update).to be_a(Array) }
138
164
  it('performs a put and returns the response') do
139
- expect(results).to respond_to(:email)
140
- expect(results).to respond_to(:role)
165
+ expect(results).to have_key(:email)
166
+ expect(results).to have_key(:role)
141
167
  end
142
168
  it('returns no error messages') { expect(error_messages).to be_empty }
143
169
  end
@@ -150,24 +176,34 @@ RSpec.describe FinApps::REST::Operators, 'initialized with valid FinApps::Client
150
176
  context 'when missing params' do
151
177
  let(:update_password) { subject.update_password(nil) }
152
178
 
153
- it { expect { update_password }.to raise_error(FinAppsCore::MissingArgumentsError) }
179
+ it do
180
+ expect { update_password }.to raise_error(
181
+ FinAppsCore::MissingArgumentsError
182
+ )
183
+ end
154
184
  end
155
185
 
156
186
  context 'with invalid params' do
157
187
  let(:update_password) { subject.update_password(password: 'invalid') }
158
188
 
159
- it { expect { update_password }.to raise_error(FinAppsCore::InvalidArgumentsError) }
189
+ it do
190
+ expect { update_password }.to raise_error(
191
+ FinAppsCore::InvalidArgumentsError
192
+ )
193
+ end
160
194
  end
161
195
 
162
196
  context 'with valid params' do
163
- let(:valid_params) { { password: 'valid password', password_confirm: 'valid_password' } }
197
+ let(:valid_params) do
198
+ { password: 'valid password', password_confirm: 'valid_password' }
199
+ end
164
200
  let(:update_password) { subject.update_password(valid_params) }
165
201
 
166
202
  it { expect { update_password }.not_to raise_error }
167
203
  it('returns an array') { expect(update_password).to be_a(Array) }
168
204
  it('performs a post and returns the response') do
169
- expect(results).to respond_to(:public_id)
170
- expect(results).to respond_to(:role)
205
+ expect(results).to have_key(:public_id)
206
+ expect(results).to have_key(:role)
171
207
  end
172
208
  it('returns no error messages') { expect(error_messages).to be_empty }
173
209
  end
@@ -180,7 +216,9 @@ RSpec.describe FinApps::REST::Operators, 'initialized with valid FinApps::Client
180
216
  context 'when missing id' do
181
217
  let(:destroy) { subject.destroy(nil) }
182
218
 
183
- it { expect { destroy }.to raise_error(FinAppsCore::MissingArgumentsError) }
219
+ it do
220
+ expect { destroy }.to raise_error(FinAppsCore::MissingArgumentsError)
221
+ end
184
222
  end
185
223
 
186
224
  context 'for invalid id' do
@@ -12,21 +12,27 @@ RSpec.describe FinApps::REST::OrderAssignments do
12
12
 
13
13
  context 'when missing id' do
14
14
  let(:update) { subject.update(nil, []) }
15
- it('returns missing argument error') { expect { update }.to raise_error(FinAppsCore::MissingArgumentsError) }
15
+ it('returns missing argument error') do
16
+ expect { update }.to raise_error(FinAppsCore::MissingArgumentsError)
17
+ end
16
18
  end
17
19
 
18
20
  context 'when missing params' do
19
21
  let(:update) { subject.update(:valid_id, nil) }
20
- it('returns missing argument error') { expect { update }.to raise_error(FinAppsCore::MissingArgumentsError) }
22
+ it('returns missing argument error') do
23
+ expect { update }.to raise_error(FinAppsCore::MissingArgumentsError)
24
+ end
21
25
  end
22
26
 
23
27
  context 'with invalid params' do
24
28
  let(:update) { subject.update(:valid_id, params: 'params') }
25
- it('returns invalid argument error') { expect { update }.to raise_error(FinAppsCore::InvalidArgumentsError) }
29
+ it('returns invalid argument error') do
30
+ expect { update }.to raise_error(FinAppsCore::InvalidArgumentsError)
31
+ end
26
32
  end
27
33
 
28
34
  context 'with invalid operator' do
29
- let(:update) { subject.update(:invalid_id, ['invalid']) }
35
+ let(:update) { subject.update(:invalid_id, %w[invalid]) }
30
36
 
31
37
  it { expect { update }.not_to raise_error }
32
38
  it('results is nil') { expect(results).to be_nil }
@@ -36,7 +42,7 @@ RSpec.describe FinApps::REST::OrderAssignments do
36
42
  end
37
43
 
38
44
  context 'with valid params' do
39
- let(:update) { subject.update(:valid_id, ['valid']) }
45
+ let(:update) { subject.update(:valid_id, %w[valid]) }
40
46
 
41
47
  it { expect { update }.not_to raise_error }
42
48
  it('results is nil') { expect(results).to be_nil }
@@ -10,7 +10,9 @@ RSpec.describe FinApps::REST::OrderNotifications do
10
10
 
11
11
  context 'when missing id' do
12
12
  let(:update) { subject.update(nil) }
13
- it('returns missing argument error') { expect { update }.to raise_error(FinAppsCore::MissingArgumentsError) }
13
+ it('returns missing argument error') do
14
+ expect { update }.to raise_error(FinAppsCore::MissingArgumentsError)
15
+ end
14
16
  end
15
17
 
16
18
  context 'when invalid id is provided' do
@@ -20,7 +22,9 @@ RSpec.describe FinApps::REST::OrderNotifications do
20
22
 
21
23
  it { expect { update }.not_to raise_error }
22
24
  it('results is nil') { expect(results).to be_nil }
23
- it('error messages array is populated') { expect(error_messages.first.downcase).to eq('resource not found') }
25
+ it('error messages array is populated') do
26
+ expect(error_messages.first.downcase).to eq('resource not found')
27
+ end
24
28
  end
25
29
 
26
30
  context 'for valid id' do
@@ -9,7 +9,9 @@ RSpec.describe FinApps::REST::OrderRefreshes do
9
9
  describe '#create' do
10
10
  context 'when missing id' do
11
11
  let(:create) { subject.create(nil) }
12
- it { expect { create }.to raise_error(FinAppsCore::MissingArgumentsError) }
12
+ it do
13
+ expect { create }.to raise_error(FinAppsCore::MissingArgumentsError)
14
+ end
13
15
  end
14
16
 
15
17
  context 'when valid id is provided' do
@@ -17,10 +19,12 @@ RSpec.describe FinApps::REST::OrderRefreshes do
17
19
  it { expect { create }.not_to raise_error }
18
20
  it('returns an array') { expect(create).to be_a(Array) }
19
21
  it('performs a post and returns new refreshed order response') do
20
- expect(create[RESULTS]).to respond_to(:public_id)
21
- expect(create[RESULTS]).to respond_to(:original_order_id)
22
+ expect(create[RESULTS]).to have_key(:public_id)
23
+ expect(create[RESULTS]).to have_key(:original_order_id)
24
+ end
25
+ it('returns no error messages') do
26
+ expect(create[ERROR_MESSAGES]).to be_empty
22
27
  end
23
- it('returns no error messages') { expect(create[ERROR_MESSAGES]).to be_empty }
24
28
  end
25
29
 
26
30
  context 'when invalid id is provided' do
@@ -29,7 +33,9 @@ RSpec.describe FinApps::REST::OrderRefreshes do
29
33
  it('returns an array') { expect(create).to be_a(Array) }
30
34
  it('results is nil') { expect(create[RESULTS]).to be_nil }
31
35
  it('error messages array is populated') do
32
- expect(create[ERROR_MESSAGES].first.downcase).to eq('resource not found')
36
+ expect(create[ERROR_MESSAGES].first.downcase).to eq(
37
+ 'resource not found'
38
+ )
33
39
  end
34
40
  end
35
41
  end
@@ -10,24 +10,32 @@ RSpec.describe FinApps::REST::OrderReports do
10
10
  describe '#show' do
11
11
  context 'when missing id' do
12
12
  subject { order_report.show(nil, :pdf) }
13
- it { expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError) }
13
+ it do
14
+ expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError)
15
+ end
14
16
  end
15
17
 
16
18
  context 'when missing format' do
17
19
  subject { order_report.show(:valid_id, nil) }
18
- it { expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError) }
20
+ it do
21
+ expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError)
22
+ end
19
23
  end
20
24
 
21
25
  context 'when invalid format is provided' do
22
26
  subject { order_report.show(:valid_id, :xml) }
23
- it { expect { subject }.to raise_error(FinAppsCore::InvalidArgumentsError) }
27
+ it do
28
+ expect { subject }.to raise_error(FinAppsCore::InvalidArgumentsError)
29
+ end
24
30
  end
25
31
 
26
32
  context 'when valid params are provided' do
27
33
  subject { order_report.show(:valid_id, :json) }
28
34
 
29
35
  it { expect { subject }.not_to raise_error }
30
- it('performs a get and returns the response') { expect(subject[0]).to respond_to(:days_requested) }
36
+ it('performs a get and returns the response') do
37
+ expect(subject[0]).to have_key(:days_requested)
38
+ end
31
39
  it('returns no error messages') { expect(subject[1]).to be_empty }
32
40
  end
33
41
 
@@ -36,7 +44,9 @@ RSpec.describe FinApps::REST::OrderReports do
36
44
 
37
45
  it { expect { subject }.not_to raise_error }
38
46
  it('results is nil') { expect(subject[0]).to be_nil }
39
- it('error messages array is populated') { expect(subject[1].first.downcase).to eq('resource not found') }
47
+ it('error messages array is populated') do
48
+ expect(subject[1].first.downcase).to eq('resource not found')
49
+ end
40
50
  end
41
51
  end
42
52
  end
@@ -6,15 +6,21 @@ RSpec.describe FinApps::REST::OrderStatuses do
6
6
  describe '#show' do
7
7
  context 'when missing id' do
8
8
  subject { FinApps::REST::OrderStatuses.new(client).show(nil) }
9
- it { expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError) }
9
+ it do
10
+ expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError)
11
+ end
10
12
  end
11
13
 
12
14
  context 'when valid id is provided' do
13
15
  subject { FinApps::REST::OrderStatuses.new(client).show(:valid_id) }
14
16
 
15
17
  it { expect { subject }.not_to raise_error }
16
- it('performs a get and returns the response') { expect(subject[RESULTS]).to respond_to(:status) }
17
- it('returns no error messages') { expect(subject[ERROR_MESSAGES]).to be_empty }
18
+ it('performs a get and returns the response') do
19
+ expect(subject[RESULTS]).to have_key(:status)
20
+ end
21
+ it('returns no error messages') do
22
+ expect(subject[ERROR_MESSAGES]).to be_empty
23
+ end
18
24
  end
19
25
 
20
26
  context 'when invalid id is provided' do
@@ -23,7 +29,9 @@ RSpec.describe FinApps::REST::OrderStatuses do
23
29
  it { expect { subject }.not_to raise_error }
24
30
  it('results is nil') { expect(subject[RESULTS]).to be_nil }
25
31
  it('error messages array is populated') do
26
- expect(subject[ERROR_MESSAGES].first.downcase).to eq('resource not found')
32
+ expect(subject[ERROR_MESSAGES].first.downcase).to eq(
33
+ 'resource not found'
34
+ )
27
35
  end
28
36
  end
29
37
  end
@@ -2,7 +2,8 @@
2
2
 
3
3
  require 'spec_helpers/client'
4
4
 
5
- RSpec.describe FinApps::REST::OrderTokens, 'initialized with valid FinApps::Client object' do
5
+ RSpec.describe FinApps::REST::OrderTokens,
6
+ 'initialized with valid FinApps::Client object' do
6
7
  include SpecHelpers::Client
7
8
 
8
9
  describe '#show' do
@@ -11,14 +12,23 @@ RSpec.describe FinApps::REST::OrderTokens, 'initialized with valid FinApps::Clie
11
12
  let(:error_messages) { show[ERROR_MESSAGES] }
12
13
 
13
14
  context 'when missing token' do
14
- it { expect { subject.show(nil) }.to raise_error(FinAppsCore::MissingArgumentsError, ': token') }
15
+ it do
16
+ expect { subject.show(nil) }.to raise_error(
17
+ FinAppsCore::MissingArgumentsError,
18
+ ': token'
19
+ )
20
+ end
15
21
  end
16
22
 
17
23
  context 'for valid token' do
18
24
  let(:show) { subject.show(:valid_token) }
19
25
  it { expect { show }.not_to raise_error }
20
- it('results is a Hashie::Rash') { expect(results).to be_a(Hashie::Mash::Rash) }
21
- it('results contains a consumer_id') { expect(results).to respond_to(:consumer_id) }
26
+ it('results is a Hashie::Rash') do
27
+ expect(results).to be_a(Hash)
28
+ end
29
+ it('results contains a consumer_id') do
30
+ expect(results).to have_key(:consumer_id)
31
+ end
22
32
  it('error_messages array is empty') { expect(error_messages).to eq([]) }
23
33
  end
24
34
 
@@ -26,7 +36,9 @@ RSpec.describe FinApps::REST::OrderTokens, 'initialized with valid FinApps::Clie
26
36
  let(:show) { subject.show(:invalid_token) }
27
37
  it { expect { show }.not_to raise_error }
28
38
  it('results is nil') { expect(results).to be_nil }
29
- it('error messages array is populated') { expect(error_messages.first.downcase).to eq('resource not found') }
39
+ it('error messages array is populated') do
40
+ expect(error_messages.first.downcase).to eq('resource not found')
41
+ end
30
42
  end
31
43
  end
32
44
  end