Skip to content

Instantly share code, notes, and snippets.

View semanticart's full-sized avatar

Jeffrey Chupp semanticart

View GitHub Profile
$ ruby test_custom_data.rb
Loaded suite test_custom_data
Started
.F..
Finished in 0.018501 seconds.
1) Failure:
test_creating_a_thing_with_a_foo(MyTest) [test_custom_data.rb:58]:
<"--- !ruby/object:Foo \nfirst: 1st\nsecond: 2nd\n"> expected but was
<#<Foo:0x1023a5ce8 @first="1st", @second="2nd">>.
~/Documents/projects/cucumber/examples/sinatra(master)$ cucumber
Feature: Addition
In order to avoid silly mistakes
As a math idiot
I want to be told the sum of two numbers
Scenario: Add two numbers # features/add.feature:6
Given I visit the calculator page # features/step_definitions/add_steps.rb:1
wrong number of arguments (2 for 1) (ArgumentError)
(eval):2:in `visit'
We couldn’t find that file to show.
# run the script and pass the path to your mongo/bin
# i.e.
# ruby mongodb_import_test.rb ~/Downloads/mongodb-osx-x86_64-1.0.1/bin
require 'rubygems'
require 'test/unit'
require 'mongo'
include Mongo
en:
default:
title: "My default title"
users:
index: "My Awesome User index"
show: "{{name}}'s page!"
en:
users:
show:
title: "{{@user.name}} has {{@user.hair.color}} hair"
description: "{{@user.name}}'s page on my site"
keywords: "user, {{@user.name}}, {{page_keywords}}, etc. etc."
common: &shared
adapter: sqlite3
pool: 5
timeout: 5000
<% %W(development test staging production).each do |env| %>
<%= env %>:
database: rcworkshop_<%= env %>.sqlite3
<<: *shared
<% end %>
@semanticart
semanticart / rails3-skeletor.rb
Created October 14, 2010 22:20
a rails 3 template app that gives you a few nifty items
# usage: rails new APP_NAME -m http://gist.github.com/627198.txt -TJ
# the -T drops test-unit and the -J drops prototype
gem "pg"
gem "omniauth"
gem "paperclip"
gem "haml"
gem "sass"
#!/bin/sh
# ack the diff with a regexp to
# prevent you from adding lines (the \+ at the beginning indicates an added line in the diff)
# that introduce console.log
# and are not commented out (the \s* before console.log)
has_console_log=$(git diff --cached | ack '^\+\s*console\.log\(.*\)')
if [ "$has_console_log" != "" ]
@semanticart
semanticart / search_and_test.rb
Created December 24, 2010 19:15
search the test files for a phrase and run the tests that match
# you'll probably want to alias this in one of your dotfiles
# i.e. alias st="ruby -I\"lib:test\" search_and_test.rb"
#
# the -I"lib:test" can be important if you get complaints like "no such file to load -- test_helper (MissingSourceFile)"
ack_opts = [
"-i", # case insensitive
"-l", # just return file names
"-G _test.rb", # only search files whose name matches /_test.rb/
ARGV.join(' '), # pass along any options we're passed in (usually just the search string)