mirror of
https://github.com/omniauth/omniauth.git
synced 2022-11-09 12:31:49 -05:00
Adding a strategy aggregator.
This commit is contained in:
parent
ea6bbbecca
commit
9807bf399e
4 changed files with 15 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -24,6 +24,7 @@ rdoc
|
|||
pkg
|
||||
tmp
|
||||
oa-live
|
||||
|
||||
## PROJECT::SPECIFIC
|
||||
*.gem
|
||||
.bundle
|
||||
|
|
|
@ -11,6 +11,10 @@ module OmniAuth
|
|||
module Strategies
|
||||
autoload :Password, 'omniauth/strategies/password'
|
||||
end
|
||||
|
||||
def self.strategies
|
||||
@@strategies ||= []
|
||||
end
|
||||
|
||||
class Configuration
|
||||
include Singleton
|
||||
|
|
|
@ -5,6 +5,7 @@ module OmniAuth
|
|||
module Strategy
|
||||
|
||||
def self.included(base)
|
||||
OmniAuth.strategies << base
|
||||
base.class_eval do
|
||||
attr_reader :app, :name, :env, :options, :response
|
||||
end
|
||||
|
|
|
@ -1,6 +1,15 @@
|
|||
require File.dirname(__FILE__) + '/../spec_helper'
|
||||
|
||||
describe OmniAuth do
|
||||
describe '.strategies' do
|
||||
it 'should increase when a new strategy is made' do
|
||||
lambda{ class ExampleStrategy
|
||||
include OmniAuth::Strategy
|
||||
end }.should change(OmniAuth.strategies, :size).by(1)
|
||||
OmniAuth.strategies.last.should == ExampleStrategy
|
||||
end
|
||||
end
|
||||
|
||||
context 'configuration' do
|
||||
it 'should be callable from .configure' do
|
||||
OmniAuth.configure do |c|
|
||||
|
|
Loading…
Add table
Reference in a new issue