Skip to content

Instantly share code, notes, and snippets.

View my_helper_test.rb
require 'test_helper'
class MyHelperTest < ActionView::TestCase
test "title" do
assert_select_in '<h1>My Awesome App</h1>', 'h1'
test "nav" do
html = '<div id="nav"><a href="/">Home</a></div>'
assert_select_in html, 'div' do
View gist:51136
# 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"
View gist:44476
# 1) Point * in your DNS setup to your server.
# 2) Setup an Apache vhost to catch the star pointer:
# <VirtualHost *:80>
# ServerName *
# </VirtualHost>
# 3) Set the current account from the subdomain
class ApplicationController < ActionController::Base
View Twilight.taskpapertheme
Attempt to build a TaskPaper theme similar to TextMate Twilight theme.
* Make tags smaller. There are some things I added for 'tag' but not being applied to tags just yet.
* Would like @next_action to be visually differentiated, then when the task is complete, have it look like a normal @done task and remove the @next_action tag. See for some tips that might help.
<!-- Window Style -->
View selenium_test
require "selenium"
require "test/unit"
class NewTest < Test::Unit::TestCase
def setup
@verification_errors = []
if $selenium
@selenium = $selenium
@selenium ="localhost", 4444, "*chrome", "", 10000);
View gist:6215
require File.dirname(__FILE__) + '/../test_helper'
class EditorActionsTest < ActionController::IntegrationTest
# CNK not sure if we are going to use fixtures
# I would prefer to use factories but am having trouble with that
# fixtures :users, :roles, :roles_users, :pages
def setup
@home_page = Factory.create_home_page
@editor = Factory.create_user_with_role('editor', :login => 'abenter', :email => '', :password => 'abenter', :password_confirmation => 'abenter')
View post_image.rb
class PostImage < ActiveRecord::Base
# So we can code post_image.category instead of the uglier post_image.post_image_category
belongs_to :category, :class_name => 'PostImageCategory', :foreign_key => 'post_image_category_id'
# You may want to pass other options to has_attachment.
# See the attachment_fu README.
has_attachment :content_type => :image,
:storage => :file_system,
# There is no size restriction on thumbnails.
# But you'll probably want them to fit in the TinyMCE plugin popup dialog.