implement openID authentication
This commit is contained in:
parent
37e026a9fb
commit
600adde6ba
23 changed files with 408 additions and 14 deletions
|
|
@ -4,7 +4,7 @@ module LoginMacros
|
|||
|
||||
fill_in 'user_email', with: user.email
|
||||
fill_in 'user_password', with: user.password
|
||||
find(:xpath, "//div[@id='content']//input[@name='commit']").click
|
||||
find(:xpath, "//div[@id='content']//button[@type='submit']").click
|
||||
|
||||
expect(page.has_content?('Signed in successfully')).to be true
|
||||
end
|
||||
|
|
|
|||
64
spec/support/omniauth_macros.rb
Normal file
64
spec/support/omniauth_macros.rb
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
module OmniauthMacros
|
||||
# The mock_auth configuration allows you to set per-provider (or default)
|
||||
# authentication hashes to return during integration testing.
|
||||
|
||||
def mock_auth_new_user
|
||||
OmniAuth.config.mock_auth[:google] = OmniAuth::AuthHash.new({
|
||||
provider: 'google',
|
||||
uid: 'google-test-uid-1',
|
||||
info: {
|
||||
email: 'test-1@gmail.com'
|
||||
},
|
||||
credentials: {
|
||||
token: 'mock_token',
|
||||
secret: 'mock_secret'
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
def mock_auth_new_user_fb
|
||||
OmniAuth.config.mock_auth[:facebook] = OmniAuth::AuthHash.new({
|
||||
provider: 'google',
|
||||
uid: 'facebook-test-uid-1',
|
||||
info: {
|
||||
email: 'test-1@gmail.com'
|
||||
},
|
||||
credentials: {
|
||||
token: 'mock_token',
|
||||
secret: 'mock_secret'
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
def mock_auth_existing_user_participant
|
||||
# The mock_auth configuration allows you to set per-provider (or default)
|
||||
# authentication hashes to return during integration testing.
|
||||
OmniAuth.config.mock_auth[:google] = OmniAuth::AuthHash.new({
|
||||
provider: 'google',
|
||||
uid: 'google-test-uid-participant-1',
|
||||
info: {
|
||||
email: 'test-participant-1@google.com'
|
||||
},
|
||||
credentials: {
|
||||
token: 'mock_token',
|
||||
secret: 'mock_secret'
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
def mock_auth_existing_user_admin
|
||||
# The mock_auth configuration allows you to set per-provider (or default)
|
||||
# authentication hashes to return during integration testing.
|
||||
OmniAuth.config.mock_auth[:google] = OmniAuth::AuthHash.new({
|
||||
provider: 'google',
|
||||
uid: 'google-test-uid-admin-1',
|
||||
info: {
|
||||
email: 'test-admin-1@google.com'
|
||||
},
|
||||
credentials: {
|
||||
token: 'mock_token',
|
||||
secret: 'mock_secret'
|
||||
}
|
||||
})
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue