This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.join(File.dirname(__FILE__), '..', 'spec_helper.rb') | |
describe Sessions, "create action" do | |
before(:each) do | |
User.auto_migrate! | |
end | |
it "should login valid user and redirect" do | |
user = User.make |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CookieLoginStrategy < ::Authentication::Strategy | |
def run! | |
u = cookies[:auth_token] && User.first(:remember_token => cookies[:auth_token]) | |
if u && u.remember_token? | |
cookies[:auth_token] = { :value => u.remember_token, :expires => Time.parse(u.remember_token_expires_at.to_s) } | |
u | |
end | |
end | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def unauthenticated | |
session[:return_to] = request.uri unless params[:controller] == 'sessions' | |
if params[:action] == 'openid' | |
render :template => 'sessions/openid' | |
else | |
render :template => 'sessions/new' | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
given "logged in" do | |
login | |
end | |
context "when logged in" do | |
context "Homepage: url(:home)", :given => "logged in" do | |
before(:each) do | |
@rack = request(:home) | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vim /etc/apt/sources.list | |
#comment out the CD line | |
#deb cdrom:[Debian........... | |
apt-get update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set :branch, "production" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fragment_cache(key, params = {}, &block) | |
cache(key, params) { capture_haml(&block) } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'application' | |
set :run, false | |
set :environment, :production | |
FileUtils.mkdir_p 'log' unless File.exists?('log') | |
log = File.new("log/sinatra.log", "a") | |
$stdout.reopen(log) | |
$stderr.reopen(log) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export PS1='\[\033[0;35m\]\h\[\033[0;33m\] \w\[\033[00m\]: ' | |
#Nicer LS colour. | |
export LS_COLORS='di=01;33' | |
export CLICOLOR=1 | |
export LSCOLORS=dxfxcxdxbxegedabagacad |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
methods.each do |method| | |
it "should respond to #{method}" do | |
@package.should respond_to(method) | |
end | |
end |
OlderNewer