Skip to content

Instantly share code, notes, and snippets.

@jimmylorunning
jimmylorunning / controller_helpers.rb
Created January 5, 2015 03:36
stubbing devise authentication
module ControllerHelpers
def sign_in(user = double('user'))
if user.nil?
allow(request.env['warden']).to receive(:authenticate!).and_throw(:warden, {:scope => :user})
allow(controller).to receive(:current_user).and_return(nil)
else
allow(request.env['warden']).to receive(:authenticate!).and_return(user)
allow(controller).to receive(:current_user).and_return(user)
end
end
@jimmylorunning
jimmylorunning / .vimrc
Last active August 29, 2015 14:19
.vimrc tab settings
set smartindent
set tabstop=2
set shiftwidth=2
set expandtab