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
Feature: A user can punch in and out | |
In order to log hours | |
As an employee | |
I want to be able to punch in and punch out | |
Background: | |
Given the following user exists: | |
| name | email | password | role | | |
| foo | [email protected] | please | Employee | | |
And I log in as "[email protected]/please" |
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
class Hour < ActiveRecord::Base | |
belongs_to :user | |
validates_with PunchclockValidator #defined in config/initializers/punchclock_validator.rb | |
validates_presence_of :role, :message => "can't be blank" | |
validates_associated :user | |
validates_numericality_of :manual, :allow_nil => true | |
validates_presence_of :start_time, :if => :punchcard? | |
validates_presence_of :manual, :if => :manual? | |
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
require 'spec_helper' | |
describe User do | |
describe "Object Attributes" do | |
before(:each) { @obj = User.new } | |
specify { @obj.should respond_to(:first_name) } | |
specify { @obj.should respond_to(:last_name) } | |
specify { @obj.should respond_to(:login) } | |
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
namespace :myapp do | |
task :renew => %w{db:drop db:create db:migrate} | |
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
def tip(msg); puts; puts msg; puts "-"*100; end | |
# | |
# 30 Ruby 1.9 Tips, Tricks & Features: | |
# http://www.igvita.com/2011/02/03/new-ruby-19-features-tips-tricks/ | |
# | |
tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2" | |
tip "Ruby 1.9 supports named captures in regular expressions!" |
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
source 'http://rubygems.org' | |
gem "i18n", ">= 0.4.0" | |
gem 'rails', '3.0.0' | |
gem "haml" | |
gem "compass" | |
# gem "mongoid", "2.0.0.beta.15" |
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
This is an example of using RVM's Project .rvmrc file | |
to have it automatically bootstrap your environment, including bundler. | |
This could be further expanded to do anything you require :) | |
The important thing to remember is that the purpose of these files is | |
to allow you to very easily have your 'project context' (aka 'environment') | |
loaded automatically for you when you enter the project in the shell (cd). | |
You can generate the .rvmrc file below by running: |
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
rvm --create use default@myproject |
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
# Install gems locally, and only locally, without gem complaining | |
# about path access, and ensuring access to executables. | |
# | |
# Goes in .bash_profile or .bash_login. | |
export GEM_PATH="$HOME/.gem/ruby/1.8" | |
export GEM_HOME="$HOME/.gem/ruby/1.8" | |
export PATH="$HOME/.gem/ruby/1.8/bin:$PATH" |
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
Dan Pickett, http://en.oreilly.com/rails2009/profile/46469 | |
Brian Cardarella, http://en.oreilly.com/rails2009/profile/45790 |