diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 7484284b..a10967f4 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -8,6 +8,7 @@ class ApplicationController < ActionController::Base helper_method :can_use_image_mode?, :user_is? before_filter :set_locale + before_filter :login_as_test_user if Rails.env.development? def authenticate_user! # too lazy to change references to login_path redirect_to(login_path) unless user_signed_in? @@ -66,5 +67,10 @@ class ApplicationController < ActionController::Base def valid_locale?(locale) locale && I18n.usable_locales.include?(locale.to_sym) end + + def login_as_test_user + test_user = User.find_by_name('test') + sign_in(:user, test_user, bypass: true) + end end