mirror of
https://github.com/omniauth/omniauth.git
synced 2022-11-09 12:31:49 -05:00
Only mock calls when test mode is on *and* the request is either for the auth or callback paths (not for all requests).
This commit is contained in:
parent
2d1248e60f
commit
5d5161b44e
2 changed files with 7 additions and 0 deletions
|
@ -48,6 +48,8 @@ module OmniAuth
|
|||
elsif request.path == callback_path
|
||||
@env['omniauth.auth'] = OmniAuth.mock_auth_for(name.to_sym)
|
||||
call_app!
|
||||
else
|
||||
call_app!
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -142,6 +142,11 @@ describe OmniAuth::Strategy do
|
|||
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'
|
||||
|
|
Loading…
Add table
Reference in a new issue