Skip to content
This repository has been archived by the owner on May 10, 2018. It is now read-only.

Commit

Permalink
keeping it real
Browse files Browse the repository at this point in the history
  • Loading branch information
aeden committed Mar 1, 2011
0 parents commit 2b33ea3
Show file tree
Hide file tree
Showing 15 changed files with 1,053 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Gemfile
@@ -0,0 +1,2 @@
source :rubygems
gem 'httparty'
12 changes: 12 additions & 0 deletions Gemfile.lock
@@ -0,0 +1,12 @@
GEM
remote: http://rubygems.org/
specs:
crack (0.1.8)
httparty (0.7.4)
crack (= 0.1.8)

PLATFORMS
ruby

DEPENDENCIES
httparty
7 changes: 7 additions & 0 deletions address_book/Rakefile
@@ -0,0 +1,7 @@
require 'rake/testtask'

Rake::TestTask.new do |t|
t.libs << "test"
t.test_files = FileList['test/**/*_test.rb']
t.verbose = true
end
9 changes: 9 additions & 0 deletions address_book/lib/person.rb
@@ -0,0 +1,9 @@
class Person
@people = {}
def initialize(name)
@name = name
end
def self.find_or_create(name)
@people[name] ||= Person.new(name)
end
end
11 changes: 11 additions & 0 deletions address_book/test/person_test.rb
@@ -0,0 +1,11 @@
require 'test/unit'
require 'person'

class PersonTest < Test::Unit::TestCase
def test_find_or_create
p1 = Person.find_or_create('Anthony Eden')
assert_not_nil p1
p2 = Person.find_or_create('Anthony Eden')
assert p1 == p2
end
end

0 comments on commit 2b33ea3

Please sign in to comment.