Skip to content

Instantly share code, notes, and snippets.

View mrichman's full-sized avatar

Mark Richman mrichman

View GitHub Profile
@mrichman
mrichman / template.rb
Created May 19, 2009 21:47
Rails 2.3 Application Template
# To use: rails appname -m template.rb
plugin 'exception_notifier', :git => 'git://github.com/rails/exception_notification.git'
plugin 'rspec', :git => 'git://github.com/dchelimsky/rspec.git'
plugin 'rspec-rails', :git => 'git://github.com/dchelimsky/rspec-rails.git'
plugin 'paperclip', :git => 'git://github.com/thoughtbot/paperclip.git'
plugin 'restful-authentication', :git => 'git://github.com/technoweenie/restful-authentication.git'
plugin 'asset_packager', :git => 'http://synthesis.sbecker.net/pages/asset_packager'
plugin 'role_requirement', :git => 'git://github.com/timcharper/role_requirement.git'
plugin 'haml', :git => "git://github.com/nex3/haml.git"
@mrichman
mrichman / deploy.rb
Created May 19, 2009 21:48
Capistrano deploy.rb
set :application, "myapplication"
set :repository, "user@example.com:git/#{application}.git"
set :server_name, "www.example.com"
set :scm, "git"
set :checkout, "export"
set :deploy_via, :remote_cache
set :branch, "master"
set :base_path, "/path/to/www"
set :deploy_to, "/path/to/www/#{application}"
set :apache_site_folder, "/etc/apache2/sites-enabled"
@mrichman
mrichman / gist:114446
Created May 19, 2009 21:50
Adding XSL Processing Instruction with to_xml
proc = Proc.new { |options| options[:builder].instruct!(:xml-stylesheet, type=>'text/xsl', :href=>'something.xsl') }
@foo.to_xml :procs => [proc]
@mrichman
mrichman / accounts.feature
Created May 21, 2009 19:30
cucumber features/accounts.feature errors
mark$ cucumber features/accounts.feature
Could not find table 'roles' (ActiveRecord::StatementInvalid)
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/sqlite3_adapter.rb:29:in `table_structure'
/Library/Ruby/Gems/1.8/gems/faker-0.3.1/lib/extensions/object.rb:3:in `returning'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `table_structure'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/sqlite_adapter.rb:213:in `columns'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:1276:in `columns'
/Users/mark/code/HireExchange/vendor/plugins/active_scaffold/lib/active_scaffold/config/core.rb:103:in `initialize'
/Users/mark/code/HireExchange/vendor/plugins/active_scaffold/lib/active_scaffold.rb:56:in `new'
Visitors should be in control of creating an account and of proving their
essential humanity/accountability or whatever it is people think the
id-validation does. We should be fairly skeptical about this process, as the
identity+trust chain starts here.
Feature: Creating an account
As an anonymous user
I want to be able to create an account
So that I can be one of the cool kids
@mrichman
mrichman / cucumber.rake
Created May 21, 2009 20:12
lib/cucumber.rake
$LOAD_PATH.unshift(RAILS_ROOT + '/vendor/plugins/cucumber/lib') if File.directory?(RAILS_ROOT + '/vendor/plugins/cucumber/lib')
begin
require 'cucumber/rake/task'
Cucumber::Rake::Task.new(:features) do |t|
t.fork = true
t.cucumber_opts = %w{--format pretty}
end
task :features => 'db:test:prepare'
@mrichman
mrichman / cucumber.yml
Created May 21, 2009 20:13
cucumber.yml
default: "--require features/support/env.rb --require features/support/db/mysql.rb --require features/support/db/active_record.rb --require features/support/post_database.rb --require features/step_definitions/alpha_steps.rb --require features/step_definitions/beta_steps.rb --require features/step_definitions/cat_steps.rb --require features/step_definitions/common_steps.rb --require features/step_definitions/datetime_delta_steps.rb --require features/step_definitions/delayed_delta_indexing_steps.rb --require features/step_definitions/extensible_delta_indexing_steps --require features/step_definitions/facet_steps.rb --require features/step_definitions/find_arguments_steps.rb --require features/step_definitions/gamma_steps.rb --require features/step_definitions/search_steps.rb --require features/step_definitions/sphinx_steps.rb"
Process: HandBrake [51929]
Path: /Applications/HandBrake.app/Contents/MacOS/HandBrake
Identifier: org.m0k.handbrake
Version: 0.9.3 (2008112300)
Code Type: X86 (Native)
Parent Process: launchd [189]
Interval Since Last Report: 22064 sec
Crashes Since Last Report: 1
Per-App Interval Since Last Report: 1928 sec
@mrichman
mrichman / gist:118095
Created May 26, 2009 14:42
Testing Authlogic with Cucumber
Cucumber is a Integration test harness, so your features should be
specifying who can authenticate via what URLs and your steps should be
exercising the controllers an filters that enforce those features.
The point being, you should be going through your views and hitting
the database, checking to see if the http response body contains what
you expect to see and not worrying about directly testing authlogic
itself.
# Authentication.feature
@mrichman
mrichman / application.html.haml
Created May 30, 2009 19:43
Generic Compass Blueprint Layout & Styles
!!! Strict
%html{locale_attrs}
%head
%title&= yield(:title) || t(:site_name)
%meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/
%meta{ :name => "description", :content => "" }/
%meta{ :name => "keywords", :content => "" }/
= stylesheet_link_tag 'screen', :media => 'screen, projection'
= stylesheet_link_tag 'print', :media => 'print'
= stylesheet_link_tag 'buttons', :media => 'screen, projection'