From 4184396ca7ebb1b4c02058682143b19d088bb444 Mon Sep 17 00:00:00 2001 From: Stella Rouzi Date: Fri, 25 Jul 2014 18:48:04 +0300 Subject: [PATCH] user omniauth with mock credentials in development --- config/environments/development.rb | 47 +++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/config/environments/development.rb b/config/environments/development.rb index 14a4bdc6..0d193747 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -31,10 +31,55 @@ Osem::Application.configure do # Expands the lines which load the assets config.assets.debug = true - # Do not eager load code on boot. + # Do not eager load code on boot. config.eager_load = false # Set the detault url for action mailer config.action_mailer.default_url_options = { host: CONFIG['url_for_emails'] } + # Use omniauth mock credentials + OmniAuth.config.test_mode = true + + OmniAuth.config.mock_auth[:facebook] = + OmniAuth::AuthHash.new( + provider: 'facebook', + uid: 'facebook-test-uid-1', + info: { + name: 'admin admin', + email: 'admin@email.com' + }, + credentials: { + token: 'fb_mock_token', + secret: 'fb_mock_secret' + } + ) + + OmniAuth.config.mock_auth[:google] = + OmniAuth::AuthHash.new( + provider: 'google', + uid: 'google-test-uid-1', + info: { + name: 'simple user', + email: 'user0@email.com' + }, + credentials: { + token: 'google_mock_token', + secret: 'google_mock_secret' + } + ) + + OmniAuth.config.mock_auth[:novell] = + OmniAuth::AuthHash.new( + provider: 'novell', + uid: 'novell-test-uid-1', + info: { + name: 'another user', + email: 'user1@email.com' + }, + credentials: { + token: 'novell_mock_token', + secret: 'novell_mock_secret' + } + ) + end