From c5afa2772b9e98cd91f46a2b4049a3e7deec0525 Mon Sep 17 00:00:00 2001 From: mo k Date: Fri, 11 Nov 2011 20:34:02 -0700 Subject: move library to a separate file. --- lib/library.rb | 11 +++++++++++ test/library_specs.rb | 19 +------------------ 2 files changed, 12 insertions(+), 18 deletions(-) create mode 100644 lib/library.rb 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 -- cgit v1.2.3