Sha256: 2177912e18a8dff1f735031c0cc0047db832519b26caa26f228a650d98c2ac4f
Contents?: true
Size: 478 Bytes
Versions: 6
Compression:
Stored size: 478 Bytes
Contents
module ControllerHelpers def login_with(user = double('user'), scope = :user) current_user = "current_#{scope}".to_sym if user.nil? allow(request.env['warden']).to receive(:authenticate!).and_throw(:warden, {:scope => scope}) 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 end
Version data entries
6 entries across 6 versions & 1 rubygems