Skip to content

Commit 922c943

Browse files
committed
Update Rubocop to 0.74 and resolve ensuring tickets
1 parent 5670f09 commit 922c943

File tree

10 files changed

+86
-74
lines changed

10 files changed

+86
-74
lines changed

.rubocop.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
# http://shopify.github.io/ruby-style-guide/
33

44
AllCops:
5-
TargetRubyVersion: 2.2
5+
TargetRubyVersion: 2.6
6+
7+
# Allow .ruby-version and spec.required_ruby_version to differ
8+
# to run a newer Ruby version for Rubocop, but don't force users to upgrade
9+
Gemspec/RequiredRubyVersion:
10+
Enabled: false
611

712
Rails:
813
Enabled: false
@@ -19,7 +24,7 @@ Layout/MultilineOperationIndentation:
1924
Layout/AlignParameters:
2025
EnforcedStyle: with_fixed_indentation
2126

22-
Layout/FirstParameterIndentation:
27+
Layout/IndentFirstArgument:
2328
EnforcedStyle: consistent
2429

2530
Style/TrailingCommaInArrayLiteral:
@@ -34,7 +39,7 @@ Style/NumericLiterals:
3439
Layout/CaseIndentation:
3540
EnforcedStyle: end
3641

37-
Layout/IndentHash:
42+
Layout/IndentFirstHashElement:
3843
EnforcedStyle: consistent
3944

4045
Style/WordArray:

.ruby-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.6.0

lib/oktakit/error.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def initialize(response = nil)
4141
# Array of validation errors
4242
# @return [Array<Hash>] Error info
4343
def errors
44-
if data && data.is_a?(Hash)
44+
if data&.is_a?(Hash)
4545
data[:errors] || []
4646
else
4747
[]

spec/client/apps_spec.rb

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
it 'returns updated application' do
4141
VCR.use_cassette 'update_application', record: :new_episodes do
4242
resp, = client.update_application(APPS_APP_ID,
43-
id: APPS_APP_ID,
44-
signOnMode: "SAML_2_0")
43+
id: APPS_APP_ID,
44+
signOnMode: "SAML_2_0")
4545
expect(resp.id).to be == APPS_APP_ID
4646
end
4747
end
@@ -81,11 +81,11 @@
8181
it 'returns application user' do
8282
VCR.use_cassette 'assign_user_to_application_for_sso' do
8383
resp, status = client.assign_user_to_application_for_sso(APPS_APP_ID,
84-
id: APPS_USER_ID,
85-
scope: "USER",
86-
credentials: {
87-
userName: "[email protected]"
88-
})
84+
id: APPS_USER_ID,
85+
scope: "USER",
86+
credentials: {
87+
userName: "[email protected]"
88+
})
8989
expect(status).to be(200)
9090
expect(resp.id).to be == '00u6nm9ytbmwHeunx0h7'
9191
end
@@ -95,11 +95,13 @@
9595
describe '#assign_user_to_application_for_sso_provisioning' do
9696
it 'returns application user with user profile mappings applied' do
9797
VCR.use_cassette 'assign_user_to_application_for_sso_provisioning', record: :new_episodes do
98-
resp, status = client.assign_user_to_application_for_sso_provisioning(APPS_APP_ID,
98+
resp, status = client.assign_user_to_application_for_sso_provisioning(
99+
APPS_APP_ID,
99100
id: APPS_USER_ID,
100101
scope: "USER",
101102
credentials: { userName: "[email protected]" },
102-
profile: {})
103+
profile: {}
104+
)
103105
expect(status).to be(200)
104106
expect(resp.id).to be == '00u6nm9ytbmwHeunx0h7'
105107
end
@@ -128,12 +130,12 @@
128130
it 'returns application user' do
129131
VCR.use_cassette 'update_application_credentials_for_assigned_user', record: :new_episodes do
130132
resp, = client.update_application_credentials_for_assigned_user(APPS_APP_ID, APPS_USER_ID,
131-
credentials: {
132-
userName: "[email protected]",
133-
password: {
134-
value: "newPassword"
135-
}
136-
})
133+
credentials: {
134+
userName: "[email protected]",
135+
password: {
136+
value: "newPassword"
137+
}
138+
})
137139
expect(resp.id).to be == '00u6nm9ytbmwHeunx0h7'
138140
end
139141
end

spec/client/factors_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@
4545
it 'returns all responses return the enrolled factor with a status of either pending_activation or active.' do
4646
VCR.use_cassette 'enroll_factor', record: :new_episodes do
4747
resp, = client.enroll_factor(FACTORS_USER_ID,
48-
factorType: "sms",
49-
provider: "OKTA",
50-
profile: {
51-
phoneNumber: "+1-613-456-1234"
52-
})
48+
factorType: "sms",
49+
provider: "OKTA",
50+
profile: {
51+
phoneNumber: "+1-613-456-1234"
52+
})
5353
expect(resp.id).not_to be_nil
5454
end
5555
end

spec/client/groups_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@
4040
it 'returns updated group' do
4141
VCR.use_cassette 'update_group' do
4242
resp, = client.update_group(GROUPS_GROUP_ID,
43-
profile: {
44-
name: "New Name for the Group",
45-
description: "New Name for the Group"
46-
})
43+
profile: {
44+
name: "New Name for the Group",
45+
description: "New Name for the Group"
46+
})
4747
expect(resp.profile.name).to be == "New Name for the Group"
4848
end
4949
end

spec/client/identity_providers_spec.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@
9595
describe '#update_identity_provider' do
9696
it 'returns updated identity provider' do
9797
VCR.use_cassette 'update_identity_provider', record: :new_episodes do
98-
_, status = client.update_identity_provider(IDENTITY_PROVIDERS_IDENTITY_ID,
98+
_, status = client.update_identity_provider(
99+
IDENTITY_PROVIDERS_IDENTITY_ID,
99100
id: "0oa62bfdjnK55Z5x80h7",
100101
type: "SAML2",
101102
name: "Example IdP",
@@ -158,7 +159,8 @@
158159
matchType: "USERNAME"
159160
},
160161
maxClockSkew: 120000
161-
})
162+
}
163+
)
162164
expect(status).to be(200)
163165
end
164166
end
@@ -240,9 +242,9 @@
240242
it 'returns identity provider transaction' do
241243
VCR.use_cassette 'link_idp_user', record: :new_episodes do
242244
resp, = client.link_idp_user(IDENTITY_PROVIDERS_TRANSACTION_ID, IDENTITY_PROVIDERS_USER_ID,
243-
profile: {
244-
userType: "Social"
245-
})
245+
profile: {
246+
userType: "Social"
247+
})
246248
expect(resp.id).not_to be_nil
247249
end
248250
end

spec/client/templates_spec.rb

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@
4444
it 'returns updated sms template' do
4545
VCR.use_cassette 'update_sms_template' do
4646
_, status = client.update_sms_template(TEMPLATES_TEMPLATE_ID,
47-
name: "Custom",
48-
type: "SMS_VERIFY_CODE",
49-
template: "Your ${org.name} code is: ${code}",
50-
translations:
51-
{
52-
es: "${org.name}: ${code}.",
53-
fr: "${org.name}: ${code}.",
54-
it: "${org.name}: ${code}."
55-
})
47+
name: "Custom",
48+
type: "SMS_VERIFY_CODE",
49+
template: "Your ${org.name} code is: ${code}",
50+
translations:
51+
{
52+
es: "${org.name}: ${code}.",
53+
fr: "${org.name}: ${code}.",
54+
it: "${org.name}: ${code}."
55+
})
5656
expect(status).to be(200)
5757
end
5858
end
@@ -62,9 +62,9 @@
6262
it 'returns updated sms template' do
6363
VCR.use_cassette 'partial_sms_template_update' do
6464
resp, = client.partial_sms_template_update(TEMPLATES_TEMPLATE_ID,
65-
translations: {
66-
de: "${org.name}: ihre bestätigungscode ist ${code}."
67-
})
65+
translations: {
66+
de: "${org.name}: ihre bestätigungscode ist ${code}."
67+
})
6868
expect(resp.translations.de).to be == '${org.name}: ihre bestätigungscode ist ${code}.'
6969
end
7070
end

spec/client/users_spec.rb

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@
5252
it 'returns updated user' do
5353
VCR.use_cassette 'update_user' do
5454
resp, = client.update_user(USERS_USER_ID,
55-
profile: {
56-
firstName: "Bob",
57-
lastName: "User",
58-
59-
60-
})
55+
profile: {
56+
firstName: "Bob",
57+
lastName: "User",
58+
59+
60+
})
6161
expect(resp.profile.firstName).to be == 'Bob'
6262
end
6363
end
@@ -67,13 +67,13 @@
6767
it 'returns updated user' do
6868
VCR.use_cassette 'update_user_partial' do
6969
resp, = client.update_user(USERS_USER_ID,
70-
profile: {
71-
firstName: "Bob",
72-
lastName: "User",
73-
74-
75-
},
76-
partial: true)
70+
profile: {
71+
firstName: "Bob",
72+
lastName: "User",
73+
74+
75+
},
76+
partial: true)
7777
expect(resp.profile.firstName).to be == 'Bob'
7878
end
7979
end
@@ -83,12 +83,12 @@
8383
it 'returns updated user' do
8484
VCR.use_cassette 'update_profile' do
8585
resp, = client.update_profile(USERS_USER_ID,
86-
profile: {
87-
firstName: "Other Bob",
88-
lastName: "User",
89-
90-
91-
})
86+
profile: {
87+
firstName: "Other Bob",
88+
lastName: "User",
89+
90+
91+
})
9292
expect(resp.profile.firstName).to be == 'Other Bob'
9393
end
9494
end
@@ -187,9 +187,11 @@
187187
describe '#forgot_password' do
188188
it 'returns an empty object by default.' do
189189
VCR.use_cassette 'forgot_password' do
190-
resp, = client.forgot_password(USERS_USER_ID,
190+
resp, = client.forgot_password(
191+
USERS_USER_ID,
191192
password: { value: "123Password!" },
192-
recovery_question: { answer: "A woodchuck could chuck as much as he could chuck." })
193+
recovery_question: { answer: "A woodchuck could chuck as much as he could chuck." }
194+
)
193195
expect(resp.password.to_h).to be == {}
194196
end
195197
end
@@ -199,8 +201,8 @@
199201
it 'returns credentials of the user' do
200202
VCR.use_cassette 'change_password' do
201203
_, status = client.change_password(USERS_USER_ID,
202-
oldPassword: { value: "uTVM,TPw55" },
203-
newPassword: { value: "NewPassword1234!" })
204+
oldPassword: { value: "uTVM,TPw55" },
205+
newPassword: { value: "NewPassword1234!" })
204206
expect(status).to be(200)
205207
end
206208
end
@@ -210,11 +212,11 @@
210212
it 'returns credentials of the user' do
211213
VCR.use_cassette 'change_recovery_question' do
212214
resp, = client.change_recovery_question(USERS_USER_ID,
213-
password: { value: "NewPassword1234!" },
214-
recovery_question: {
215-
question: "Where is Shopify's HQ?",
216-
answer: "Ottawa"
217-
})
215+
password: { value: "NewPassword1234!" },
216+
recovery_question: {
217+
question: "Where is Shopify's HQ?",
218+
answer: "Ottawa"
219+
})
218220
expect(resp.recovery_question.question).to be == "Where is Shopify's HQ?"
219221
end
220222
end

spec/pagination_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
it 'should send query parameters in each page request' do
1515
VCR.use_cassette 'pagination_with_query_params' do
1616
users, = client.list_users_assigned_to_application(PAGED_APPS_APP_ID,
17-
paginate: true, query: { expand: 'user', limit: '1' })
17+
paginate: true, query: { expand: 'user', limit: '1' })
1818
users.each do |user|
1919
expect(user._embedded).not_to be_nil, "User #{user.id} was expected to have expanded user profile in _embedded"
2020
end

0 commit comments

Comments
 (0)