Permalink
Browse files

Only mock calls when test mode is on *and* the request is either for …

…the auth or callback paths (not for all requests).
  • Loading branch information...
1 parent 2d1248e commit 5d5161b44e19fdcf0d07ed23cdc435f61bf419df @laserlemon laserlemon committed Jan 13, 2011
Showing with 7 additions and 0 deletions.
  1. +2 −0 oa-core/lib/omniauth/strategy.rb
  2. +5 −0 oa-core/spec/omniauth/strategy_spec.rb
View
2 oa-core/lib/omniauth/strategy.rb
@@ -48,6 +48,8 @@ def mock_call!(env)
elsif request.path == callback_path
@env['omniauth.auth'] = OmniAuth.mock_auth_for(name.to_sym)
call_app!
+ else
+ call_app!
end
end
View
5 oa-core/spec/omniauth/strategy_spec.rb
@@ -142,6 +142,11 @@ def callback_phase
response[1]['Location'].should == '/auth/test/callback'
end
+ it 'should not short circuit requests outside of authentication' do
+ env = {'PATH_INFO' => '/'}
+ strategy.call(env).should == app.call(env)
+ end
+
it 'should respond with the default hash if none is set' do
strategy.call 'PATH_INFO' => '/auth/test/callback'
strategy.env['omniauth.auth']['uid'].should == '1234'

0 comments on commit 5d5161b

Please sign in to comment.