This file contains 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 MovieShelf | |
attr_accessor :movies | |
def initialize | |
@movies = [] | |
end | |
def lookup(movie) | |
@movies.detect {|m| m == movie} | |
end |
This file contains 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
>> shelf = MovieShelf.new | |
=> #<MovieShelf:0x36eb88 @movies=[]> | |
>> m = Movie.new | |
=> #<Movie:0x33b328> | |
>> m.title = "Juno" | |
=> "Juno" | |
>> m2 = Movie.new | |
=> #<Movie:0x39968> | |
>> m2.title = "Transformers" | |
=> "Transformers" |
This file contains 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
context "a movie shelf" do | |
setup { @shelf = MovieShelf.new } | |
should "show how many movies are stored" do | |
juno = Movie.new("Juno") | |
transformers = Movie.new("Transformers") | |
shelf.store juno | |
shelf.store transformers | |
assert_equal 2, shelf.movies_count | |
end |
This file contains 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
sudo scutil --set HostName <host_name> | |
Also, change the name in the "Sharing" preference pane |
This file contains 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
set :application, "myapp" | |
set :keep_releases, 5 | |
# git options | |
set :scm, "git" | |
set :repository, "git://github.com/georgeguimaraes/myapp.git" | |
set :branch, "master" | |
set :deploy_via, :remote_cache | |
# deploy credentials |
This file contains 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
development: &global_settings | |
database: textual_development | |
host: 127.0.0.1 | |
port: 27017 | |
test: | |
database: textual_test | |
<<: *global_settings | |
production: |
This file contains 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
gem list | cut -d" " -f1 | xargs gem uninstall -aIx |
This file contains 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 truncate(options = {}) | |
options.reverse_merge!({:length => 50, :omission => "…"}) | |
self.gsub(/^(.{#{options[:length]}}[\w.]*)(.*)/m) {$2.empty? ? $1 : $1 + options[:omission]} | |
end |
This file contains 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 Post do | |
context "data validation" do | |
subject { Factory.build(:post) } | |
it "requires a title" do | |
subject.title = nil | |
subject.should_not be_valid | |
end | |
it "requires a body" do |
This file contains 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
# on config/boot.rb | |
require "yaml" | |
YAML::ENGINE.yamler= "syck" |