Rails-Summer-Project-Noah-and-Matt/Library-Application — pull request #121 by nbirnel (2014-09-02 02:10:34+00:00)
Title: allow admin to log in as other user

Gemfile
gem 'pretender' #admin fakes being someone else
bundle install
app/controllers/application_controller.rb
impersonates :user #pretender gem
app/controllers/users_controller.rb
skip_before_action :require_admin, only: :stop_impersonating
set user before impersonate
def impersonate
def stop_impersonating
app/views/layouts/application.html.haml
conditional link to stop impersonating, and notice if you are
app/views/users/index.html.haml
%h1=t '.title', :default => 'User Administration Page'
change btn-mini to btn-default
change email to link to email
app/views/users/show.html.haml
add block / unblock
add impersonate
config/routes.rb
get 'impersonate'
get 'stop_impersonating'
spec/features/useradmins_spec.rb
+ describe 'Show' do
+ it 'lets the admin sign in as another user' do
+ it 'and we can sign back out' do
.rspec
stop warnings for rspec