Skip to content
This repository has been archived by the owner on Mar 14, 2020. It is now read-only.

Commit

Permalink
Add test for uid lookup function
Browse files Browse the repository at this point in the history
  • Loading branch information
VivianChu authored and mcritchlow committed Nov 5, 2019
1 parent 3a49e26 commit 9961a0c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
1 change: 0 additions & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,5 @@ class Application < Rails::Application
config.action_mailer.smtp_settings = { address: ENV.fetch('APPS_H5_EMAIL_SMTP_HOST'),
port: ENV.fetch('APPS_H5_EMAIL_SMTP_PORT') }
end
# Only production (staging eventually)
end
end
1 change: 0 additions & 1 deletion config/environments/test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Test w/ OmniAuth "test mode"

# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
Expand Down
19 changes: 18 additions & 1 deletion spec/models/user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
provider: 'google_oauth2',
uid: 'test'
})}

describe "#developer?" do
it 'should return true when provider is developer' do
auth_hash.provider = 'developer'
Expand Down Expand Up @@ -82,4 +81,22 @@
end
end
end

describe '.employee_uid' do
context 'when google-oauth uid is a number' do
before(:all) do
@employee = Employee.create(email: 'test@ucsd.edu',
uid: 'test', name: 'Dr. Seuss', display_name: 'Dr.', manager: 'manager1')
@employee.save!
end
after(:all) do
@employee.delete
end

it 'converts google-oauth uid to AD uid' do
uid = described_class.employee_uid(auth_hash.info.email, auth_hash.uid)
expect(uid).to eq(@employee.uid)
end
end
end
end

0 comments on commit 9961a0c

Please sign in to comment.