Skip to content

Commit 9cefd5b

Browse files
committed
pass rubocop check
1 parent 6f1b764 commit 9cefd5b

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

app/models/user.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ def verify_calnet_attributes!(auth_extra)
7070
raise_missing_calnet_attribute_error(auth_extra, missing)
7171
end
7272

73-
def raise_missing_calnet_attribute_error(auth_extra)
73+
def raise_missing_calnet_attribute_error(auth_extra, missing)
7474
missing_attrs = "Expected Calnet attribute(s) not found (case-sensitive): #{missing.join(', ')}."
7575
actual_calnet_keys = auth_extra.keys.reject { |k| k.start_with?('duo') }.sort
76-
msg = "#{missing_attrs} The actual CalNet attributes: #{actual_calnet_keys.join(', ')}. The user is #{auth_extra['displayname']}"
76+
msg = "#{missing_attrs} The actual CalNet attributes: #{actual_calnet_keys.join(', ')}. The user is #{auth_extra['displayName']}"
7777
Rails.logger.error(msg)
7878
raise Error::CalnetError, msg
7979
end

spec/models/user_spec.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,13 @@
3939
}
4040
}
4141

42-
expect { User.from_omniauth(auth) }.to raise_error(Error::CalnetError, /Cannot find CalNet schema attribute/)
42+
missing = %w[berkeleyEduAlternateID berkeleyEduAlternateId]
43+
actual = %w[berkeleyEduAffiliations berkeleyEduAlternatid berkeleyEduCSID berkeleyEduIsMemberOf berkeleyEduUCPathID departmentNumber
44+
displayName employeeNumber givenName surname uid]
45+
# rubocop:disable Layout/LineLength
46+
msg = "Expected Calnet attribute(s) not found (case-sensitive): #{missing.join(', ')}. The actual CalNet attributes: #{actual.join(', ')}. The user is expected display name"
47+
# rubocop:enable Layout/LineLength
48+
expect { User.from_omniauth(auth) }.to raise_error(Error::CalnetError, msg)
4349
end
4450

4551
it 'populates a User object' do

0 commit comments

Comments
 (0)