Permalink
Browse files

Adding a strategy aggregator.

  • Loading branch information...
1 parent ea6bbbe commit 9807bf399e730f89515557472dc6118fc4ccf794 Michael Bleigh committed Nov 15, 2010
Showing with 15 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +4 −0 oa-core/lib/omniauth/core.rb
  3. +1 −0 oa-core/lib/omniauth/strategy.rb
  4. +9 −0 oa-core/spec/omniauth/core_spec.rb
View
@@ -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|

0 comments on commit 9807bf3

Please sign in to comment.