spec/support/warden.rb
def _catch_warden(&block)
        result = catch(:warden, &block)

        if result.is_a?(Hash) && !warden.custom_failure? && !@controller.send(:performed?)
          result[:action] ||= :unauthenticated

          env = @controller.request.env
          env['PATH_INFO'] = "/#{result[:action]}"
          env['warden.options'] = result
          Warden::Manager._run_callbacks(:before_failure, env, result)

          status, headers, body = warden.config[:failure_app].call(env).to_a
          @controller.send :render, status: status, text: body,
            content_type: headers['Content-Type'], location: headers['Location']

          nil
        else
          result
        end
      end
# Catch warden continuations and handle like the middleware would.
# Returns nil when interrupted, otherwise the normal result of the block.
Catch warden continuations and handle like the middleware would.
Returns nil when interrupted, otherwise the normal result of the block.
Catch warden continuations and handle like the middleware would . Returns nil when interrupted otherwise the normal result of the block .
def _catch_warden(&block)
        result = catch(:warden, &block)
        if result.is_a?(Hash) && !warden.custom_failure? && !@controller.send(:performed?)
          result[:action] ||= :unauthenticated
          env = @controller.request.env
          env['PATH_INFO'] = "/#{result[:action]}"
          env['warden.options'] = result
          Warden::Manager._run_callbacks(:before_failure, env, result)
          status, headers, body = warden.config[:failure_app].call(env).to_a
          @controller.send :render, status: status, text: body,
            content_type: headers['Content-Type'], location: headers['Location']
          nil
        else
          result
        end
      end
def _catch_warden ( & block ) result = catch ( :warden , & block ) if result . is_a? ( Hash ) && ! warden . custom_failure? && ! @controller . send ( :performed? ) result [ :action ] ||= :unauthenticated env = @controller . request . env env [ 'PATH_INFO' ] = "/#{result[:action]}" env [ 'warden.options' ] = result Warden :: Manager . _run_callbacks ( :before_failure , env , result ) status , headers , body = warden . config [ :failure_app ] . call ( env ) . to_a @controller . send :render , status : status , text : body , content_type : headers [ 'Content-Type' ] , location : headers [ 'Location' ] nil else result end end
Catch warden continuations and handle like the middleware would.
Catch warden continuations and handle like the middleware would .
block