<!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 &quot;Add new files to subversion&quot;
-#task :add_new_files do
-#  system &quot;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&quot;
-#end
-
-#desc &quot;shortcut for adding new files&quot;
-#task :add =&gt; [ :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 # &quot;Results are not an array&quot;)
+    results.should_not be_empty #, &quot;Results are empty&quot;)
+    if search_type == Alexandria::BookProviders::SEARCH_BY_ISBN
+            results.length.should &lt;= 2 #, &quot;Results are greater than 2&quot;)
+            begin
+              results.first.isbn.should == query #, &quot;Result's isbn #{results.first.isbn} is not the same as requested isbn #{query}&quot;)
+            rescue
+              results.first.isbn.should == Alexandria::Library.canonicalise_ean(query)
+            end
+            results.first.class.should == Alexandria::Book #, &quot;Result is not a Book&quot;)
+            else
+                      results.first.first.class.should == Alexandria::Book #, &quot;Result item is not a Book&quot;)
+    end   
+end
+
+describe Alexandria do
+  it &quot;should not piss off Rich Burridge&quot; do
+    test_provider(Alexandria::BookProviders::AmazonProvider,
+                        '033025068X')
+  end
+  
+    it &quot;amazon should work&quot; do
+        test_provider(Alexandria::BookProviders::AmazonProvider,
+                        '9780385504201')
+    end
+    
+    it &quot;amazon title should work&quot; do
+            test_provider(Alexandria::BookProviders::AmazonProvider,
+                        'A Confederacy of Dunces', Alexandria::BookProviders::SEARCH_BY_TITLE)
+    end
+    
+    it &quot;amazon authors should work&quot; do
+            test_provider(Alexandria::BookProviders::AmazonProvider,
+                        'John Kennedy Toole', Alexandria::BookProviders::SEARCH_BY_AUTHORS)
+    end
+    
+    it &quot;amazon keyword should work&quot; do
+            test_provider(Alexandria::BookProviders::AmazonProvider,
+                        'Confederacy Dunces', Alexandria::BookProviders::SEARCH_BY_KEYWORD)
+    end
+    
+    it &quot;dea should work&quot; 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 &quot;bn should work&quot; do
+        test_provider(Alexandria::BookProviders::BNProvider,
+                         '9780961328917')   # see #1433  
+    end
+
+    it &quot;MCU should work&quot; do
+        # this book is without binding information, see bug [#2533]
+        test_provider(Alexandria::BookProviders::MCUProvider,
+                        '9788487982033') 
+        # this book is &quot;agotado&quot; (out of print), see bug [#2518]
+        test_provider(Alexandria::BookProviders::MCUProvider,
+                        '9788496075856') 
+    end
+
+    it &quot;Proxis should work&quot; do
+        test_provider(Alexandria::BookProviders::ProxisProvider,
+                        '9789026965746')
+        test_provider(Alexandria::BookProviders::ProxisProvider,
+                        '9780586071403')
+    end
+
+    it &quot;Thalia should work&quot; 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 &quot;IBS_it should work&quot; 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 &quot;AdLibris should work&quot; do
+        test_provider(Alexandria::BookProviders::AdlibrisProvider,
+                        '9789100109332') 
+    end
+     
+    it &quot;Siciliano should work&quot; do
+        test_provider(Alexandria::BookProviders::SicilianoProvider,
+                        '9788599170380') 
+    end
+
+    it &quot;BOL_it should work&quot; do
+        test_provider(Alexandria::BookProviders::BOL_itProvider,
+                        '9788817012980') 
+    end
+
+    it &quot;Webster should work&quot; 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 &quot;Webster should work with multiple authors&quot; do
+            this_book = test_provider(Alexandria::BookProviders::Webster_itProvider,
+                        '9788804559016')
+        assert_kind_of(Array, this_book.authors, &quot;Not an array!&quot;)
+        #puts this_book.authors
+        assert(this_book.authors.length == 3, &quot;Wrong number of authors for this book!&quot;)
+    end
+
+    it &quot;Renaud should work&quot; do
+        # adultes 
+        test_provider(Alexandria::BookProviders::RENAUDProvider,
+                        '9782894723388')
+        # jeunesse
+        test_provider(Alexandria::BookProviders::RENAUDProvider,
+                        '9782764605059')
+    end
+
+    it &quot;Worldcat should work&quot; do
+        test_provider(Alexandria::BookProviders::WorldcatProvider,
+                        '9780521247108') 
+        # this one is with &lt;div class=vernacular lang=&quot;[^&quot;]+&quot;&gt;)
+        test_provider(Alexandria::BookProviders::WorldcatProvider,
+                        '9785941454136') 
+    end
+    
+    it &quot;Worldcat should work with multiple authors&quot; do
+                this_book = test_provider(Alexandria::BookProviders::WorldcatProvider,
+                        '9785941454136')
+        assert_kind_of(Array, this_book.authors, &quot;Not an array!&quot;)
+        #puts this_book.authors
+        assert(this_book.authors.length == 2, &quot;Wrong number of authors for this book!&quot;)
+        
+        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(&quot;Something wrong here.&quot;)
-    puts results.inspect if $DEBUG
-    results.class.should == Array # &quot;Results are not an array&quot;)
-    results.should_not be_empty #, &quot;Results are empty&quot;)
-    if search_type == Alexandria::BookProviders::SEARCH_BY_ISBN
-            results.length.should &lt;= 2 #, &quot;Results are greater than 2&quot;)
-            if results.length == 2
-                results.last.class.should == String # &quot;Result is not a String&quot;)
-            end
-            results.first.isbn.should == query #, &quot;Result's isbn #{results.first.isbn} is not the same as requested isbn #{query}&quot;)
-            results.first.class.should == Alexandria::Book #, &quot;Result is not a Book&quot;)
-            results.first
-            else
-                      results.first.first.class.should == Alexandria::Book #, &quot;Result item is not a Book&quot;)
-    end   
-end
-
-describe Alexandria do
-  it &quot;should not piss off Rich Burridge&quot; do
-    __test_provider(Alexandria::BookProviders::AmazonProvider,
-                        '033025068X')
-  end
-  
-    it &quot;amazon should work&quot; do
-        __test_provider(Alexandria::BookProviders::AmazonProvider,
-                        '9780385504201')
-    end
-    
-    it &quot;amazon title should work&quot; do
-            __test_provider(Alexandria::BookProviders::AmazonProvider,
-                        'A Confederacy of Dunces', Alexandria::BookProviders::SEARCH_BY_TITLE)
-    end
-    
-    it &quot;amazon authors should work&quot; do
-            __test_provider(Alexandria::BookProviders::AmazonProvider,
-                        'John Kennedy Toole', Alexandria::BookProviders::SEARCH_BY_AUTHORS)
-    end
-    
-    it &quot;amazon keyword should work&quot; do
-            __test_provider(Alexandria::BookProviders::AmazonProvider,
-                        'Confederacy Dunces', Alexandria::BookProviders::SEARCH_BY_KEYWORD)
-    end
-    
-    it &quot;dea should work&quot; 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 &quot;bn should work&quot; do
-        __test_provider(Alexandria::BookProviders::BNProvider,
-                         '9780961328917')   # see #1433  
-    end
-
-    it &quot;MCU should work&quot; do
-        # this book is without binding information, see bug [#2533]
-        __test_provider(Alexandria::BookProviders::MCUProvider,
-                        '9788487982033') 
-        # this book is &quot;agotado&quot; (out of print), see bug [#2518]
-        __test_provider(Alexandria::BookProviders::MCUProvider,
-                        '9788496075856') 
-    end
-
-    it &quot;Proxis should work&quot; do
-        __test_provider(Alexandria::BookProviders::ProxisProvider,
-                        '9789026965746')
-        __test_provider(Alexandria::BookProviders::ProxisProvider,
-                        '9780586071403')
-    end
-
-    it &quot;Thalia should work&quot; 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 &quot;IBS_it should work&quot; 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 &quot;AdLibris should work&quot; do
-        __test_provider(Alexandria::BookProviders::AdlibrisProvider,
-                        '9789100109332') 
-    end
-     
-    it &quot;Siciliano should work&quot; do
-        __test_provider(Alexandria::BookProviders::SicilianoProvider,
-                        '9788599170380') 
-    end
-
-    it &quot;BOL_it should work&quot; do
-        __test_provider(Alexandria::BookProviders::BOL_itProvider,
-                        '9788817012980') 
-    end
-
-    it &quot;Webster should work&quot; 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 &quot;Webster should work with multiple authors&quot; do
-            this_book = __test_provider(Alexandria::BookProviders::Webster_itProvider,
-                        '9788804559016')
-        assert_kind_of(Array, this_book.authors, &quot;Not an array!&quot;)
-        #puts this_book.authors
-        assert(this_book.authors.length == 3, &quot;Wrong number of authors for this book!&quot;)
-    end
-
-    it &quot;Renaud should work&quot; do
-        # adultes 
-        __test_provider(Alexandria::BookProviders::RENAUDProvider,
-                        '9782894723388')
-        # jeunesse
-        __test_provider(Alexandria::BookProviders::RENAUDProvider,
-                        '9782764605059')
-    end
-
-    it &quot;Worldcat should work&quot; do
-        __test_provider(Alexandria::BookProviders::WorldcatProvider,
-                        '9780521247108') 
-        # this one is with &lt;div class=vernacular lang=&quot;[^&quot;]+&quot;&gt;)
-        __test_provider(Alexandria::BookProviders::WorldcatProvider,
-                        '9785941454136') 
-    end
-    
-    it &quot;Worldcat should work with multiple authors&quot; do
-                this_book = __test_provider(Alexandria::BookProviders::WorldcatProvider,
-                        '9785941454136')
-        assert_kind_of(Array, this_book.authors, &quot;Not an array!&quot;)
-        #puts this_book.authors
-        assert(this_book.authors.length == 2, &quot;Wrong number of authors for this book!&quot;)
-        
-        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">       &quot;#{build.name}.desktop&quot;
</span><span class="lines">@@ -202,6 +202,7 @@
</span><span class="cx">         t.spec_opts = [&quot;--format&quot;, &quot;specdoc&quot;]
</span><span class="cx">       end
</span><span class="cx">       namespace :spec do
</span><ins>+        desc &quot;Verify test coverage&quot;
</ins><span class="cx">         Spec::Rake::SpecTask.new(&quot;rcov&quot;) do |t|
</span><span class="cx">           t.spec_files = FileList['spec/**/*_spec.rb']
</span><span class="cx">           t.spec_opts = [&quot;--format&quot;, &quot;specdoc&quot;]
</span><span class="lines">@@ -213,6 +214,11 @@
</span><span class="cx">           t.spec_opts = [&quot;--format&quot;, &quot;html&quot;]
</span><span class="cx">           t.rcov_opts = [&quot;--exclude&quot;, &quot;spec&quot;]
</span><span class="cx">         end
</span><ins>+        desc &quot;Run slower acceptance tests (real world data)&quot;
+        Spec::Rake::SpecTask.new(&quot;acceptance&quot;) do |t|
+          t.spec_files = FileList['spec/acceptance/*_spec.rb']
+          t.spec_opts = [&quot;--format&quot;, &quot;specdoc&quot;]
+        end
</ins><span class="cx">       end
</span><span class="cx"> 
</span><span class="cx">     rescue LoadError =&gt; err
</span></span></pre>
</div>
</div>

</body>
</html>