From 4c36e35261c18ae3155bc961776e7ff28ddb9b90 Mon Sep 17 00:00:00 2001 From: Jay Fajardo Date: Sun, 4 Sep 2011 11:06:17 +0800 Subject: [PATCH] Start writing tests --- README.rdoc | 3 +++ Rakefile | 3 +++ lib/openlibrary.rb | 5 +++++ spec/openlibrary_spec.rb | 8 ++++++++ spec/spec_helper.rb | 8 ++++++++ 5 files changed, 27 insertions(+) create mode 100644 spec/openlibrary_spec.rb create mode 100644 spec/spec_helper.rb diff --git a/README.rdoc b/README.rdoc index d622cdf..72cc285 100644 --- a/README.rdoc +++ b/README.rdoc @@ -60,3 +60,6 @@ You can also retrieve a book's full metadata details. # or an array of authors book_view.authors +== TO DO + +Write Tests diff --git a/Rakefile b/Rakefile index 2995527..ec37e30 100644 --- a/Rakefile +++ b/Rakefile @@ -1 +1,4 @@ require "bundler/gem_tasks" +require 'rspec/core/rake_task' +RSpec::Core::RakeTask.new('spec') + diff --git a/lib/openlibrary.rb b/lib/openlibrary.rb index 57a36e2..bdde907 100644 --- a/lib/openlibrary.rb +++ b/lib/openlibrary.rb @@ -7,4 +7,9 @@ module Openlibrary autoload :Data, 'openlibrary/data' autoload :View, 'openlibrary/view' + def self.version_string + "Openlibrary version #{Openlibrary::VERSION}" + end + + end diff --git a/spec/openlibrary_spec.rb b/spec/openlibrary_spec.rb new file mode 100644 index 0000000..28afe5d --- /dev/null +++ b/spec/openlibrary_spec.rb @@ -0,0 +1,8 @@ +require 'spec_helper' + +describe Openlibrary do + it 'should return correct version string' do + Openlibrary.version_string.should == "Openlibrary version #{Openlibrary::VERSION}" + end +end + diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..de5ed88 --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,8 @@ +require 'rspec' +require 'openlibrary' + +RSpec.configure do |config| + config.color_enabled = true + config.formatter = 'documentation' +end +