Skip to content

Instantly share code, notes, and snippets.

@arthwood
arthwood / application_controller.rb
Created February 19, 2016 15:43
Extending routes in tests. How to define extra routing in your tests.
class ApplicationController < ActionController::Base
def logged_in?
session[:user_id].present?
end
def require_login
unless logged_in?
session[:requested_path] = url_for(only_path: true)
redirect_to new_authentication_path