Skip to content

Instantly share code, notes, and snippets.

View bcardarella's full-sized avatar
Out sailing

Brian Cardarella bcardarella

Out sailing
View GitHub Profile
# Install gems locally, and only locally, without gem complaining
# about path access, and ensuring access to executables.
#
# Goes in .bash_profile or .bash_login.
export GEM_PATH="$HOME/.gem/ruby/1.8"
export GEM_HOME="$HOME/.gem/ruby/1.8"
export PATH="$HOME/.gem/ruby/1.8/bin:$PATH"
def assert_not_received(mock, expected_method_name)
matcher = have_received(expected_method_name)
yield(matcher) if block_given?
assert !matcher.matches?(mock), matcher.failure_message
end
@bcardarella
bcardarella / gist:364832
Created April 13, 2010 17:01
Rspec ActiveRecord callback matchers
# Usage:
#
# describe Klass do
# it { should have_callback(:do_something).on(:before_save) }
# it { should have_callback(:make_change).on(:after_create) }
# it { should_not have_callback(:make_change).on(:before_save) }
# end
#
# class Klass < ActiveRecord::Base
# before_save :do_something
class Misc::Booking::Lab
def self.timeslot
Timeslot.print
end
end
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.mongod</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/mongodb/bin/mongod</string>
rvm default@myproject
rvm --create use default@myproject
rvm default@myproject
> bundle install
This is an example of using RVM's Project .rvmrc file
to have it automatically bootstrap your environment, including bundler.
This could be further expanded to do anything you require :)
The important thing to remember is that the purpose of these files is
to allow you to very easily have your 'project context' (aka 'environment')
loaded automatically for you when you enter the project in the shell (cd).
You can generate the .rvmrc file below by running: