osem-fcy/spec/support/omniauth_macros.rb

69 lines
2.7 KiB
Ruby
Raw Normal View History

2014-06-18 16:58:30 +03:00
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
2014-06-18 18:59:01 +03:00
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'
}
)
2014-06-18 16:58:30 +03:00
end
2014-06-18 18:05:28 +03:00
def mock_auth_new_user_fb
2014-06-18 18:59:01 +03:00
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'
}
)
2014-06-18 16:58:30 +03:00
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.
2014-06-18 18:59:01 +03:00
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'
}
)
2014-06-18 16:58:30 +03:00
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.
2014-06-18 18:59:01 +03:00
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'
}
)
2014-06-18 16:58:30 +03:00
end
2014-06-18 18:05:28 +03:00
end