Skip to content

Commit

Permalink
Merge pull request Shopify#23 from RootTJNII/TJNII-UpdateRubocop
Browse files Browse the repository at this point in the history
Update Rubocop to 0.74 and resolve ensuring tickets
  • Loading branch information
Jonathan Pulsifer authored Dec 7, 2020
2 parents 9101f6c + 922c943 commit 5d344dc
Show file tree
Hide file tree
Showing 10 changed files with 86 additions and 74 deletions.
11 changes: 8 additions & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
# http://shopify.github.io/ruby-style-guide/

AllCops:
TargetRubyVersion: 2.2
TargetRubyVersion: 2.6

# Allow .ruby-version and spec.required_ruby_version to differ
# to run a newer Ruby version for Rubocop, but don't force users to upgrade
Gemspec/RequiredRubyVersion:
Enabled: false

Rails:
Enabled: false
Expand All @@ -19,7 +24,7 @@ Layout/MultilineOperationIndentation:
Layout/AlignParameters:
EnforcedStyle: with_fixed_indentation

Layout/FirstParameterIndentation:
Layout/IndentFirstArgument:
EnforcedStyle: consistent

Style/TrailingCommaInArrayLiteral:
Expand All @@ -34,7 +39,7 @@ Style/NumericLiterals:
Layout/CaseIndentation:
EnforcedStyle: end

Layout/IndentHash:
Layout/IndentFirstHashElement:
EnforcedStyle: consistent

Style/WordArray:
Expand Down
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.6.0
2 changes: 1 addition & 1 deletion lib/oktakit/error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def initialize(response = nil)
# Array of validation errors
# @return [Array<Hash>] Error info
def errors
if data && data.is_a?(Hash)
if data&.is_a?(Hash)
data[:errors] || []
else
[]
Expand Down
32 changes: 17 additions & 15 deletions spec/client/apps_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
it 'returns updated application' do
VCR.use_cassette 'update_application', record: :new_episodes do
resp, = client.update_application(APPS_APP_ID,
id: APPS_APP_ID,
signOnMode: "SAML_2_0")
id: APPS_APP_ID,
signOnMode: "SAML_2_0")
expect(resp.id).to be == APPS_APP_ID
end
end
Expand Down Expand Up @@ -81,11 +81,11 @@
it 'returns application user' do
VCR.use_cassette 'assign_user_to_application_for_sso' do
resp, status = client.assign_user_to_application_for_sso(APPS_APP_ID,
id: APPS_USER_ID,
scope: "USER",
credentials: {
userName: "[email protected]"
})
id: APPS_USER_ID,
scope: "USER",
credentials: {
userName: "[email protected]"
})
expect(status).to be(200)
expect(resp.id).to be == '00u6nm9ytbmwHeunx0h7'
end
Expand All @@ -95,11 +95,13 @@
describe '#assign_user_to_application_for_sso_provisioning' do
it 'returns application user with user profile mappings applied' do
VCR.use_cassette 'assign_user_to_application_for_sso_provisioning', record: :new_episodes do
resp, status = client.assign_user_to_application_for_sso_provisioning(APPS_APP_ID,
resp, status = client.assign_user_to_application_for_sso_provisioning(
APPS_APP_ID,
id: APPS_USER_ID,
scope: "USER",
credentials: { userName: "[email protected]" },
profile: {})
profile: {}
)
expect(status).to be(200)
expect(resp.id).to be == '00u6nm9ytbmwHeunx0h7'
end
Expand Down Expand Up @@ -128,12 +130,12 @@
it 'returns application user' do
VCR.use_cassette 'update_application_credentials_for_assigned_user', record: :new_episodes do
resp, = client.update_application_credentials_for_assigned_user(APPS_APP_ID, APPS_USER_ID,
credentials: {
userName: "[email protected]",
password: {
value: "newPassword"
}
})
credentials: {
userName: "[email protected]",
password: {
value: "newPassword"
}
})
expect(resp.id).to be == '00u6nm9ytbmwHeunx0h7'
end
end
Expand Down
10 changes: 5 additions & 5 deletions spec/client/factors_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@
it 'returns all responses return the enrolled factor with a status of either pending_activation or active.' do
VCR.use_cassette 'enroll_factor', record: :new_episodes do
resp, = client.enroll_factor(FACTORS_USER_ID,
factorType: "sms",
provider: "OKTA",
profile: {
phoneNumber: "+1-613-456-1234"
})
factorType: "sms",
provider: "OKTA",
profile: {
phoneNumber: "+1-613-456-1234"
})
expect(resp.id).not_to be_nil
end
end
Expand Down
8 changes: 4 additions & 4 deletions spec/client/groups_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@
it 'returns updated group' do
VCR.use_cassette 'update_group' do
resp, = client.update_group(GROUPS_GROUP_ID,
profile: {
name: "New Name for the Group",
description: "New Name for the Group"
})
profile: {
name: "New Name for the Group",
description: "New Name for the Group"
})
expect(resp.profile.name).to be == "New Name for the Group"
end
end
Expand Down
12 changes: 7 additions & 5 deletions spec/client/identity_providers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@
describe '#update_identity_provider' do
it 'returns updated identity provider' do
VCR.use_cassette 'update_identity_provider', record: :new_episodes do
_, status = client.update_identity_provider(IDENTITY_PROVIDERS_IDENTITY_ID,
_, status = client.update_identity_provider(
IDENTITY_PROVIDERS_IDENTITY_ID,
id: "0oa62bfdjnK55Z5x80h7",
type: "SAML2",
name: "Example IdP",
Expand Down Expand Up @@ -158,7 +159,8 @@
matchType: "USERNAME"
},
maxClockSkew: 120000
})
}
)
expect(status).to be(200)
end
end
Expand Down Expand Up @@ -240,9 +242,9 @@
it 'returns identity provider transaction' do
VCR.use_cassette 'link_idp_user', record: :new_episodes do
resp, = client.link_idp_user(IDENTITY_PROVIDERS_TRANSACTION_ID, IDENTITY_PROVIDERS_USER_ID,
profile: {
userType: "Social"
})
profile: {
userType: "Social"
})
expect(resp.id).not_to be_nil
end
end
Expand Down
24 changes: 12 additions & 12 deletions spec/client/templates_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@
it 'returns updated sms template' do
VCR.use_cassette 'update_sms_template' do
_, status = client.update_sms_template(TEMPLATES_TEMPLATE_ID,
name: "Custom",
type: "SMS_VERIFY_CODE",
template: "Your ${org.name} code is: ${code}",
translations:
{
es: "${org.name}: ${code}.",
fr: "${org.name}: ${code}.",
it: "${org.name}: ${code}."
})
name: "Custom",
type: "SMS_VERIFY_CODE",
template: "Your ${org.name} code is: ${code}",
translations:
{
es: "${org.name}: ${code}.",
fr: "${org.name}: ${code}.",
it: "${org.name}: ${code}."
})
expect(status).to be(200)
end
end
Expand All @@ -62,9 +62,9 @@
it 'returns updated sms template' do
VCR.use_cassette 'partial_sms_template_update' do
resp, = client.partial_sms_template_update(TEMPLATES_TEMPLATE_ID,
translations: {
de: "${org.name}: ihre bestätigungscode ist ${code}."
})
translations: {
de: "${org.name}: ihre bestätigungscode ist ${code}."
})
expect(resp.translations.de).to be == '${org.name}: ihre bestätigungscode ist ${code}.'
end
end
Expand Down
58 changes: 30 additions & 28 deletions spec/client/users_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@
it 'returns updated user' do
VCR.use_cassette 'update_user' do
resp, = client.update_user(USERS_USER_ID,
profile: {
firstName: "Bob",
lastName: "User",
email: "[email protected]",
login: "[email protected]"
})
profile: {
firstName: "Bob",
lastName: "User",
email: "[email protected]",
login: "[email protected]"
})
expect(resp.profile.firstName).to be == 'Bob'
end
end
Expand All @@ -67,13 +67,13 @@
it 'returns updated user' do
VCR.use_cassette 'update_user_partial' do
resp, = client.update_user(USERS_USER_ID,
profile: {
firstName: "Bob",
lastName: "User",
email: "[email protected]",
login: "[email protected]"
},
partial: true)
profile: {
firstName: "Bob",
lastName: "User",
email: "[email protected]",
login: "[email protected]"
},
partial: true)
expect(resp.profile.firstName).to be == 'Bob'
end
end
Expand All @@ -83,12 +83,12 @@
it 'returns updated user' do
VCR.use_cassette 'update_profile' do
resp, = client.update_profile(USERS_USER_ID,
profile: {
firstName: "Other Bob",
lastName: "User",
email: "[email protected]",
login: "[email protected]"
})
profile: {
firstName: "Other Bob",
lastName: "User",
email: "[email protected]",
login: "[email protected]"
})
expect(resp.profile.firstName).to be == 'Other Bob'
end
end
Expand Down Expand Up @@ -187,9 +187,11 @@
describe '#forgot_password' do
it 'returns an empty object by default.' do
VCR.use_cassette 'forgot_password' do
resp, = client.forgot_password(USERS_USER_ID,
resp, = client.forgot_password(
USERS_USER_ID,
password: { value: "123Password!" },
recovery_question: { answer: "A woodchuck could chuck as much as he could chuck." })
recovery_question: { answer: "A woodchuck could chuck as much as he could chuck." }
)
expect(resp.password.to_h).to be == {}
end
end
Expand All @@ -199,8 +201,8 @@
it 'returns credentials of the user' do
VCR.use_cassette 'change_password' do
_, status = client.change_password(USERS_USER_ID,
oldPassword: { value: "uTVM,TPw55" },
newPassword: { value: "NewPassword1234!" })
oldPassword: { value: "uTVM,TPw55" },
newPassword: { value: "NewPassword1234!" })
expect(status).to be(200)
end
end
Expand All @@ -210,11 +212,11 @@
it 'returns credentials of the user' do
VCR.use_cassette 'change_recovery_question' do
resp, = client.change_recovery_question(USERS_USER_ID,
password: { value: "NewPassword1234!" },
recovery_question: {
question: "Where is Shopify's HQ?",
answer: "Ottawa"
})
password: { value: "NewPassword1234!" },
recovery_question: {
question: "Where is Shopify's HQ?",
answer: "Ottawa"
})
expect(resp.recovery_question.question).to be == "Where is Shopify's HQ?"
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/pagination_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
it 'should send query parameters in each page request' do
VCR.use_cassette 'pagination_with_query_params' do
users, = client.list_users_assigned_to_application(PAGED_APPS_APP_ID,
paginate: true, query: { expand: 'user', limit: '1' })
paginate: true, query: { expand: 'user', limit: '1' })
users.each do |user|
expect(user._embedded).not_to be_nil, "User #{user.id} was expected to have expanded user profile in _embedded"
end
Expand Down

0 comments on commit 5d344dc

Please sign in to comment.