Facemock::OAuth will mock the oauth of facebook using facemock.
Add this line to your application's Gemfile:
gem 'facemock-oauth'
And then execute:
$ bundle
Or install it yourself as:
$ gem install facemock-oauth
for Rails
$ vi config/routes.rb
YourApp::Application.routes.draw do
devise_scope :user do
match ':provider/sign_in', to: 'your_sign_in_controller'
match 'users/facemock/auth/callback', to: 'your_callback_controller'
end
end
$ vi config/environments/development.rb
Facemock::OAuth::LoginHook.paths = [ '/facebook/sign_in', '/user/facebook/sign_in' ]
Facemock::OAuth::CallbackHook.path = '/users/facemock/auth/callback'
config.middleware.use Facemock::OAuth::LoginHook
config.middleware.use Facemock::OAuth::Login
config.middleware.use Facemock::OAuth::Authentication
config.middleware.use Facemock::OAuth::CallbackHook
for Sinatra
$ vi config.ru
require 'sinatra'
require 'facemock-oauth'
Facemock::OAuth::LoginHook.paths = [ '/facebook/sign_in', '/user/facebook/sign_in' ]
Facemock::OAuth::CallbackHook.path = '/users/facemock/auth/callback'
use Facemock::OAuth::LoginHook
use Facemock::OAuth::Login
use Facemock::OAuth::Authentication
use Facemock::OAuth::CallbackHook
require File.expand_path 'app', File.dirname(__FILE__)
run Sinatra::Application
See the https://github.com/ogawatti/facemock.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request