Skip to content

Instantly share code, notes, and snippets.

require File.dirname(__FILE__) + '/../test_helper'
class PhotoTest < ActiveSupport::TestCase
# FIXME: http://thoughtbot.lighthouseapp.com/projects/8794/tickets/35-should_have_attached_file - AVS
should_have_attached_file :image, :styles => { :medium => "500", :thumb => "150x150#" },
:path => ":rails_root/public/assets/images/:id/:style.:extension",
:url => "/assets/images/:id/:style.:extension", :validations => []
should_belong_to :property
@hardbap
hardbap / bashrc
Created November 11, 2008 14:19 — forked from defunkt/bashrc
alias gemi='sudo gem install --no-rdoc --no-ri'
alias svnst='svn st | grep -v status | grep \s'
alias dns='dscacheutil -flushcache'
alias ls='ls -G'
alias grep='grep --color'
alias less='less -r'
alias m='mate'
# prompt
@hardbap
hardbap / gist:29881
Created November 28, 2008 02:09 — forked from dhh/gist:29752
config.action_controller.asset_host = Proc.new do |source, request|
non_ssl_host = "http://asset#{source.hash % 4}.backpackit.com"
ssl_host = "https://asset1.backpackit.com"
if request.ssl?
case
when source =~ /\.js$/
ssl_host
when request.headers["USER_AGENT"] =~ /(Safari)/
non_ssl_host
class Example < ActiveRecord::Base
includes
associations
named scopes
validations
@hardbap
hardbap / .irbrc
Created December 26, 2008 23:32 — forked from henrik/.irbrc
# http://pablotron.org/software/wirble/
# Provides "ri", history survives restart etc
require 'rubygems'
require 'wirble'
Wirble.init
# http://www.quotedprintable.com/2007/9/13/my-irbrc
# Show rails root in script/console prompt
require 'irb/completion'
(function($){
$.fn.inlineLabels = function(options){
var settings = $.extend({
suffix: '...'
}, options)
var inputs = this.find('input[type=text]')
inputs.data('labelText', inputs.prev('label'))
this.find('input[type=text]').each(function(i, input){
@hardbap
hardbap / gist:55321
Created January 30, 2009 22:37 — forked from peterc/gist:33337
# SUPER DARING APP TEMPLATE 1.0
# By Peter Cooper
# Link to local copy of edge rails
inside('vendor') { run 'ln -s ~/dev/rails/rails rails' }
# Delete unnecessary files
run "rm README"
run "rm public/index.html"
run "rm public/favicon.ico"
@hardbap
hardbap / gist:60984
Created February 9, 2009 20:54 — forked from lifo/gist:31208
run "rm public/index.html"
generate(:scaffold, "item name:string")
route "map.root :controller => :items"
rake("db:migrate", "production")
gem 'ruby-openid'
gem 'will-paginate', :git => 'git://github.com/mislav/will_paginate.git'
gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
gist '60999', '.gitignore'
class SurveysController < ApplicationController
# GET /surveys
# GET /surveys.xml
def index
@surveys = Survey.find(:all, :limit => 50)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @surveys }
end
survey_controller_test.rb:
context 'PUT to update for existing survey' do
setup do
@survey = Factory(:survey)
put :update, :id => @survey.to_param,
:survey => Factory.attributes_for(:survey)
end
should_set_the_flash_to /updated/i