This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe Address do | |
describe "#validations" do | |
#The line below can be omited if we were to not use Factory and use Address.new and innermost 'describe' block is Address implicitly. | |
subject { Factory.build :address } | |
%w(:city :state :country).each do |attr| | |
it "must have a #{attr}" do | |
subject.send("#{attr}=",nil) | |
should_not be_valid #should is called on a subject by default. Thus this line uses implicit subject :address marked above |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe Address do | |
describe "#validations" do | |
it { should validate_presence_of(:city) } | |
it { should validate_presence_of(:state) } | |
it { should validate_presence_of(:country) } | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! ruby class_method.rb | |
class Test | |
def self.my_freakin_class_method | |
puts "In class method" | |
end | |
def my_freakin_instance_method | |
puts "In instance method" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias jcons='jruby -S script/console' | |
alias jspec='jruby -S script/spec' | |
alias jserv='jruby -S script/server' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
findrb() { | |
find . -iname "*.rb" -print0 | xargs -0 egrep -n --color "$@" | |
} | |
findyml() { | |
find . -iname "*.yml" -print0 | xargs -0 egrep -n --color "$@" | |
} | |
findrake() { | |
find . -iname "*.rake" -print0 | xargs -0 egrep -n --color "$@" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias svnpee="svn pe svn:externals ." | |
alias svnpei="svn pe svn:ignore ." | |
alias svnpge="svn pg svn:externals ." | |
alias svnpgi="svn pg svn:ignore ." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias ff="find . -name $* | grep -v .git" | |
alias cls='clear; reset' | |
alias ls='ls -G' | |
alias lstop='ls -Fhalts | head' | |
alias lstime='ls -Fhalts' | |
alias ll='ls -alG' | |
alias cp='cp -p' | |
alias findbrokenlinks='find . -type l | (while read FN ; do test -e "$FN" || ls -ld "$FN"; done)' | |
alias clearlogs='rm -vrf log/*.log' | |
alias clearcov='rm -vrf coverage coverage.data' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias start_tomcat="env 'CATALINA_OPTS=-Xms1024m -Xmx1024m ${TOMCAT_OPTS}' ${TOMCAT_HOME}/bin/startup.sh" | |
alias stop_tomcat="${TOMCAT_HOME}/bin/shutdown.sh" | |
alias clean_tomcat="rm -rf ${TOMCAT_HOME}/work ${TOMCAT_HOME}/temp ${TOMCAT_HOME}/logs/*" | |
alias log="tail -f ${TOMCAT_HOME}/logs/*" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
function error() { | |
echo "'$1' has trailing spaces.\n" >&2 | |
} | |
git diff --cached --name-only | (while read f; do | |
ERROR=0 | |
if grep -n '[[:space:]]$' "$f" ; then | |
error $f |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/environment.rb | |
# This will prevent Rails from pluralizing the table names | |
ActiveRecord::Base.pluralize_table_names = false |