A clean workaround for running capybara tests on Rails with assets pipeline enabled.
Original: teamcapybara/capybara#500 (comment)
namespace :db do | |
namespace :sessions do | |
desc "Clean up expired Active Record sessions (updated before ENV['UPDATED_AT'], defaults to 1 month ago)." | |
task :expire => :environment do | |
time = Time.parse( ENV['UPDATED_AT'] || 1.month.ago.to_s(:db) ) | |
say "cleaning up expired sessions (older than #{time}) ..." | |
session = ActiveRecord::SessionStore::Session | |
rows = session.delete_all ["updated_at < ?", time] | |
say "deleted #{rows} session row(s) - there are #{session.count} session row(s) left" | |
end |
module AlertConfirmer | |
class << self | |
def reject_confirm_from &block | |
handle_js_modal 'confirm', false, &block | |
end | |
def accept_confirm_from &block | |
handle_js_modal 'confirm', true, &block | |
end |
A clean workaround for running capybara tests on Rails with assets pipeline enabled.
Original: teamcapybara/capybara#500 (comment)
class Api::RegistrationsController < Api::BaseController | |
respond_to :json | |
def create | |
user = User.new(params[:user]) | |
if user.save | |
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201 | |
return | |
else |
require "rvm/capistrano" # Load RVM's capistrano plugin. | |
require "bundler/capistrano" | |
set :rvm_ruby_string, '1.9.3' | |
set :rvm_type, :user # Literal ":user" | |
set :application, "blog_test" | |
set :repository, "[email protected]:ryancheung/blog.git" | |
set :scm, :git |
mkdir -p /Library/Application\ Support/TextMate/Bundles | |
cd !$ | |
git clone git://github.com/timcharper/git-tmbundle.git Git.tmbundle | |
osascript -e 'tell app "TextMate" to reload bundles' | |
Ctr+Shift+G => blame | |
enjoy! |
sudo port install git-core +bash_completion | |
if [ -f /opt/local/etc/bash_completion ]; then | |
. /opt/local/etc/bash_completion | |
fi | |
GIT_PS1_SHOWDIRTYSTATE=true | |
PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;33m\]\w\[\033[00m\]\[\033[01;31m\]$(__git_ps1 " {%s}")\[\033[00m\]\$ ' |
sudo apt-get install libxslt1-dev | |
libxml, libxml-dev, libxslt, libzslt-dev |
rvm implode | |
rm ~/.rvmrc | |
curl -s https://rvm.beginrescueend.com/install/rvm -o rvm-installer ; chmod +x rvm-installer ; ./rvm-installer --version 1.8.0 | |
; | |
rvm implode | |
gem uninstall rvm |
ctrl+a or Home - Moves the cursor to the start of a line. | |
ctrl+e or End - Moves the cursor to the end of a line. | |
ctrl+b - Moves to the beginning of the previous or current word. | |
ctrl+k - Deletes from the current cursor position to the end of the line. | |
ctrl+u - Deletes the whole of the current line. | |
ctrl+w - Deletes the word before the cursor. |