Skip to content

Instantly share code, notes, and snippets.

View ajsharp's full-sized avatar

Alex Sharp ajsharp

View GitHub Profile
namespace :bundler do
task :install do
run("gem install bundler --source=http://gemcutter.org")
end
task :symlink_vendor do
shared_gems = File.join(shared_path, 'vendor/bundler_gems')
release_gems = "#{release_path}/vendor/bundler_gems"
%w(cache gems specifications).each do |sub_dir|
shared_sub_dir = File.join(shared_gems, sub_dir)
# Don't change this file!
# Configure your app in config/environment.rb and config/environments/*.rb
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
module Rails
class << self
def boot!
unless booted?
preinitialize
bundle_path "vendor/bundler_gems"
disable_system_gems
gem "rails", '2.3.5'
gem 'will_paginate', '2.3.11'
gem 'authlogic', '2.1.2'
gem 'haml', '2.2.13'
gem 'formtastic', '0.9.1'
gem 'state_machine', '0.8.0'
gem 'RedCloth', '4.2.2'
# The faster suite
describe UsersController, "POST #create" do
context "user is successfully created" do
before :each do
user = mock_model User, :deliver_activation_instructions! => true
User.should_receive(:new).and_return(user)
user.should_receive(:signup!).and_return(true)
@landlord = Landlord.first
# generates a SQL query for the associated properties collection
@landlord.properties.size # => 30, or whatever
@landlord.properties.size # => 30; no additional SQL query generated
# generates the following SQL in Rails 2.3.5:
# SELECT count(*) AS count_all FROM `properties` WHERE (`properties`.landlord_id = 1)
@landlord.properties.count # => 30
require 'pp'
class Account
@@accounts = []
attr_accessor :name
attr_reader :sub_accounts, :parent_account
# Account.new "Accounts Receivable" do |ar|
# ar.sub_account("Cash")
# end
require 'rubygems'
require 'mongo'
require 'singleton'
# require active_support 2.3.5
gem 'activesupport', '2.3.5'
module MongoRailsLogger
class Config
include Singleton
require 'rubygems'
gem 'mongo_ext'
require 'mongo'
require 'singleton'
require 'pp'
RAILS_ENV = 'development'
class PeopleController < ActionController::Base
def index
@people = Person.all
respond_to do |format|
format.json { @people.to_json }
end
end
end
1 + 1 # => 2
class Fixnum
def +(num)
puts "You're playing with fire there buddy!"
end
end
1 + 1 # => "You're playing with fire there buddy!"