mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
added email presence validation to openid
closes #1658 added test for openid fixed robocup offences written tests for email presence validation minor changes shifted omniauth callback tests to rspec controllers fixed linting bug minor changes minor changes
This commit is contained in:
parent
2df8adea69
commit
83053f4626
5 changed files with 62 additions and 1 deletions
31
spec/controllers/users/omniauth_callbacks_controller_spec.rb
Normal file
31
spec/controllers/users/omniauth_callbacks_controller_spec.rb
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Users::OmniauthCallbacksController do
|
||||
context 'email is not there in auth hash' do
|
||||
before do
|
||||
stub_env_for_omniauth
|
||||
get :google
|
||||
end
|
||||
|
||||
it { expect(flash[:error]).to eq('Email field is missing in your google account') }
|
||||
end
|
||||
end
|
||||
|
||||
def stub_env_for_omniauth
|
||||
request.env['devise.mapping'] = Devise.mappings[:user]
|
||||
env = OmniAuth::AuthHash.new(
|
||||
provider: 'google',
|
||||
uid: 'google-test-uid-1',
|
||||
info: {
|
||||
name: 'google user',
|
||||
email: nil,
|
||||
username: 'user_google'
|
||||
},
|
||||
credentials: {
|
||||
token: 'google_mock_token',
|
||||
secret: 'google_mock_secret'
|
||||
}
|
||||
)
|
||||
request.env['omniauth.auth'] = env
|
||||
@controller.stub(:env).and_return(env)
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue