diff options
| author | mo k <m@mokhan.ca> | 2011-11-11 20:34:02 -0700 |
|---|---|---|
| committer | mo k <m@mokhan.ca> | 2011-11-11 20:34:02 -0700 |
| commit | c5afa2772b9e98cd91f46a2b4049a3e7deec0525 (patch) | |
| tree | 6fd6aed84b234f4185d16e179cc61e9498ecf0d7 | |
| parent | 11349c928c80aa5b800264896e4ad2f6991d6cdd (diff) | |
move library to a separate file.
| -rw-r--r-- | lib/library.rb | 11 | ||||
| -rw-r--r-- | test/library_specs.rb | 19 |
2 files changed, 12 insertions, 18 deletions
diff --git a/lib/library.rb b/lib/library.rb new file mode 100644 index 0000000..494d46f --- /dev/null +++ b/lib/library.rb @@ -0,0 +1,11 @@ +class Library + def initialize + @books = [] + end + def add(book) + @books << book + end + def contains(title) + @books.find { |book| book.title == title } != nil + end +end diff --git a/test/library_specs.rb b/test/library_specs.rb index a87a87c..35f5eda 100644 --- a/test/library_specs.rb +++ b/test/library_specs.rb @@ -1,22 +1,5 @@ require "book" - -# require "library" -class Library - def initialize - @books = [] - end - def add(book) - @books << book - end - def contains(title) - # puts @books.public_methods - found = @books.find do |book| - book.title == title - end - found != nil - # @books.any? - end -end +require "library" class TestLibrary < Test::Unit::TestCase def setup |
