Skip to content

Instantly share code, notes, and snippets.

blah
@jtrupiano
jtrupiano / factory_girl_ext.rb
Created February 26, 2010 21:39
Add fixture_file_upload to factory_girl
require 'action_controller/test_process'
class Factory
module FixtureFileUpload
def fixture_file_upload(attr_name, path, mime_type=nil, binary=false)
uploaded_file = ActionController::TestUploadedFile.new(
Test::Unit::TestCase.respond_to?(:fixture_path) ? Test::Unit::TestCase.fixture_path + path : path,
mime_type,
binary
)
add_attribute attr_name, uploaded_file
require 'factory_girl'
require 'config/environment'
# All of your factories are now available
Factory(:car, :color => 'Blue')
# etc
# etc
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
export HISTCONTROL=ignoredups
# ... and ignore same sucessive entries.
export HISTCONTROL=ignoreboth
# ... and save a whole bunch of commands
export HISTFILESIZE=100000000
export HISTSIZE=100000
~/projects/gemcutter (master) $> rake cucumber
(in /Users/john/projects/gemcutter)
** [NewRelic] Cannot find newrelic.yml file at /Users/john/projects/gemcutter/config/newrelic.yml.
NOTICE: CREATE TABLE will create implicit sequence "delayed_jobs_id_seq" for serial column "delayed_jobs.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "delayed_jobs_pkey" for table "delayed_jobs"
NOTICE: CREATE TABLE will create implicit sequence "dependencies_id_seq" for serial column "dependencies.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "dependencies_pkey" for table "dependencies"
NOTICE: CREATE TABLE will create implicit sequence "downloads_id_seq" for serial column "downloads.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "downloads_pkey" for table "downloads"
NOTICE: CREATE TABLE will create implicit sequence "linksets_id_seq" for serial column "linksets.id"
@jtrupiano
jtrupiano / gist:307699
Created February 18, 2010 14:42
Force a specific version of hydra on remote and local machines
begin
gem 'hydra', '= 0.11.0'
require 'hydra'
require 'hydra/tasks'
Hydra::TestTask.new('hydra:units') do |t|
t.add_files 'test/unit/**/*_test.rb'
end
Hydra::TestTask.new('hydra:functionals') do |t|
t.add_files 'test/functional/**/*_test.rb'
@jtrupiano
jtrupiano / gist:305821
Created February 16, 2010 19:26
rvm rake not working
~/projects/rack-rewrite (master) $> rvm list
rvm Rubies
ruby-1.8.6-p399 [ i386 ]
ruby-1.8.7-p249 [ i386 ]
ruby-1.9.1-p378 [ i386 ]
System Ruby
class A
def self.blah
puts "I'm in A"
end
end
class B < A
def self.blah
puts "I'm in B"
super
john-mbp:feb_17 john$ irb
irb(main):001:0> pp $:.grep(/gemcutter/)
["/Users/john/.gem/ruby/1.8/gems/gemcutter-0.1.0/lib",
"/Users/john/.gem/ruby/1.8/gems/gemcutter-0.1.1/lib",
"/Users/john/.gem/ruby/1.8/gems/gemcutter-0.2.0/lib",
"/Users/john/.gem/ruby/1.8/gems/gemcutter-0.2.1/lib",
"/Users/john/.gem/ruby/1.8/gems/gemcutter-0.3.0/lib",
"/Users/john/.gem/ruby/1.8/gems/gemcutter-0.3.2/bin",
"/Users/john/.gem/ruby/1.8/gems/gemcutter-0.3.2/lib"]
=> nil
["/Users/john/.gem/ruby/1.8/gems/gemcutter-0.1.0/lib", "/Users/john/.gem/ruby/1.8/gems/gemcutter-0.1.1/lib", "/Users/john/.gem/ruby/1.8/gems/gemcutter-0.2.0/lib", "/Users/john/.gem/ruby/1.8/gems/gemcutter-0.2.1/lib", "/Users/john/.gem/ruby/1.8/gems/gemcutter-0.3.0/lib", "/Library/Ruby/Gems/1.8/gems/bundler-0.8.1/bin", "/Library/Ruby/Gems/1.8/gems/bundler-0.8.1/lib", "/Library/Ruby/Gems/1.8/gems/json_pure-1.1.9/bin", "/Library/Ruby/Gems/1.8/gems/json_pure-1.1.9/lib", "/Users/john/.gem/ruby/1.8/gems/gemcutter-0.3.1/bin", "/Users/john/.gem/ruby/1.8/gems/gemcutter-0.3.1/lib", "/Library/Ruby/Gems/1.8/gems/open_gem-1.3.1/bin", "/Library/Ruby/Gems/1.8/gems/open_gem-1.3.1/lib", "/Library/Ruby/Site/1.8", "/Library/Ruby/Site/1.8/powerpc-darwin9.0", "/Library/Ruby/Site/1.8/universal-darwin9.0", "/Library/Ruby/Site", "/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8", "/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/powerpc-darwin9.0", "/System/Library/Frameworks/Ruby.framew