Sha256: a767a27c8f5639eb626053e3300a37c9c12e497f0f7f0b49e38546ab121b266d

Contents?: true

Size: 1.3 KB

Versions: 3

Compression:

Stored size: 1.3 KB

Contents

def setup_authpwn_routes
  # The routes used in all the tests.
  routes = ActionDispatch::Routing::RouteSet.new
  routes.draw do
    resource :cookie, controller: 'cookie' do
      collection do
        get :bouncer
        put :update
      end
    end
    resource :http_basic, controller: 'http_basic' do
      collection { get :bouncer }
    end

    authpwn_session controller: 'bare_session', method_names: 'bare_session',
                    omniauth_path_prefix: '/bare_auth'
    authpwn_session controller: 'bare_session2',
                    method_names: 'bare_session2',
                    omniauth_path_prefix: '/bare_auth2'
    root to: 'session#index'

    # NOTE: this route should be kept in sync with the session template.
    authpwn_session
  end

  # NOTE: this must happen before any ActionController or ActionMailer tests
  #       run
  ApplicationController.send :include, routes.url_helpers
  ActionMailer::Base.send :include, routes.url_helpers

  # NOTE: ActionController tests expect @routes to be set to the drawn routes.
  #       We use the block form of define_method to capture the routes local
  #       variable.
  ActionController::TestCase.send :define_method, :setup_authpwn_routes do
    @routes = routes
  end
  ActionController::TestCase.setup :setup_authpwn_routes
end

setup_authpwn_routes

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
authpwn_rails-0.17.2 test/helpers/routes.rb
authpwn_rails-0.17.1 test/helpers/routes.rb
authpwn_rails-0.17.0 test/helpers/routes.rb