Skip to content

Instantly share code, notes, and snippets.

View dcuddeback's full-sized avatar

David Cuddeback dcuddeback

  • Boulder, Colorado, United States
View GitHub Profile
@dcuddeback
dcuddeback / rvmrc.sh
Created June 12, 2011 06:42
Project .rvmrc file which automatically names gemset according to git repository name
#!/usr/bin/env bash
{
DEFAULT="\033[0m"
CYAN="\033[0;36m"
ruby_string="1.9.2"
gemset_name=$(git remote show -n origin | grep -i url | head -n 1 | sed 's;.*/;;g' | sed 's;\.git$;;')
# setup RVM environment
gemset_name=$(basename `pwd`)
gemset_name=$(git remote show -n origin | grep -i url | head -n 1 | sed 's;.*/;;g' | sed 's;\.git$;;')
if ! command -v bundle ; then
gem install bundler
fi
/usr/local/lib/site_ruby/1.8/rubygems.rb:779:in `report_activate_error': Could not find RubyGem bundler (>= 0) (Gem::LoadError)
from /usr/local/lib/site_ruby/1.8/rubygems.rb:214:in `activate'
from /usr/local/lib/site_ruby/1.8/rubygems.rb:1082:in `gem'
from /usr/bin/bundle:18
if ! gem list | grep -q bundler; then
gem install bundler
fi
{
# script contents go here
} >&2
#!/usr/bin/env bash
{
DEFAULT="\033[0m"
CYAN="\033[0;36m"
ruby_string="1.9.2"
gemset_name=$(git remote show -n origin | grep -i url | head -n 1 | sed 's;.*/;;g' | sed 's;\.git$;;')
# setup RVM environment
class Capybara::Selenium::Driver < Capybara::Driver::Base
def resynchronize
yield
if options[:resynchronize]
Capybara.timeout(options[:resynchronization_timeout], self, "failed to resynchronize, ajax request timed out") do
!ajaxing?
end
end
end
@dcuddeback
dcuddeback / after_commit_with_transactional_fixtures.rb
Created August 25, 2011 01:36
Patch ActiveRecord to fire after_commit callbacks at the appropriate time during tests with transactional fixtures.
module ActiveRecord
module ConnectionAdapters
module DatabaseStatements
#
# Run the normal transaction method; when it's done, check to see if there
# is exactly one open transaction. If so, that's the transactional
# fixtures transaction; from the model's standpoint, the completed
# transaction is the real deal. Send commit callbacks to models.
#
# If the transaction block raises a Rollback, we need to know, so we don't