<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre, #msg p { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[810] trunk/alexandria: Separate providers spec into acceptance specs.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd>810</dd>
<dt>Author</dt> <dd>method</dd>
<dt>Date</dt> <dd>2007-12-06 23:05:08 -0500 (Thu, 06 Dec 2007)</dd>
</dl>
<h3>Log Message</h3>
<pre>Separate providers spec into acceptance specs.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkalexandriaRakefile">trunk/alexandria/Rakefile</a></li>
<li><a href="#trunkalexandriatasksrb">trunk/alexandria/tasks.rb</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li>trunk/alexandria/spec/acceptance/</li>
<li><a href="#trunkalexandriaspecacceptanceproviders_specrb">trunk/alexandria/spec/acceptance/providers_spec.rb</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkalexandriaspecalexandriaproviders_specrb">trunk/alexandria/spec/alexandria/providers_spec.rb</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkalexandriaRakefile"></a>
<div class="modfile"><h4>Modified: trunk/alexandria/Rakefile (809 => 810)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/alexandria/Rakefile        2007-12-07 01:32:15 UTC (rev 809)
+++ trunk/alexandria/Rakefile        2007-12-07 04:05:08 UTC (rev 810)
</span><span class="lines">@@ -2,17 +2,6 @@
</span><span class="cx">
</span><span class="cx"> require './tasks.rb'
</span><span class="cx">
</span><del>-#too dangerous without greater specification of what not to include.
-#desc "Add new files to subversion"
-#task :add_new_files do
-# system "svn status | grep '^\?' | grep -v '.swp' | grep -v '.omf' | grep -v '*.tmp' | grep -v '*.bak' | sed -e 's/? *//' | sed -e 's/ /\ /g' | xargs svn add"
-#end
-
-#desc "shortcut for adding new files"
-#task :add => [ :add_new_files ]
-
-
-
</del><span class="cx"> build = AlexandriaBuild.new('alexandria', '0.6.2') do |b|
</span><span class="cx">
</span><span class="cx"> b.author = 'Joseph Method' # Maintainer
</span></span></pre></div>
<a id="trunkalexandriaspecacceptanceproviders_specrbfromrev809trunkalexandriaspecalexandriaproviders_specrb"></a>
<div class="copfile"><h4>Copied: trunk/alexandria/spec/acceptance/providers_spec.rb (from rev 809, trunk/alexandria/spec/alexandria/providers_spec.rb) (0 => 810)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/alexandria/spec/acceptance/providers_spec.rb         (rev 0)
+++ trunk/alexandria/spec/acceptance/providers_spec.rb        2007-12-07 04:05:08 UTC (rev 810)
</span><span class="lines">@@ -0,0 +1,204 @@
</span><ins>+require File.dirname(__FILE__) + '/../spec_helper'
+
+def test_provider(provider, query, search_type = Alexandria::BookProviders::SEARCH_BY_ISBN)
+ results = nil
+
+ Proc.new do
+ results = provider.instance.search(query, search_type)
+ end.should_not raise_error
+ results.class.should == Array # "Results are not an array")
+ results.should_not be_empty #, "Results are empty")
+ if search_type == Alexandria::BookProviders::SEARCH_BY_ISBN
+         results.length.should <= 2 #, "Results are greater than 2")
+         begin
+          results.first.isbn.should == query #, "Result's isbn #{results.first.isbn} is not the same as requested isbn #{query}")
+         rescue
+          results.first.isbn.should == Alexandria::Library.canonicalise_ean(query)
+         end
+         results.first.class.should == Alexandria::Book #, "Result is not a Book")
+         else
+                  results.first.first.class.should == Alexandria::Book #, "Result item is not a Book")
+ end
+end
+
+describe Alexandria do
+ it "should not piss off Rich Burridge" do
+ test_provider(Alexandria::BookProviders::AmazonProvider,
+ '033025068X')
+ end
+
+ it "amazon should work" do
+ test_provider(Alexandria::BookProviders::AmazonProvider,
+ '9780385504201')
+ end
+
+ it "amazon title should work" do
+         test_provider(Alexandria::BookProviders::AmazonProvider,
+ 'A Confederacy of Dunces', Alexandria::BookProviders::SEARCH_BY_TITLE)
+ end
+
+ it "amazon authors should work" do
+         test_provider(Alexandria::BookProviders::AmazonProvider,
+ 'John Kennedy Toole', Alexandria::BookProviders::SEARCH_BY_AUTHORS)
+ end
+
+ it "amazon keyword should work" do
+         test_provider(Alexandria::BookProviders::AmazonProvider,
+ 'Confederacy Dunces', Alexandria::BookProviders::SEARCH_BY_KEYWORD)
+ end
+
+ it "dea should work" do
+ test_provider(Alexandria::BookProviders::DeaStore_itProvider,
+ '9788817012980')
+ test_provider(Alexandria::BookProviders::DeaStore_itProvider,
+ '9788806134747')
+ end
+
+ # Right? Don't test if dependency isn't present.
+
+# def test_LOC
+# begin
+# require 'zoom'
+# rescue LoadError
+# return true
+# end
+# test_provider(Alexandria::BookProviders::LOCProvider,
+# '9780805335583')
+# # this book has non-ASCII letters
+# test_provider(Alexandria::BookProviders::LOCProvider,
+# '9782070379248')
+# end
+
+# def test_BL
+# begin
+# require 'zoom'
+# rescue LoadError
+# return true
+# end
+
+# test_provider(Alexandria::BookProviders::BLProvider,
+# '9781853260803')
+# end
+
+# def test_SBN
+# begin
+# require 'zoom'
+# rescue LoadError
+# return true
+# end
+
+# test_provider(Alexandria::BookProviders::SBNProvider,
+# '9788835926436')
+# end
+
+ # providers supposed to be always working
+
+ it "bn should work" do
+ test_provider(Alexandria::BookProviders::BNProvider,
+ '9780961328917') # see #1433
+ end
+
+ it "MCU should work" do
+ # this book is without binding information, see bug [#2533]
+ test_provider(Alexandria::BookProviders::MCUProvider,
+ '9788487982033')
+ # this book is "agotado" (out of print), see bug [#2518]
+ test_provider(Alexandria::BookProviders::MCUProvider,
+ '9788496075856')
+ end
+
+ it "Proxis should work" do
+ test_provider(Alexandria::BookProviders::ProxisProvider,
+ '9789026965746')
+ test_provider(Alexandria::BookProviders::ProxisProvider,
+                        '9780586071403')
+ end
+
+ it "Thalia should work" do
+ # german book
+ test_provider(Alexandria::BookProviders::ThaliaProvider,
+ '9783896673305')
+ # international book
+ test_provider(Alexandria::BookProviders::ThaliaProvider,
+ '9780440241904')
+ # movie dvd
+ test_provider(Alexandria::BookProviders::ThaliaProvider,
+ '4010232037824')
+ # music cd
+ test_provider(Alexandria::BookProviders::ThaliaProvider,
+ '0094638203520')
+ end
+
+ it "IBS_it should work" do
+ # this tests a book without image but with author
+ test_provider(Alexandria::BookProviders::IBS_itProvider,
+ '9788886973816')
+ # this tests a book with image but without author
+ test_provider(Alexandria::BookProviders::IBS_itProvider,
+ '9788807710148')
+ end
+
+ it "AdLibris should work" do
+ test_provider(Alexandria::BookProviders::AdlibrisProvider,
+ '9789100109332')
+ end
+
+ it "Siciliano should work" do
+ test_provider(Alexandria::BookProviders::SicilianoProvider,
+ '9788599170380')
+ end
+
+ it "BOL_it should work" do
+ test_provider(Alexandria::BookProviders::BOL_itProvider,
+ '9788817012980')
+ end
+
+ it "Webster should work" do
+ # BIT
+ test_provider(Alexandria::BookProviders::Webster_itProvider,
+ '9788817012980')
+ # BUK
+ test_provider(Alexandria::BookProviders::Webster_itProvider,
+ '9781853260803')
+ # BUS
+ test_provider(Alexandria::BookProviders::Webster_itProvider,
+ '9780307237699')
+ # BDE
+ test_provider(Alexandria::BookProviders::Webster_itProvider,
+ '9783442460878')
+ end
+
+ it "Webster should work with multiple authors" do
+         this_book = test_provider(Alexandria::BookProviders::Webster_itProvider,
+ '9788804559016')
+ assert_kind_of(Array, this_book.authors, "Not an array!")
+ #puts this_book.authors
+ assert(this_book.authors.length == 3, "Wrong number of authors for this book!")
+ end
+
+ it "Renaud should work" do
+ # adultes
+ test_provider(Alexandria::BookProviders::RENAUDProvider,
+ '9782894723388')
+ # jeunesse
+ test_provider(Alexandria::BookProviders::RENAUDProvider,
+ '9782764605059')
+ end
+
+ it "Worldcat should work" do
+ test_provider(Alexandria::BookProviders::WorldcatProvider,
+ '9780521247108')
+ # this one is with <div class=vernacular lang="[^"]+">)
+ test_provider(Alexandria::BookProviders::WorldcatProvider,
+ '9785941454136')
+ end
+
+ it "Worldcat should work with multiple authors" do
+                this_book = test_provider(Alexandria::BookProviders::WorldcatProvider,
+ '9785941454136')
+ assert_kind_of(Array, this_book.authors, "Not an array!")
+ #puts this_book.authors
+ assert(this_book.authors.length == 2, "Wrong number of authors for this book!")
+        
+        end
+end
</ins></span></pre></div>
<a id="trunkalexandriaspecalexandriaproviders_specrb"></a>
<div class="delfile"><h4>Deleted: trunk/alexandria/spec/alexandria/providers_spec.rb (809 => 810)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/alexandria/spec/alexandria/providers_spec.rb        2007-12-07 01:32:15 UTC (rev 809)
+++ trunk/alexandria/spec/alexandria/providers_spec.rb        2007-12-07 04:05:08 UTC (rev 810)
</span><span class="lines">@@ -1,205 +0,0 @@
</span><del>-require File.dirname(__FILE__) + '/../spec_helper'
-
-def __test_provider(provider, query, search_type = Alexandria::BookProviders::SEARCH_BY_ISBN)
- results = nil
-
- Proc.new do
- results = provider.instance.search(query, search_type)
- end.should_not raise_error("Something wrong here.")
- puts results.inspect if $DEBUG
- results.class.should == Array # "Results are not an array")
- results.should_not be_empty #, "Results are empty")
- if search_type == Alexandria::BookProviders::SEARCH_BY_ISBN
-         results.length.should <= 2 #, "Results are greater than 2")
-         if results.length == 2
-          results.last.class.should == String # "Result is not a String")
-         end
-         results.first.isbn.should == query #, "Result's isbn #{results.first.isbn} is not the same as requested isbn #{query}")
-         results.first.class.should == Alexandria::Book #, "Result is not a Book")
-         results.first
-         else
-                  results.first.first.class.should == Alexandria::Book #, "Result item is not a Book")
- end
-end
-
-describe Alexandria do
- it "should not piss off Rich Burridge" do
- __test_provider(Alexandria::BookProviders::AmazonProvider,
- '033025068X')
- end
-
- it "amazon should work" do
- __test_provider(Alexandria::BookProviders::AmazonProvider,
- '9780385504201')
- end
-
- it "amazon title should work" do
-         __test_provider(Alexandria::BookProviders::AmazonProvider,
- 'A Confederacy of Dunces', Alexandria::BookProviders::SEARCH_BY_TITLE)
- end
-
- it "amazon authors should work" do
-         __test_provider(Alexandria::BookProviders::AmazonProvider,
- 'John Kennedy Toole', Alexandria::BookProviders::SEARCH_BY_AUTHORS)
- end
-
- it "amazon keyword should work" do
-         __test_provider(Alexandria::BookProviders::AmazonProvider,
- 'Confederacy Dunces', Alexandria::BookProviders::SEARCH_BY_KEYWORD)
- end
-
- it "dea should work" do
- __test_provider(Alexandria::BookProviders::DeaStore_itProvider,
- '9788817012980')
- __test_provider(Alexandria::BookProviders::DeaStore_itProvider,
- '9788806134747')
- end
-
- # Right? Don't test if dependency isn't present.
-
-# def test_LOC
-# begin
-# require 'zoom'
-# rescue LoadError
-# return true
-# end
-# __test_provider(Alexandria::BookProviders::LOCProvider,
-# '9780805335583')
-# # this book has non-ASCII letters
-# __test_provider(Alexandria::BookProviders::LOCProvider,
-# '9782070379248')
-# end
-
-# def test_BL
-# begin
-# require 'zoom'
-# rescue LoadError
-# return true
-# end
-
-# __test_provider(Alexandria::BookProviders::BLProvider,
-# '9781853260803')
-# end
-
-# def test_SBN
-# begin
-# require 'zoom'
-# rescue LoadError
-# return true
-# end
-
-# __test_provider(Alexandria::BookProviders::SBNProvider,
-# '9788835926436')
-# end
-
- # providers supposed to be always working
-
- it "bn should work" do
- __test_provider(Alexandria::BookProviders::BNProvider,
- '9780961328917') # see #1433
- end
-
- it "MCU should work" do
- # this book is without binding information, see bug [#2533]
- __test_provider(Alexandria::BookProviders::MCUProvider,
- '9788487982033')
- # this book is "agotado" (out of print), see bug [#2518]
- __test_provider(Alexandria::BookProviders::MCUProvider,
- '9788496075856')
- end
-
- it "Proxis should work" do
- __test_provider(Alexandria::BookProviders::ProxisProvider,
- '9789026965746')
- __test_provider(Alexandria::BookProviders::ProxisProvider,
-                        '9780586071403')
- end
-
- it "Thalia should work" do
- # german book
- __test_provider(Alexandria::BookProviders::ThaliaProvider,
- '9783896673305')
- # international book
- __test_provider(Alexandria::BookProviders::ThaliaProvider,
- '9780440241904')
- # movie dvd
- __test_provider(Alexandria::BookProviders::ThaliaProvider,
- '4010232037824')
- # music cd
- __test_provider(Alexandria::BookProviders::ThaliaProvider,
- '0094638203520')
- end
-
- it "IBS_it should work" do
- # this tests a book without image but with author
- __test_provider(Alexandria::BookProviders::IBS_itProvider,
- '9788886973816')
- # this tests a book with image but without author
- __test_provider(Alexandria::BookProviders::IBS_itProvider,
- '9788807710148')
- end
-
- it "AdLibris should work" do
- __test_provider(Alexandria::BookProviders::AdlibrisProvider,
- '9789100109332')
- end
-
- it "Siciliano should work" do
- __test_provider(Alexandria::BookProviders::SicilianoProvider,
- '9788599170380')
- end
-
- it "BOL_it should work" do
- __test_provider(Alexandria::BookProviders::BOL_itProvider,
- '9788817012980')
- end
-
- it "Webster should work" do
- # BIT
- __test_provider(Alexandria::BookProviders::Webster_itProvider,
- '9788817012980')
- # BUK
- __test_provider(Alexandria::BookProviders::Webster_itProvider,
- '9781853260803')
- # BUS
- __test_provider(Alexandria::BookProviders::Webster_itProvider,
- '9780307237699')
- # BDE
- __test_provider(Alexandria::BookProviders::Webster_itProvider,
- '9783442460878')
- end
-
- it "Webster should work with multiple authors" do
-         this_book = __test_provider(Alexandria::BookProviders::Webster_itProvider,
- '9788804559016')
- assert_kind_of(Array, this_book.authors, "Not an array!")
- #puts this_book.authors
- assert(this_book.authors.length == 3, "Wrong number of authors for this book!")
- end
-
- it "Renaud should work" do
- # adultes
- __test_provider(Alexandria::BookProviders::RENAUDProvider,
- '9782894723388')
- # jeunesse
- __test_provider(Alexandria::BookProviders::RENAUDProvider,
- '9782764605059')
- end
-
- it "Worldcat should work" do
- __test_provider(Alexandria::BookProviders::WorldcatProvider,
- '9780521247108')
- # this one is with <div class=vernacular lang="[^"]+">)
- __test_provider(Alexandria::BookProviders::WorldcatProvider,
- '9785941454136')
- end
-
- it "Worldcat should work with multiple authors" do
-                this_book = __test_provider(Alexandria::BookProviders::WorldcatProvider,
- '9785941454136')
- assert_kind_of(Array, this_book.authors, "Not an array!")
- #puts this_book.authors
- assert(this_book.authors.length == 2, "Wrong number of authors for this book!")
-        
-        end
-end
</del></span></pre></div>
<a id="trunkalexandriatasksrb"></a>
<div class="modfile"><h4>Modified: trunk/alexandria/tasks.rb (809 => 810)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/alexandria/tasks.rb        2007-12-07 01:32:15 UTC (rev 809)
+++ trunk/alexandria/tasks.rb        2007-12-07 04:05:08 UTC (rev 810)
</span><span class="lines">@@ -134,7 +134,7 @@
</span><span class="cx"> source.grep(/^bin/)
</span><span class="cx"> end
</span><span class="cx"> def specs
</span><del>- source.grep(/^spec\/.*_spec.rb/)
</del><ins>+ source.grep(/^spec\/alexandria\/.*_spec.rb/)
</ins><span class="cx"> end
</span><span class="cx"> def desktop
</span><span class="cx"> "#{build.name}.desktop"
</span><span class="lines">@@ -202,6 +202,7 @@
</span><span class="cx"> t.spec_opts = ["--format", "specdoc"]
</span><span class="cx"> end
</span><span class="cx"> namespace :spec do
</span><ins>+ desc "Verify test coverage"
</ins><span class="cx"> Spec::Rake::SpecTask.new("rcov") do |t|
</span><span class="cx"> t.spec_files = FileList['spec/**/*_spec.rb']
</span><span class="cx"> t.spec_opts = ["--format", "specdoc"]
</span><span class="lines">@@ -213,6 +214,11 @@
</span><span class="cx"> t.spec_opts = ["--format", "html"]
</span><span class="cx"> t.rcov_opts = ["--exclude", "spec"]
</span><span class="cx"> end
</span><ins>+ desc "Run slower acceptance tests (real world data)"
+ Spec::Rake::SpecTask.new("acceptance") do |t|
+ t.spec_files = FileList['spec/acceptance/*_spec.rb']
+ t.spec_opts = ["--format", "specdoc"]
+ end
</ins><span class="cx"> end
</span><span class="cx">
</span><span class="cx"> rescue LoadError => err
</span></span></pre>
</div>
</div>
</body>
</html>