1
0
Fork 0
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:
laserlemon 2011-01-13 10:34:00 -05:00
parent 2d1248e60f
commit 5d5161b44e
2 changed files with 7 additions and 0 deletions

View file

@ -48,6 +48,8 @@ module OmniAuth
elsif request.path == callback_path elsif request.path == callback_path
@env['omniauth.auth'] = OmniAuth.mock_auth_for(name.to_sym) @env['omniauth.auth'] = OmniAuth.mock_auth_for(name.to_sym)
call_app! call_app!
else
call_app!
end end
end end

View file

@ -142,6 +142,11 @@ describe OmniAuth::Strategy do
response[1]['Location'].should == '/auth/test/callback' response[1]['Location'].should == '/auth/test/callback'
end 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 it 'should respond with the default hash if none is set' do
strategy.call 'PATH_INFO' => '/auth/test/callback' strategy.call 'PATH_INFO' => '/auth/test/callback'
strategy.env['omniauth.auth']['uid'].should == '1234' strategy.env['omniauth.auth']['uid'].should == '1234'