alexandria-book-collection-manager 0.7.5 → 0.7.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +9 -0
  3. data/.gitignore +4 -1
  4. data/.rubocop.yml +51 -29
  5. data/.rubocop_todo.yml +33 -155
  6. data/.simplecov +5 -2
  7. data/.travis.yml +10 -4
  8. data/CHANGELOG.md +19 -0
  9. data/INSTALL.md +23 -11
  10. data/README.md +36 -35
  11. data/Rakefile +7 -5
  12. data/alexandria-book-collection-manager.gemspec +8 -3
  13. data/doc/dependency_decisions.yml +22 -3
  14. data/lib/alexandria.rb +2 -2
  15. data/lib/alexandria/book_providers.rb +47 -49
  16. data/lib/alexandria/book_providers/adlibris.rb +8 -13
  17. data/lib/alexandria/book_providers/amazon_aws.rb +47 -60
  18. data/lib/alexandria/book_providers/amazon_ecs_util.rb +283 -298
  19. data/lib/alexandria/book_providers/barnes_and_noble.rb +8 -8
  20. data/lib/alexandria/book_providers/douban.rb +2 -2
  21. data/lib/alexandria/book_providers/proxis.rb +12 -11
  22. data/lib/alexandria/book_providers/pseudomarc.rb +60 -70
  23. data/lib/alexandria/book_providers/siciliano.rb +5 -6
  24. data/lib/alexandria/book_providers/thalia.rb +8 -9
  25. data/lib/alexandria/book_providers/worldcat.rb +25 -31
  26. data/lib/alexandria/book_providers/z3950.rb +62 -69
  27. data/lib/alexandria/default_preferences.rb +37 -0
  28. data/lib/alexandria/execution_queue.rb +13 -12
  29. data/lib/alexandria/export_library.rb +4 -8
  30. data/lib/alexandria/import_library.rb +38 -62
  31. data/lib/alexandria/import_library_csv.rb +16 -16
  32. data/lib/alexandria/library_sort_order.rb +3 -1
  33. data/lib/alexandria/library_store.rb +16 -16
  34. data/lib/alexandria/logging.rb +4 -8
  35. data/lib/alexandria/models/book.rb +2 -2
  36. data/lib/alexandria/models/library.rb +18 -14
  37. data/lib/alexandria/net.rb +1 -2
  38. data/lib/alexandria/preferences.rb +27 -31
  39. data/lib/alexandria/scanners.rb +2 -2
  40. data/lib/alexandria/scanners/cue_cat.rb +5 -5
  41. data/lib/alexandria/scanners/keyboard.rb +1 -1
  42. data/lib/alexandria/smart_library.rb +22 -26
  43. data/lib/alexandria/ui.rb +7 -7
  44. data/lib/alexandria/ui/about_dialog.rb +1 -1
  45. data/lib/alexandria/ui/acquire_dialog.rb +9 -10
  46. data/lib/alexandria/ui/alert_dialog.rb +34 -19
  47. data/lib/alexandria/ui/bad_isbns_dialog.rb +13 -9
  48. data/lib/alexandria/ui/barcode_animation.rb +5 -5
  49. data/lib/alexandria/ui/book_properties_dialog.rb +2 -2
  50. data/lib/alexandria/ui/book_properties_dialog_base.rb +23 -17
  51. data/lib/alexandria/ui/callbacks.rb +141 -120
  52. data/lib/alexandria/ui/completion_models.rb +1 -1
  53. data/lib/alexandria/ui/confirm_erase_dialog.rb +1 -1
  54. data/lib/alexandria/ui/conflict_while_copying_dialog.rb +1 -1
  55. data/lib/alexandria/ui/error_dialog.rb +1 -1
  56. data/lib/alexandria/ui/export_dialog.rb +13 -15
  57. data/lib/alexandria/ui/icons.rb +34 -40
  58. data/lib/alexandria/ui/iconview_tooltips.rb +40 -53
  59. data/lib/alexandria/ui/import_dialog.rb +48 -47
  60. data/lib/alexandria/ui/init.rb +3 -2
  61. data/lib/alexandria/ui/keep_bad_isbn_dialog.rb +2 -2
  62. data/lib/alexandria/ui/libraries_combo.rb +10 -9
  63. data/lib/alexandria/ui/listview.rb +5 -6
  64. data/lib/alexandria/ui/main_app.rb +2 -2
  65. data/lib/alexandria/ui/multi_drag_treeview.rb +4 -6
  66. data/lib/alexandria/ui/new_book_dialog.rb +52 -52
  67. data/lib/alexandria/ui/new_provider_dialog.rb +12 -11
  68. data/lib/alexandria/ui/new_smart_library_dialog.rb +39 -27
  69. data/lib/alexandria/ui/preferences_dialog.rb +23 -82
  70. data/lib/alexandria/ui/provider_preferences_base_dialog.rb +9 -5
  71. data/lib/alexandria/ui/provider_preferences_dialog.rb +5 -5
  72. data/lib/alexandria/ui/really_delete_dialog.rb +1 -1
  73. data/lib/alexandria/ui/sidepane_manager.rb +35 -37
  74. data/lib/alexandria/ui/skip_entry_dialog.rb +3 -2
  75. data/lib/alexandria/ui/smart_library_properties_dialog.rb +35 -36
  76. data/lib/alexandria/ui/smart_library_properties_dialog_base.rb +59 -138
  77. data/lib/alexandria/ui/smart_library_rule_box.rb +119 -0
  78. data/lib/alexandria/ui/sound.rb +4 -6
  79. data/lib/alexandria/ui/ui_manager.rb +62 -64
  80. data/lib/alexandria/version.rb +2 -2
  81. data/lib/alexandria/web_themes.rb +15 -15
  82. data/po/cs.po +991 -874
  83. data/po/cy.po +957 -870
  84. data/po/de.po +991 -866
  85. data/po/el.po +987 -863
  86. data/po/es.po +986 -862
  87. data/po/fr.po +988 -868
  88. data/po/ga.po +910 -822
  89. data/po/gl.po +983 -863
  90. data/po/it.po +984 -862
  91. data/po/ja.po +969 -849
  92. data/po/mk.po +983 -859
  93. data/po/nb.po +982 -862
  94. data/po/nl.po +992 -869
  95. data/po/pl.po +1018 -963
  96. data/po/pt.po +983 -852
  97. data/po/pt_BR.po +983 -863
  98. data/po/ru.po +992 -869
  99. data/po/sk.po +986 -864
  100. data/po/sv.po +980 -860
  101. data/po/uk.po +975 -861
  102. data/po/zh_TW.po +974 -854
  103. data/share/alexandria/glade/main_app__builder.glade +6 -21
  104. data/share/gnome/help/alexandria/C/smart-libraries.xml +2 -2
  105. data/share/gnome/help/alexandria/C/working-with-libraries.xml +1 -1
  106. data/share/gnome/help/alexandria/fr/alexandria.xml +1 -1
  107. data/share/gnome/help/alexandria/ja/smart-libraries.xml +1 -1
  108. data/spec/alexandria/book_providers/world_cat_provider_spec.rb +160 -0
  109. data/spec/alexandria/book_providers_spec.rb +73 -129
  110. data/spec/alexandria/console_spec.rb +0 -5
  111. data/spec/alexandria/export_library_spec.rb +27 -38
  112. data/spec/alexandria/library_spec.rb +56 -44
  113. data/spec/alexandria/preferences_spec.rb +29 -3
  114. data/spec/alexandria/scanners/cue_cat_spec.rb +1 -1
  115. data/spec/alexandria/ui/about_dialog_spec.rb +1 -1
  116. data/spec/alexandria/ui/acquire_dialog_spec.rb +1 -1
  117. data/spec/alexandria/ui/alert_dialog_spec.rb +1 -1
  118. data/spec/alexandria/ui/bad_isbns_dialog_spec.rb +1 -1
  119. data/spec/alexandria/ui/book_properties_dialog_spec.rb +1 -1
  120. data/spec/alexandria/ui/confirm_erase_dialog_spec.rb +1 -1
  121. data/spec/alexandria/ui/conflict_while_copying_dialog_spec.rb +1 -1
  122. data/spec/alexandria/ui/error_dialog_spec.rb +1 -1
  123. data/spec/alexandria/ui/export_dialog_spec.rb +1 -1
  124. data/spec/alexandria/ui/icons_spec.rb +26 -0
  125. data/spec/alexandria/ui/iconview_spec.rb +1 -1
  126. data/spec/alexandria/ui/import_dialog_spec.rb +30 -3
  127. data/spec/alexandria/ui/keep_bad_isbn_dialog_spec.rb +1 -1
  128. data/spec/alexandria/ui/main_app_spec.rb +1 -1
  129. data/spec/alexandria/ui/new_book_dialog_manual_spec.rb +1 -1
  130. data/spec/alexandria/ui/new_provider_dialog_spec.rb +19 -3
  131. data/spec/alexandria/ui/new_smart_library_dialog_spec.rb +28 -3
  132. data/spec/alexandria/ui/preferences_dialog_spec.rb +1 -1
  133. data/spec/alexandria/ui/provider_preferences_dialog_spec.rb +23 -8
  134. data/spec/alexandria/ui/really_delete_dialog_spec.rb +1 -1
  135. data/spec/alexandria/ui/sidepane_manager_spec.rb +2 -2
  136. data/spec/alexandria/ui/skip_entry_dialog_spec.rb +1 -1
  137. data/spec/alexandria/ui/smart_library_properties_dialog_spec.rb +21 -7
  138. data/spec/alexandria/ui/ui_manager_spec.rb +39 -2
  139. data/spec/spec_helper.rb +46 -3
  140. data/tasks/spec.rake +3 -5
  141. data/util/rake/fileinstall.rb +12 -11
  142. metadata +82 -10
  143. data/spec/alexandria/ui/ui_utilities_spec.rb +0 -62
  144. data/spec/alexandria/utilities_spec.rb +0 -52
@@ -1,9 +1,12 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <!-- Generated with glade 3.22.0 -->
2
+ <!-- Generated with glade 3.22.2 -->
3
3
  <interface>
4
4
  <requires lib="gtk+" version="3.0"/>
5
5
  <object class="GtkWindow" id="main_app">
6
6
  <property name="can_focus">False</property>
7
+ <child type="titlebar">
8
+ <placeholder/>
9
+ </child>
7
10
  <child>
8
11
  <object class="GtkBox" id="vbox1">
9
12
  <property name="visible">True</property>
@@ -135,14 +138,7 @@
135
138
  </object>
136
139
  </child>
137
140
  <child type="tab">
138
- <object class="GtkLabel" id="label2">
139
- <property name="visible">True</property>
140
- <property name="can_focus">False</property>
141
- <property name="label" translatable="yes">label</property>
142
- </object>
143
- <packing>
144
- <property name="tab_fill">False</property>
145
- </packing>
141
+ <placeholder/>
146
142
  </child>
147
143
  <child>
148
144
  <object class="GtkScrolledWindow" id="scrolledwindow4">
@@ -165,15 +161,7 @@
165
161
  </packing>
166
162
  </child>
167
163
  <child type="tab">
168
- <object class="GtkLabel" id="label3">
169
- <property name="visible">True</property>
170
- <property name="can_focus">False</property>
171
- <property name="label" translatable="yes">label</property>
172
- </object>
173
- <packing>
174
- <property name="position">1</property>
175
- <property name="tab_fill">False</property>
176
- </packing>
164
+ <placeholder/>
177
165
  </child>
178
166
  </object>
179
167
  <packing>
@@ -228,8 +216,5 @@
228
216
  </child>
229
217
  </object>
230
218
  </child>
231
- <child type="titlebar">
232
- <placeholder/>
233
- </child>
234
219
  </object>
235
220
  </interface>
@@ -18,7 +18,7 @@
18
18
 
19
19
  <para>
20
20
  Smart Libraries are listed beneath the actual libraries in the
21
- application side pane. They do not actually contain books, but
21
+ application sidepane. They do not actually contain books, but
22
22
  rather a set of rules describing which books you wish to see. The
23
23
  books from all libraries which satisfy the set of rules will be
24
24
  displayed. You cannot directly add books to a Smart Library.
@@ -58,7 +58,7 @@
58
58
  <para>
59
59
  An example will illustrate the use of Smart Libraries. Let us
60
60
  suppose you have a large collections of books by Terry
61
- Practchett and you add the tag <quote>discworld</quote> to all
61
+ Pratchett and you add the tag <quote>discworld</quote> to all
62
62
  the books in the Discworld series. Let us create a Smart Library
63
63
  for all his non-Discworld books.
64
64
  </para>
@@ -12,7 +12,7 @@
12
12
  <para>Books stored in &app; can be grouped into different collections, called libraries. For instance, you may have
13
13
  one library for all your novels, and other for your programming manuals. &app; allows you to create, edit, and move books
14
14
  between libraries.</para>
15
- <para>Available libraries are listed in the <guilabel>Library pane</guilabel> at the left of the main &app; window. If you cannot see the library pane, open it with <menuchoice><guimenu>View</guimenu><guimenuitem>Side Pane</guimenuitem></menuchoice>. You can close it again with the same menu option, or by clicking the <guibutton>Close</guibutton> icon in the top right of the library pane.</para>
15
+ <para>Available libraries are listed in the <guilabel>Library pane</guilabel> at the left of the main &app; window. If you cannot see the library pane, open it with <menuchoice><guimenu>View</guimenu><guimenuitem>Sidepane</guimenuitem></menuchoice>. You can close it again with the same menu option, or by clicking the <guibutton>Close</guibutton> icon in the top right of the library pane.</para>
16
16
  <figure id="library-pane-fig">
17
17
  <title>An &app; list of libraries</title>
18
18
  <screenshot>
@@ -1240,7 +1240,7 @@ Date : 30 décembre 2005
1240
1240
  open it with
1241
1241
  <menuchoice>
1242
1242
  <guimenu>View</guimenu>
1243
- <guimenuitem>Side Pane</guimenuitem>
1243
+ <guimenuitem>Sidepane</guimenuitem>
1244
1244
  </menuchoice>.
1245
1245
  You can close it again with the same menu option, or by clicking
1246
1246
  the <guibutton>Close</guibutton> icon in the top right of the
@@ -44,7 +44,7 @@
44
44
 
45
45
 
46
46
  <para>
47
- 高機能ライブラリの例を以下に示します。Terry Practchettという作者の本をたくさん持っていて、
47
+ 高機能ライブラリの例を以下に示します。Terry Pratchettという作者の本をたくさん持っていて、
48
48
  Discworldシリーズの本に<quote>discworld</quote>というタグをつけてあるとします。
49
49
  高機能ライブラリで、彼のDiscworldシリーズでない本を探してライブラリ化します。
50
50
  </para>
@@ -0,0 +1,160 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is part of Alexandria.
4
+ #
5
+ # See the file README.md for authorship and licensing information.
6
+
7
+ require "spec_helper"
8
+
9
+ RSpec.describe Alexandria::BookProviders::WorldCatProvider do
10
+ let(:sky_catalog_main) do
11
+ <<~XHTML
12
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
13
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
14
+ <head></head>
15
+ <body id="worldcat">
16
+ <table class="table-results">
17
+ <tr class="menuElem">
18
+ <td class="result details">
19
+ <div class="name">
20
+ <a id="result-1" href="/title/sky-catalogue-20000-ed-by-alan-hirshfeld-and-roger-w-sinnott/oclc/476534140&referer=brief_results"><strong>Sky catalogue 2000.0 ed. by Alan Hirshfeld and Roger W. Sinnott</strong></a>
21
+ </div>
22
+ <div class="type">
23
+ <img class='icn' src='https://static1.worldcat.org/wcpa/rel20201014/images/icon-bks.gif' alt=' ' height='16' width='16' />&nbsp;<span class='itemType'>Print book</span>
24
+ </div>
25
+ </td>
26
+ </tr>
27
+ <tr class="menuElem">
28
+ <td class="result details">
29
+ <div class="name">
30
+ <a id="result-2" href="/title/sky-catalogue-20000/oclc/7978015&referer=brief_results"><strong>Sky catalogue 2000.0</strong></a>
31
+ </div>
32
+ <div class="type">
33
+ <img class='icn' src='https://static1.worldcat.org/wcpa/rel20201014/images/icon-bks.gif' alt=' ' height='16' width='16' />&nbsp;<span class='itemType'>Print book</span>
34
+ </div>
35
+ </td>
36
+ </tr>
37
+ </table>
38
+ </body>
39
+ </html>
40
+ XHTML
41
+ end
42
+
43
+ let(:sky_catalog_details) do
44
+ <<~XHTML
45
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
46
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
47
+ <head></head>
48
+ <body id="worldcat">
49
+ <div id="bibdata">
50
+ <h1 class="title">Sky catalogue 2000.0 ed. by Alan Hirshfeld and Roger W. Sinnott</h1>
51
+ <table border="0" cellspacing="0" cellpadding="0">
52
+ <tr id="bib-author-row">
53
+ <th>Author:</th>
54
+ <td id="bib-author-cell">
55
+ <a href='/search?q=au%3AHirshfeld+Alan&amp;qt=hot_author' title='Search for more by this author'>Hirshfeld Alan</a>;
56
+ <a href='/search?q=au%3ASinnott+Roger+W.&amp;qt=hot_author' title='Search for more by this author'>Sinnott Roger W.</a>;
57
+ <a href='/search?q=au%3ACambridge+Cambridge+University+Press+1982-&amp;qt=hot_author' title='Search for more by this author'>Cambridge Cambridge University Press 1982-</a>
58
+ </td>
59
+ </tr>
60
+ <tr id="bib-publisher-row">
61
+ <th>Publisher:</th>
62
+ <td id="bib-publisher-cell">1982</td>
63
+ </tr>
64
+ </table>
65
+ </div>
66
+ <table border="0" cellspacing="0">
67
+ <tr id="details-allauthors">
68
+ <th>All Authors / Contributors:</th>
69
+ <td>
70
+ <a href='/search?q=au%3AHirshfeld+Alan&amp;qt=hot_author' title='Search for more by this author'>Hirshfeld Alan</a>;
71
+ <a href='/search?q=au%3ASinnott+Roger+W.&amp;qt=hot_author' title='Search for more by this author'>Sinnott Roger W.</a>;
72
+ <a href='/search?q=au%3ACambridge+Cambridge+University+Press+1982-&amp;qt=hot_author' title='Search for more by this author'>Cambridge Cambridge University Press 1982-</a>
73
+ </td>
74
+ </tr>
75
+ <tr id="details-standardno">
76
+ <th>ISBN:</th>
77
+ <td>0521247101 9780521247108 0521289130 9780521289139 0521258189 9780521258180</td>
78
+ </tr>
79
+ </table>
80
+ </body>
81
+ </html>
82
+ XHTML
83
+ end
84
+
85
+ let(:florence_ru_details) do
86
+ <<~XHTML
87
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
88
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
89
+ <head></head>
90
+ <body id="worldcat">
91
+ <div id="bibdata">
92
+ <h1 class="title">
93
+ <div class="vernacular" lang="ru">Флоренс Аравийская : роман /</div>
94
+ Florens Araviĭskai︠a︡ : roman
95
+ </h1>
96
+ <table border="0" cellspacing="0" cellpadding="0">
97
+ <tr id="bib-author-row">
98
+ <th>Author:</th>
99
+ <td id="bib-author-cell">
100
+ <span class="vernacular" lang="ru">Кристофер Бакли ; перевод с английского Андрея Геласимова.</span>
101
+ <span class="vernacular" lang="ru">Геласимов, Андрей.</span> ;
102
+ <a href="/search?q=au%3ABuckley%2C+Christopher%2C&amp;qt=hot_author" title="Search for more by this author">Christopher Buckley</a>;
103
+ <a href="/search?q=au%3AGelasimov%2C+Andrei%CC%86.&amp;qt=hot_author" title="Search for more by this author">Andreĭ Gelasimov</a>
104
+ </td>
105
+ </tr>
106
+ <tr id="bib-publisher-row">
107
+ <th>Publisher:</th>
108
+ <td id="bib-publisher-cell"><span class="vernacular" lang="ru">Иностранка,</span>
109
+ Moskva : Inostranka, 2006.
110
+ </td>
111
+ </tr>
112
+ </table>
113
+ </div>
114
+ <table border="0" cellspacing="0">
115
+ <tr id="details-allauthors">
116
+ <th>All Authors / Contributors:</th>
117
+ <td>
118
+ <span class="vernacular" lang="ru">Кристофер Бакли ; перевод с английского Андрея Геласимова.</span>
119
+ <span class="vernacular" lang="ru">Геласимов, Андрей.</span> ;
120
+ <a href="/search?q=au%3ABuckley%2C+Christopher%2C&amp;qt=hot_author" title="Search for more by this author">Christopher Buckley</a>;
121
+ <a href="/search?q=au%3AGelasimov%2C+Andrei%CC%86.&amp;qt=hot_author" title="Search for more by this author">Andreĭ Gelasimov</a>
122
+ </td>
123
+ </tr>
124
+ <tr id="details-standardno">
125
+ <th>ISBN:</th>
126
+ <td>5941454139 9785941454136</td>
127
+ </tr>
128
+ </table>
129
+ </body>
130
+ </html>
131
+ XHTML
132
+ end
133
+
134
+ it "works for an isbn with multiple results" do
135
+ stub_request(:get, "https://www.worldcat.org/search?q=isbn:9780521247108&qt=advanced")
136
+ .to_return(status: 200, body: +sky_catalog_main, headers: {})
137
+ stub_request(:get,
138
+ "https://www.worldcat.org/title/" \
139
+ "sky-catalogue-20000-ed-by-alan-hirshfeld-and-roger-w-sinnott" \
140
+ "/oclc/476534140&referer=brief_results")
141
+ .to_return(status: 200, body: +sky_catalog_details, headers: {})
142
+ assert_correct_search_result(described_class, "9780521247108")
143
+ end
144
+
145
+ it "works with vernacular" do
146
+ stub_request(:get, "https://www.worldcat.org/search?q=isbn:9785941454136&qt=advanced")
147
+ .to_return(status: 200, body: +florence_ru_details, headers: {})
148
+ assert_correct_search_result(described_class, "9785941454136")
149
+ end
150
+
151
+ it "works with multiple authors" do
152
+ stub_request(:get, "https://www.worldcat.org/search?q=isbn:9785941454136&qt=advanced")
153
+ .to_return(status: 200, body: +florence_ru_details, headers: {})
154
+ results = assert_correct_search_result(described_class,
155
+ "9785941454136")
156
+ this_book = results.first
157
+ expect(this_book.authors).to be_instance_of(Array), "Not an array!"
158
+ expect(this_book.authors.length).to eq(2), "Wrong number of authors for this book!"
159
+ end
160
+ end
@@ -9,157 +9,101 @@ require "spec_helper"
9
9
  describe Alexandria::BookProviders do
10
10
  it "should be less clever"
11
11
 
12
- def assert_correct_search_result(provider, query,
13
- search_type = Alexandria::BookProviders::SEARCH_BY_ISBN)
14
- begin
15
- results = provider.instance.search(query, search_type)
16
- rescue SocketError
17
- skip "Service is offline"
18
- end
19
-
20
- puts results.inspect if $DEBUG
21
-
22
- expect(results).to be_instance_of(Array), "Results are not an array for #{provider}"
23
- expect(results).not_to be_empty, "Results are empty for #{provider}"
24
-
25
- if search_type == Alexandria::BookProviders::SEARCH_BY_ISBN
26
- expect(results.length).to be <= 2, "Results are greater than 2 for #{provider}"
27
-
28
- book = results.first
29
-
30
- expect(book).to be_instance_of(Alexandria::Book),
31
- "Result is not a Book for #{provider}"
32
-
33
- canonical_query = Alexandria::Library.canonicalise_ean(query)
34
- canonical_result = Alexandria::Library.canonicalise_ean(book.isbn)
35
- expect(canonical_query)
36
- .to eq(canonical_result),
37
- "Result's isbn #{book.isbn} is not equivalent" \
38
- " to the requested isbn #{query} for #{provider}"
39
-
40
- if results.length == 2
41
- cover_url = results.last
42
- if cover_url
43
- expect(cover_url)
44
- .to be_instance_of(String),
45
- "Unexpected cover_url #{cover_url.inspect} for #{provider}"
46
- end
47
- end
48
- else
49
- expect(results.first.first)
50
- .to be_instance_of(Alexandria::Book), "Result item is not a Book for #{provider}"
51
- end
52
- results
53
- end
12
+ describe Alexandria::BookProviders::AmazonProvider do
13
+ before do
14
+ skip "Amazon requires an API key. Remove it altogether as a provider?"
15
+ end
54
16
 
55
- it "does not piss off Rich Burridge" do
56
- skip "Amazon requires an API key. Remove it altogether as a provider?"
57
- assert_correct_search_result(Alexandria::BookProviders::AmazonProvider,
58
- "033025068X")
59
- end
17
+ it "does not piss off Rich Burridge" do
18
+ assert_correct_search_result(described_class, "033025068X")
19
+ end
60
20
 
61
- it "amazon should work" do
62
- skip "Amazon requires an API key. Remove it altogether as a provider?"
63
- assert_correct_search_result(Alexandria::BookProviders::AmazonProvider,
64
- "9780385504201")
65
- end
21
+ it "works" do
22
+ assert_correct_search_result(described_class, "9780385504201")
23
+ end
66
24
 
67
- it "amazon title should work" do
68
- skip "Amazon requires an API key. Remove it altogether as a provider?"
69
- assert_correct_search_result(Alexandria::BookProviders::AmazonProvider,
70
- "A Confederacy of Dunces",
71
- Alexandria::BookProviders::SEARCH_BY_TITLE)
72
- end
25
+ it "works when searching for title" do
26
+ assert_correct_search_result(described_class, "A Confederacy of Dunces",
27
+ Alexandria::BookProviders::SEARCH_BY_TITLE)
28
+ end
73
29
 
74
- it "amazon authors should work" do
75
- skip "Amazon requires an API key. Remove it altogether as a provider?"
76
- assert_correct_search_result(Alexandria::BookProviders::AmazonProvider,
77
- "John Kennedy Toole",
78
- Alexandria::BookProviders::SEARCH_BY_AUTHORS)
79
- end
30
+ it "amazon authors should work" do
31
+ assert_correct_search_result(described_class, "John Kennedy Toole",
32
+ Alexandria::BookProviders::SEARCH_BY_AUTHORS)
33
+ end
80
34
 
81
- it "amazon keyword should work" do
82
- skip "Amazon requires an API key. Remove it altogether as a provider?"
83
- assert_correct_search_result(Alexandria::BookProviders::AmazonProvider,
84
- "Confederacy Dunces",
85
- Alexandria::BookProviders::SEARCH_BY_KEYWORD)
35
+ it "amazon keyword should work" do
36
+ assert_correct_search_result(described_class, "Confederacy Dunces",
37
+ Alexandria::BookProviders::SEARCH_BY_KEYWORD)
38
+ end
86
39
  end
87
40
 
88
- it "LOC should work" do
89
- assert_correct_search_result(Alexandria::BookProviders::LOCProvider,
90
- "9780805335583")
91
- # this book has non-ASCII letters
92
- assert_correct_search_result(Alexandria::BookProviders::LOCProvider,
93
- "9782070379248")
94
- end
41
+ describe Alexandria::BookProviders::LOCProvider do
42
+ it "works for a book with ASCII title" do
43
+ assert_correct_search_result(described_class, "9780805335583")
44
+ end
95
45
 
96
- it "BL should work" do
97
- skip "Not working: connect failed"
98
- assert_correct_search_result(Alexandria::BookProviders::BLProvider,
99
- "9781853260803")
46
+ it "works for a book with a title with non-ASCII letters" do
47
+ assert_correct_search_result(described_class, "9782070379248")
48
+ end
100
49
  end
101
50
 
102
- it "SBN should work" do
103
- assert_correct_search_result(Alexandria::BookProviders::SBNProvider,
104
- "9788835926436")
51
+ describe Alexandria::BookProviders::BLProvider do
52
+ it "works" do
53
+ skip "Not working: connect failed"
54
+ assert_correct_search_result(described_class, "9781853260803")
55
+ end
105
56
  end
106
57
 
107
- it "Barnes and Noble should work" do
108
- skip "Barnes and Noble is not operational at the moment"
109
- assert_correct_search_result(Alexandria::BookProviders::BarnesAndNobleProvider,
110
- "9780961328917") # see #1433
58
+ describe Alexandria::BookProviders::SBNProvider do
59
+ it "works" do
60
+ assert_correct_search_result(described_class, "9788835926436")
61
+ end
111
62
  end
112
63
 
113
- it "Proxis should work" do
114
- skip "Needs fixing"
115
- assert_correct_search_result(Alexandria::BookProviders::ProxisProvider,
116
- "9789026965746")
117
- assert_correct_search_result(Alexandria::BookProviders::ProxisProvider,
118
- "9780586071403")
64
+ describe Alexandria::BookProviders::BarnesAndNobleProvider do
65
+ it "works" do
66
+ skip "Barnes and Noble is not operational at the moment"
67
+ assert_correct_search_result(described_class, "9780961328917") # see #1433
68
+ end
119
69
  end
120
70
 
121
- it "Thalia should work" do
122
- skip "Needs fixing"
123
- # german book
124
- assert_correct_search_result(Alexandria::BookProviders::ThaliaProvider,
125
- "9783896673305")
126
- # international book
127
- assert_correct_search_result(Alexandria::BookProviders::ThaliaProvider,
128
- "9780440241904")
129
- # movie dvd
130
- assert_correct_search_result(Alexandria::BookProviders::ThaliaProvider,
131
- "4010232037824")
132
- # music cd
133
- assert_correct_search_result(Alexandria::BookProviders::ThaliaProvider,
134
- "0094638203520")
71
+ describe Alexandria::BookProviders::ProxisProvider do
72
+ it "works" do
73
+ skip "Needs fixing"
74
+ assert_correct_search_result(described_class, "9789026965746")
75
+ assert_correct_search_result(described_class, "9780586071403")
76
+ end
135
77
  end
136
78
 
137
- it "AdLibris should work" do
138
- skip "Needs fixing: site has changed"
139
- assert_correct_search_result(Alexandria::BookProviders::AdLibrisProvider,
140
- "9789100109332")
141
- end
79
+ describe Alexandria::BookProviders::ThaliaProvider do
80
+ before do
81
+ skip "Needs fixing"
82
+ end
142
83
 
143
- it "Siciliano should work" do
144
- skip "Needs fixing: no results found"
145
- assert_correct_search_result(Alexandria::BookProviders::SicilianoProvider,
146
- "9788599170380")
84
+ it "works" do
85
+ # german book
86
+ assert_correct_search_result(described_class, "9783896673305")
87
+ # international book
88
+ assert_correct_search_result(described_class, "9780440241904")
89
+ # movie dvd
90
+ assert_correct_search_result(described_class, "4010232037824")
91
+ # music cd
92
+ assert_correct_search_result(described_class, "0094638203520")
93
+ end
147
94
  end
148
95
 
149
- it "Worldcat should work" do
150
- assert_correct_search_result(Alexandria::BookProviders::WorldCatProvider,
151
- "9780521247108")
152
- # this one is with <div class=vernacular lang="[^"]+">)
153
- assert_correct_search_result(Alexandria::BookProviders::WorldCatProvider,
154
- "9785941454136")
96
+ describe Alexandria::BookProviders::AdLibrisProvider do
97
+ it "works" do
98
+ skip "Needs fixing: site has changed"
99
+ assert_correct_search_result(described_class, "9789100109332")
100
+ end
155
101
  end
156
102
 
157
- it "Worldcat should work with multiple authors" do
158
- results = assert_correct_search_result(Alexandria::BookProviders::WorldCatProvider,
159
- "9785941454136")
160
- this_book = results.first
161
- expect(this_book.authors).to be_instance_of(Array), "Not an array!"
162
- # puts this_book.authors
163
- expect(this_book.authors.length).to eq(2), "Wrong number of authors for this book!"
103
+ describe Alexandria::BookProviders::SicilianoProvider do
104
+ it "works" do
105
+ skip "Needs fixing: no results found"
106
+ assert_correct_search_result(described_class, "9788599170380")
107
+ end
164
108
  end
165
109
  end