Skip to content

Instantly share code, notes, and snippets.

View aaronjensen's full-sized avatar

Aaron Jensen aaronjensen

View GitHub Profile
@aaronjensen
aaronjensen / rspec.rake
Created April 28, 2011 06:38
run rspec in a fork off rake to prevent loading the rails environment again
# /lib/tasks/rspec.rake
namespace :fork do
task :spec do
fork do
RSpec::Core::Runner.disable_autorun!
RSpec::Core::Runner.run(['spec'], $stderr, $stdout) ? exit(0) : exit(1)
end
Process.wait
raise 'rspec failed' unless $?.exitstatus == 0
# exiting the fork can cause MySql to drop the connection
@aaronjensen
aaronjensen / teamcity.rake
Created April 28, 2011 06:53
our teamcity rake.
task :teamcity => ['teamcity:clean', 'teamcity:setup', 'barista:brew', 'fork:spec', 'teamcity:cucumber', 'jasmine:ci']
namespace :teamcity do
task :setup do
RAILS_ENV = 'test'
Rake::Task['db:drop'].invoke
Rake::Task['db:create'].invoke
Rake::Task['db:schema:load'].invoke
end
@aaronjensen
aaronjensen / gist:1219565
Created September 15, 2011 15:31
testing cookie deletes in rails
describe MyController do
let(:cookies) { mock('cookies') }
context "when my page is visited" do
it "should delete my cookie" do
controller.stub!(:cookies).and_return(cookies)
cookies.should_receive(:delete).with(cookie, :domain => '.mydomain.com')
get "my_action"
var z="http://gist.github.com/",y=document.write,x=$("body"),w=$("p.gist").map(function(b,a){a=$(a);var c=$("a",a),u=c.attr("href");if(c.length&&u.indexOf(z)==0)return{p:a,id:u.substring(z.length)}}).get(),v=function(){if(w.length==0)document.write=y;else{var b=w.shift();document.write=function(){document.write=function(a){b.p.replaceWith(a);v()}};x.append('<scr'+'ipt src="'+z+b.id+'.js"></scr'+'ipt>')}};v();
@aaronjensen
aaronjensen / gist:2019573
Created March 12, 2012 03:41 — forked from RobinClowers/gist:2018620
Rspec mock AAA extension
require 'rspec'
# is it really this simple?
RSpec::Matchers.define :have_received do |method_name|
match do |actual|
@args ||= []
@method_name ||= method_name
actual.received_message?(@method_name, *@args)
end
@aaronjensen
aaronjensen / ci.rake
Created March 27, 2012 22:15
ci rake
if ENV['RAILS_ENV'] == 'test'
task :ci => ['ci:clean', 'ci:setup', 'ci:coffeelint', 'ci:spec', 'ci:guard:jasmine']
namespace :ci do
task :setup do
Rake::Task['db:drop'].invoke
Rake::Task['db:create'].invoke
Rake::Task['db:schema:load'].invoke
end
@aaronjensen
aaronjensen / .tmux.conf
Created April 14, 2012 09:24
robust tmux zoom toggle
# zoom
unbind ^M
bind ^M new-window -d -n zoom 'tmux-zoom'
# Options
set -g default-terminal "screen-256color"
set -g base-index 1
set -g pane-base-index 1
set -g set-titles on
set -g status-keys vi
# Faster Command Sequences
set -s escape-time 0
# mouse can be used to select panes
set -g mouse-select-pane on
@aaronjensen
aaronjensen / gist:3009602
Created June 28, 2012 07:00
create a gemset
bash -c "[[ -s \"$HOME/.rvm/scripts/rvm\" ]] && . \"$HOME/.rvm/scripts/rvm\" && rvm use --create %RUBY_VERSION%@%GEMSET%"
@aaronjensen
aaronjensen / gist:3086756
Created July 10, 2012 22:53
merge/integration
* merge/integration
|\
| * feature/bob merged into integration
| |\
| | * feature/bob
| * | integration
*
|\
| * feature/sally merged into integration
| |\