Skip to content

Instantly share code, notes, and snippets.

View SpencerCooley's full-sized avatar

Spencer Cooley SpencerCooley

View GitHub Profile
git remote add origin git@github.com:YourUsername/sample_app.git
git push origin master
heroku create
git push heroku master
asdfasdfsadfasdfasdf
git config --global user.name "Your Name"
git config --global user.email "your@email.com"
sudo gem install rails
rails -v
This command should give you the version of rails which means that it was successfully installed.
If it says that rails is not installed then you will have to do some strange/extra work
open the file at ~/.bashrc in a text editor
and then type this (at the end of the file)
@SpencerCooley
SpencerCooley / gist:1015354
Created June 8, 2011 20:42
test do test do
require 'test_helper'
class StoreControllerTest < ActionController::TestCase
test "should get index" do
get :index
assert_response :success
assert_select '#columns #side a', :minimum=> 4
assert_select '#main .entry', 3
end
test "image url" do
ok= %w{ fred.gif fred.png fred.png FRED.JPG FRED.Jpg
http://a.b.c/x/y/z/fred.gif}
bad=%w{ fred.gif/hello fred.gif.hello fred.doc }
ok.each do |name|
assert new_product(name).valid? "#{name} shouldn't be invalid"
end
tails -f log/development log
Started GET "/carts/1" for 127.0.0.1 at Sun Jun 12 16:50:01 -0500 2011
Processing by CartsController#show as HTML
Parameters: {"id"=>"1"}
Cart Load (0.5ms) SELECT "carts".* FROM "carts" WHERE "carts"."id" = 1 LIMIT 1
LineItem Load (0.8ms) SELECT "line_items".* FROM "line_items" WHERE ("line_items".cart_id = 1)
Product Load (0.7ms) SELECT "products".* FROM "products" WHERE "products"."id" = 2 ORDER BY title LIMIT 1
Product Load (0.7ms) SELECT "products".* FROM "products" WHERE "products"."id" = 3 ORDER BY title LIMIT 1
Rendered carts/show.html.erb within layouts/application (129.5ms)
Completed 200 OK in 174ms (Views: 142.1ms | ActiveRecord: 6.4ms)