- Cucumber
- Pickle
- Capybara
- FactoryGirl
class Object | |
def self.gimme_attrs(attr) | |
define_method("#{attr}") do | |
instance_variable_get "@#{attr}" | |
end | |
define_method("#{attr}=") do |attribute| | |
instance_variable_set :"@#{attr}", attribute | |
end | |
end |
# Original module with "magic numbers" for 4 suits and 13 card values | |
# See: http://refactoring.com/catalog/replaceMagicNumberWithSymbolicConstant.html | |
module PlayingCards | |
SUITS = %w{ spades clubs hearts diamonds } | |
class Deck | |
attr_accessor :cards | |
def initialize |
module PlayingCards | |
class Card | |
class InvalidCardError < ArgumentError | |
end | |
include Comparable | |
SUITS = %w{ spades clubs hearts diamonds } | |
RANKS = %w{ 2 3 4 5 6 7 8 9 10 J Q K A } |
module PlayingCards | |
SUITS = [:spades, :hearts, :diamonds, :clubs] | |
class Card | |
attr_reader :suit, :value | |
class InvalidCardError < StandardError; end | |
def initialize(value, suit) | |
raise InvalidCardError unless SUITS.include?(suit.downcase.to_sym) | |
raise InvalidCardError if value == "nothing" |
class ApplicationController < ActionController::Base | |
protect_from_forgery | |
helper_method :current_user | |
helper_method :current_project | |
helper_method :user_projects | |
before_filter :login_required | |
private |
require 'spec_helper' | |
describe ProjectsController do | |
def mock_project(stubs={}) | |
@mock_project ||= mock_model(Project, stubs).as_null_object | |
end | |
before(:each) do | |
controller.stub!(:current_user).and_return(@current_user) | |
end |
h3 { | |
background: #efefef; | |
border: 1px solid #ccc; | |
padding: 1em; | |
width: 600px; | |
} | |
.filter_text { | |
float: left; | |
line-height: 30px; | |
margin-right: 10px; |
* Get away from the idea of "getting things done" | |
* We always have the sense of wanting to get it done | |
* This sense causes us to rush a little bit; cut some corners (that you *should* cut because you're trying to get stuff down) | |
* When you're cutting corners, you're not going to try to do something you don't know how to do | |
* Goal: shrink the gap between your day-to-day code quality and the ideal | |
* It's not practice that makes perfect - it's perfect practice that makes perfect | |
* Today is the day you write perfect code | |
* Focus on the 4 Rules of Simple Design | |
* This problem was picked because it's too big to finish in 45 minutes | |
* After the 1st session, walk around and ruthlessly mock their code |
#!/bin/bash | |
set -eux | |
## *************************************************************************** | |
## Reset local and remote repositories | |
## *************************************************************************** | |
REMOTE_REPOSITORY=~/scm/git-flow-ex | |
DEVELOPER_CHECKOUT=~/dev/git-flow-ex | |
rm -rf $REMOTE_REPOSITORY |