Skip to content

Instantly share code, notes, and snippets.

module Foo
def self.included(base)
base.class_eval do
extend ClassMethods
include InstanceMethods
end
end
set :branch, "production"
Exception
NoMemoryError
ScriptError
LoadError
NotImplementedError
SyntaxError
SignalException
Interrupt
StandardError
ArgumentError
Exception
NoMemoryError
ScriptError
LoadError
NotImplementedError
SyntaxError
SignalException
Interrupt
StandardError
ArgumentError
<%= text_area 'comment', 'comment', "rows" => 10,:cols => 55, :class => 'autoexpand_textarea' %>
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
function proml {
local BLUE="\[\033[0;34m\]"
local RED="\[\033[0;31m\]"
local LIGHT_RED="\[\033[1;31m\]"
local GREEN="\[\033[0;32m\]"
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
function proml {
local BLUE="\[\033[0;34m\]"
local RED="\[\033[0;31m\]"
local LIGHT_RED="\[\033[1;31m\]"
local GREEN="\[\033[0;32m\]"
module Test # :nodoc: all
module Unit
class TestCase
def self.should_assign_to_value(name,value)
should "assign @#{name}" do
assert assigns(name.to_sym), "The action isn't assigning to @#{name}"
if value =~ /#\{/
tmp = '"' + value + '"'
assert_equal assigns(name.to_sym),eval(tmp,binding)
require File.expand_path(File.dirname(__FILE__) + "/../test_helper")
class UsersControllerTest < ActionController::TestCase
def setup
super
end
context 'show' do
setup do
module Validateable
[:save, :save!, :update_attribute].each{|attr| define_method(attr){}}
def method_missing(symbol, *params)
if(symbol.to_s =~ /(.*)_before_type_cast$/)
send($1)
end
end