From 9c227ac21d693fa2903a7c07e643cba99cd69031 Mon Sep 17 00:00:00 2001 From: Chris Jaekl Date: Fri, 13 Mar 2020 20:33:53 -0400 Subject: [PATCH] Add a simple test for Book --- test/book_test.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 test/book_test.rb diff --git a/test/book_test.rb b/test/book_test.rb new file mode 100644 index 0000000..64a2892 --- /dev/null +++ b/test/book_test.rb @@ -0,0 +1,17 @@ + +require 'rspec/autorun' +require_relative '../book' + +describe Book do + it "can handle .epub and .pdf files" do + ['epub', 'pdf'].each do |extension| + expect(Book.can_handle?("sample.#{extension}")).to be true + end + end + + it "cannot handle .mobi, .html, .txt, .doc, .zip, .rtf or .rar files" do + %w(doc html mobi rar rtf txt zip).each do |extension| + expect(Book.can_handle?("sample.#{extension}")).to be false + end + end +end -- 2.39.2