1
0
Fork 0
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:
Michael Bleigh 2010-11-15 10:00:05 -06:00
parent ea6bbbecca
commit 9807bf399e
4 changed files with 15 additions and 0 deletions

1
.gitignore vendored
View file

@ -24,6 +24,7 @@ rdoc
pkg
tmp
oa-live
## PROJECT::SPECIFIC
*.gem
.bundle

View file

@ -11,6 +11,10 @@ module OmniAuth
module Strategies
autoload :Password, 'omniauth/strategies/password'
end
def self.strategies
@@strategies ||= []
end
class Configuration
include Singleton

View file

@ -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

View file

@ -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|