mirror of
https://github.com/omniauth/omniauth.git
synced 2022-11-09 12:31:49 -05:00
In test mode, the underlying app shouldn't be called on request phase.
This commit is contained in:
parent
28d1934d28
commit
62c62f12cb
2 changed files with 5 additions and 11 deletions
|
@ -237,9 +237,6 @@ module OmniAuth
|
|||
|
||||
def mock_request_call
|
||||
setup_phase
|
||||
if response = call_through_to_app
|
||||
return response
|
||||
end
|
||||
|
||||
if request.params['origin']
|
||||
@env['rack.session']['omniauth.origin'] = request.params['origin']
|
||||
|
@ -356,14 +353,6 @@ module OmniAuth
|
|||
request.query_string.empty? ? "" : "?#{request.query_string}"
|
||||
end
|
||||
|
||||
def call_through_to_app
|
||||
status, headers, body = *call_app!
|
||||
session['query_params'] = Rack::Request.new(env).params
|
||||
@response = Rack::Response.new(body, status, headers)
|
||||
|
||||
status == 404 ? nil : @response.finish
|
||||
end
|
||||
|
||||
def call_app!(env = @env)
|
||||
@app.call(env)
|
||||
end
|
||||
|
|
|
@ -477,6 +477,11 @@ describe OmniAuth::Strategy do
|
|||
end
|
||||
|
||||
context 'test mode' do
|
||||
let(:app) do
|
||||
# In test mode, the underlying app shouldn't be called on request phase.
|
||||
lambda { |env| [404, {"Content-Type" => "text/html"}, []] }
|
||||
end
|
||||
|
||||
before do
|
||||
OmniAuth.config.test_mode = true
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue