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
@@ -10,14 +10,9 @@ RSpec.describe Alexandria do
10
10
  let(:lib_version) { File.join(LIBDIR, "0.6.2") }
11
11
 
12
12
  before do
13
- FileUtils.rm_rf(TESTDIR)
14
13
  FileUtils.cp_r(lib_version, TESTDIR)
15
14
  end
16
15
 
17
- after do
18
- FileUtils.rm_rf(TESTDIR)
19
- end
20
-
21
16
  describe ".list_books_on_console" do
22
17
  it "returns a string containing a list of all books" do
23
18
  expect(described_class.list_books_on_console).to eq <<~LIST
@@ -7,24 +7,23 @@
7
7
  require "spec_helper"
8
8
 
9
9
  RSpec.describe Alexandria::ExportLibrary do
10
- let(:lib_version) { File.join(LIBDIR, "0.6.2") }
11
-
12
- let(:loader) { Alexandria::LibraryStore.new(TESTDIR) }
13
-
10
+ let(:my_library) do
11
+ loader = Alexandria::LibraryStore.new(TESTDIR)
12
+ loader.load_library("My Library")
13
+ end
14
14
  let(:format) { Alexandria::ExportFormat.all.find { |it| it.message == message } }
15
- let(:outfile_base) { format.ext ? "my-library.#{format.ext}" : "my-library" }
16
- let(:outfile) { File.join(Dir.tmpdir, outfile_base) }
17
-
15
+ let(:outfile) do
16
+ outfile_base = format.ext ? "my-library.#{format.ext}" : "my-library"
17
+ File.join(Dir.tmpdir, outfile_base)
18
+ end
18
19
  let(:unsorted) { Alexandria::LibrarySortOrder::Unsorted.new }
19
20
 
20
21
  before do
21
- FileUtils.cp_r(lib_version, TESTDIR)
22
- @my_library = loader.load_library("My Library")
23
- expect(@my_library.size).to eq 5
22
+ test_library = File.join(LIBDIR, "0.6.2")
23
+ FileUtils.cp_r(test_library, TESTDIR)
24
24
  end
25
25
 
26
26
  after do
27
- FileUtils.rm_rf(TESTDIR)
28
27
  FileUtils.rm_rf(outfile) if File.exist? outfile
29
28
  end
30
29
 
@@ -32,44 +31,33 @@ RSpec.describe Alexandria::ExportLibrary do
32
31
  let(:message) { :export_as_csv_list }
33
32
 
34
33
  def load_rows_from_csv
35
- CSV.read(outfile, col_sep: ";")
34
+ CSV.read(outfile, col_sep: ";", headers: true)
36
35
  end
37
36
 
38
37
  it "can sort by title" do
39
38
  sort_by_title = Alexandria::LibrarySortOrder.new(:title)
40
- format.invoke(@my_library, sort_by_title, outfile)
41
- expect(File.exist?(outfile)).to be_truthy
39
+ format.invoke(my_library, sort_by_title, outfile)
42
40
  rows = load_rows_from_csv
43
- rows.shift
44
- expect(rows.size).to eq(@my_library.size)
45
- title_index = 0
46
- comparisons = rows.size - 1
47
- comparisons.times do |index|
48
- expect(rows[index][title_index]).to be <= rows[index + 1][title_index]
49
- end
41
+ titles = rows.map { |it| it["Title"] }
42
+ expect(titles).to eq titles.sort
50
43
  end
51
44
 
52
45
  it "can sort in descending order" do
53
46
  sort_by_date_desc = Alexandria::LibrarySortOrder.new(:publishing_year, false)
54
- format.invoke(@my_library, sort_by_date_desc, outfile)
55
- expect(File.exist?(outfile)).to be_truthy
47
+ format.invoke(my_library, sort_by_date_desc, outfile)
56
48
  rows = load_rows_from_csv
57
- rows.shift
58
- expect(rows.size).to eq(@my_library.size)
59
- date_index = 5
60
- comparisons = rows.size - 1
61
- comparisons.times do |index|
62
- expect(rows[index][date_index]).to be >= rows[index + 1][date_index]
63
- end
49
+ dates = rows.map { |it| it["Year Published"] }
50
+ expect(dates).to eq dates.sort.reverse
64
51
  end
65
52
  end
66
53
 
67
54
  describe "#export_as_html" do
68
55
  let(:message) { :export_as_html }
69
- let(:index) { File.join(outfile, "index.html") }
70
56
 
71
57
  it "can export unsorted" do
72
- format.invoke(@my_library, unsorted, outfile, Alexandria::WebTheme.all.first)
58
+ format.invoke(my_library, unsorted, outfile, Alexandria::WebTheme.all.first)
59
+ index = File.join(outfile, "index.html")
60
+
73
61
  aggregate_failures do
74
62
  expect(File.exist?(outfile)).to be_truthy
75
63
  expect(File.exist?(index)).to be_truthy
@@ -82,7 +70,7 @@ RSpec.describe Alexandria::ExportLibrary do
82
70
  let(:message) { :export_as_onix_xml_archive }
83
71
 
84
72
  it "can export unsorted" do
85
- format.invoke(@my_library, unsorted, outfile)
73
+ format.invoke(my_library, unsorted, outfile)
86
74
  aggregate_failures do
87
75
  expect(File.exist?(outfile)).to be_truthy
88
76
  expect(File.size(outfile)).to be_nonzero
@@ -94,7 +82,7 @@ RSpec.describe Alexandria::ExportLibrary do
94
82
  let(:message) { :export_as_tellico_xml_archive }
95
83
 
96
84
  it "can export unsorted" do
97
- format.invoke(@my_library, unsorted, outfile)
85
+ format.invoke(my_library, unsorted, outfile)
98
86
  aggregate_failures do
99
87
  expect(File.exist?(outfile)).to be_truthy
100
88
  expect(File.size(outfile)).to be_nonzero
@@ -106,7 +94,7 @@ RSpec.describe Alexandria::ExportLibrary do
106
94
  let(:message) { :export_as_bibtex }
107
95
 
108
96
  it "can export unsorted" do
109
- format.invoke(@my_library, unsorted, outfile)
97
+ format.invoke(my_library, unsorted, outfile)
110
98
  aggregate_failures do
111
99
  expect(File.exist?(outfile)).to be_truthy
112
100
  expect(File.size(outfile)).to be_nonzero
@@ -118,7 +106,7 @@ RSpec.describe Alexandria::ExportLibrary do
118
106
  let(:message) { :export_as_isbn_list }
119
107
 
120
108
  it "can export unsorted" do
121
- format.invoke(@my_library, unsorted, outfile)
109
+ format.invoke(my_library, unsorted, outfile)
122
110
  aggregate_failures do
123
111
  expect(File.exist?(outfile)).to be_truthy
124
112
  expect(File.size(outfile)).to be_nonzero
@@ -128,10 +116,11 @@ RSpec.describe Alexandria::ExportLibrary do
128
116
 
129
117
  describe "#export_as_ipod_notes" do
130
118
  let(:message) { :export_as_ipod_notes }
131
- let(:index) { File.join(outfile, "index.linx") }
132
119
 
133
120
  it "can export unsorted" do
134
- format.invoke(@my_library, unsorted, outfile, nil)
121
+ format.invoke(my_library, unsorted, outfile, nil)
122
+ index = File.join(outfile, "index.linx")
123
+
135
124
  aggregate_failures do
136
125
  expect(File.exist?(outfile)).to be_truthy
137
126
  expect(File.size(index)).to be_nonzero
@@ -78,10 +78,6 @@ describe Alexandria::Library do
78
78
  FileUtils.mkdir(TESTDIR) unless File.exist? TESTDIR
79
79
  end
80
80
 
81
- after do
82
- FileUtils.rm_rf(TESTDIR)
83
- end
84
-
85
81
  it "disallows multiple deletion of the same copy of a book" do
86
82
  first_copy = an_artist_of_the_floating_world
87
83
  my_library << first_copy
@@ -104,53 +100,64 @@ describe Alexandria::Library do
104
100
  end
105
101
 
106
102
  describe ".import_as_isbn_list" do
107
- def __test_fake_import_isbns
103
+ before do
108
104
  libraries = Alexandria::LibraryCollection.instance
109
- library = Alexandria::Library.new("Test Library")
105
+ library = described_class.new("Test Library")
110
106
  libraries.add_library(library)
111
- [library, libraries]
107
+
108
+ allow(Alexandria::BookProviders)
109
+ .to receive(:isbn_search)
110
+ .and_raise Alexandria::BookProviders::SearchEmptyError
111
+ allow(Alexandria::BookProviders)
112
+ .to receive(:isbn_search).with("0595371086")
113
+ .and_return(an_artist_of_the_floating_world)
112
114
  end
113
115
 
114
- it "doesn't work quite yet" do
115
- skip
116
- # Doesn't work quite yet.
117
- on_iterate_cb = proc {}
118
- on_error_cb = proc {}
119
- library, _libraries = __test_fake_import_isbns
120
- test_file = "data/isbns.txt"
121
- library.import_as_isbn_list("Test Library", test_file, on_iterate_cb, on_error_cb)
116
+ it "imports books with correct isbn and search result" do
117
+ library, bad_isbns, failed_lookup_isbns =
118
+ described_class.import_as_isbn_list("Test Library", "spec/data/isbns.txt",
119
+ proc {}, proc {})
120
+
121
+ aggregate_failures do
122
+ expect(library.to_a).to eq [an_artist_of_the_floating_world]
123
+ expect(bad_isbns).to eq ["0911826449"]
124
+ expect(failed_lookup_isbns).to eq ["0740704923"]
125
+ end
122
126
  end
123
127
  end
124
128
 
125
129
  context "when importing from 0.6.1 data files" do
130
+ let(:libs) { loader.load_all_libraries }
131
+ let(:my_library) { libs[0] }
132
+
126
133
  before do
127
134
  lib_version = File.join(LIBDIR, "0.6.1")
128
135
  FileUtils.cp_r(lib_version, TESTDIR)
129
136
  end
130
137
 
131
- after do
132
- FileUtils.rm_rf(TESTDIR)
138
+ it "can be loaded" do
139
+ expect(libs.size).to eq(1)
140
+ expect(my_library.size).to eq(3)
133
141
  end
134
142
 
135
143
  it "imports cleanly from version 0.6.1 data format" do
136
- libs = loader.load_all_libraries
137
- expect(libs.size).to eq(1)
138
- my_library = libs[0]
139
- expect(my_library.size).to eq(3)
140
144
  # Malory
141
- malory_book = my_library.select { |b| b.isbn == "9780192812179" }[0]
145
+ malory_book = my_library.find { |b| b.isbn == "9780192812179" }
142
146
  expect(malory_book.publisher).to eq("Oxford University Press")
143
147
  expect(malory_book.authors.include?("Vinaver")).to be_truthy
144
148
  expect(malory_book.version).to eq(Alexandria::DATA_VERSION)
145
149
 
146
150
  # Guide to LaTeX
147
- latex_book = my_library.select { |b| b.title.include? "Latex" }[0]
151
+ latex_book = my_library.find { |b| b.title.include? "Latex" }
148
152
  expect(latex_book.isbn).to eq("9780201398250")
149
153
  expect(latex_book.publisher).to eq("Addison Wesley") # note, no Ruby-Amazon cruft
150
154
  end
151
155
  end
152
156
 
153
157
  context "when importing from 0.6.1 with books without an ISBN" do
158
+ let(:libs) { loader.load_all_libraries }
159
+ let(:my_library) { libs[0] }
160
+
154
161
  before do
155
162
  lib_version = File.join(LIBDIR, "0.6.1-noisbn")
156
163
  FileUtils.cp_r(lib_version, TESTDIR)
@@ -160,58 +167,63 @@ describe Alexandria::Library do
160
167
  FileUtils.rm_rf(TESTDIR)
161
168
  end
162
169
 
163
- it "allows books to have no ISBN" do
164
- libs = loader.load_all_libraries
170
+ it "can be loaded" do
165
171
  expect(libs.size).to eq(1)
166
- my_library = libs[0]
167
172
  expect(my_library.size).to eq(2)
173
+ end
168
174
 
175
+ it "loads a book with ISBN" do
169
176
  # Guide to LaTeX
170
- latex_book = my_library.select { |b| b.title.include? "Latex" }[0]
177
+ latex_book = my_library.find { |b| b.title.include? "Latex" }
171
178
  expect(latex_book.isbn).to eq("9780201398250")
172
179
  expect(latex_book.publisher).to eq("Addison Wesley") # note, no Ruby-Amazon cruft
173
180
  expect(latex_book.version).to eq(Alexandria::DATA_VERSION)
181
+ end
174
182
 
183
+ it "loads a book without ISBN" do
175
184
  # Lex and Yacc
176
- lex_and_yacc_book = my_library.select { |b| b.title.include? "Lex" }[0]
185
+ lex_and_yacc_book = my_library.find { |b| b.title.include? "Lex" }
177
186
  expect(lex_and_yacc_book.publisher).to eq("O'Reilley")
187
+ end
178
188
 
179
- my_library.each do |book|
180
- my_library.save(book, true)
181
- end
182
-
183
- libraries_reloaded = loader.load_all_libraries
184
- my_library_reloaded = libraries_reloaded[0]
185
-
189
+ it "saves loaded books properly" do
190
+ my_library.each { |book| my_library.save(book, true) }
191
+ my_library_reloaded = loader.load_all_libraries[0]
186
192
  expect(my_library_reloaded.size).to eq(2)
187
193
 
188
- latex_book = my_library_reloaded.select { |b| b.title.include? "Latex" }[0]
189
- expect(latex_book).not_to be_nil
194
+ latex_book = my_library_reloaded.find { |b| b.title.include? "Latex" }
190
195
  expect(latex_book.publisher).to eq("Addison Wesley")
191
196
 
192
- lex_and_yacc_book = my_library_reloaded.select { |b| b.title.include? "Lex" }[0]
193
- expect(lex_and_yacc_book).not_to be_nil
197
+ lex_and_yacc_book = my_library_reloaded.find { |b| b.title.include? "Lex" }
194
198
  expect(lex_and_yacc_book.publisher).to eq("O'Reilley")
195
199
  end
196
200
  end
197
201
 
198
202
  describe ".move" do
203
+ let(:source) { loader.load_library("My Library") }
204
+ let(:target) { loader.load_library("Target") }
205
+ let(:book) { source.first }
206
+
199
207
  before do
200
208
  lib_version = File.join(LIBDIR, "0.6.2")
201
209
  FileUtils.cp_r(lib_version, TESTDIR)
202
210
  end
203
211
 
204
- it "moves the given book from source to target" do
205
- source = loader.load_library("My Library")
212
+ it "changes the number of books in the source and target libraries" do
206
213
  count = source.count
207
- book = source.first
208
- target = loader.load_library("Target")
209
214
 
210
- described_class.move(source, target, source.first)
215
+ described_class.move(source, target, book)
211
216
 
212
217
  aggregate_failures do
213
218
  expect(source.count).to eq count - 1
214
219
  expect(target.count).to eq 1
220
+ end
221
+ end
222
+
223
+ it "moves the book files from source to target" do
224
+ described_class.move(source, target, book)
225
+
226
+ aggregate_failures do
215
227
  expect(File.exist?(source.yaml(book))).to be_falsey
216
228
  expect(File.exist?(source.cover(book))).to be_falsey
217
229
  expect(File.exist?(target.yaml(book))).to be_truthy
@@ -4,13 +4,39 @@
4
4
  #
5
5
  # See the file README.md for authorship and licensing information.
6
6
 
7
- require File.dirname(__FILE__) + "/../spec_helper"
7
+ require_relative "../spec_helper"
8
8
 
9
9
  describe Alexandria::Preferences do
10
10
  let(:instance) { described_class.instance }
11
11
 
12
- it "returns nil fetching unknown setting" do
13
- expect(instance.does_not_exist).to eq nil
12
+ describe "#get_variable" do
13
+ it "returns nil fetching unknown setting" do
14
+ expect(instance.get_variable("does_not_exist")).to eq nil
15
+ end
16
+
17
+ it "allows fetching by string" do
18
+ instance.toolbar_visible = false
19
+ expect(instance.get_variable("toolbar_visible")).to eq false
20
+ end
21
+
22
+ it "allows fetching by symbol" do
23
+ instance.toolbar_visible = true
24
+ expect(instance.get_variable(:toolbar_visible)).to eq true
25
+ end
26
+ end
27
+
28
+ describe "#set_variable" do
29
+ it "allows setting by string" do
30
+ instance.toolbar_visible = false
31
+ instance.set_variable("toolbar_visible", true)
32
+ expect(instance.toolbar_visible).to eq true
33
+ end
34
+
35
+ it "allows setting by symbol" do
36
+ instance.toolbar_visible = false
37
+ instance.set_variable(:toolbar_visible, true)
38
+ expect(instance.toolbar_visible).to eq true
39
+ end
14
40
  end
15
41
 
16
42
  it "allows setting known setting to false" do
@@ -4,7 +4,7 @@
4
4
  #
5
5
  # See the file README.md for authorship and licensing information.
6
6
 
7
- require File.dirname(__FILE__) + "/../../spec_helper"
7
+ require_relative "../../spec_helper"
8
8
 
9
9
  describe Alexandria::Scanners::CueCat do
10
10
  let(:cuecat) { described_class.new }
@@ -4,7 +4,7 @@
4
4
  #
5
5
  # See the file README.md for authorship and licensing information.
6
6
 
7
- require File.dirname(__FILE__) + "/../../spec_helper"
7
+ require_relative "../../spec_helper"
8
8
 
9
9
  describe Alexandria::UI::AboutDialog do
10
10
  it "works" do
@@ -4,7 +4,7 @@
4
4
  #
5
5
  # See the file README.md for authorship and licensing information.
6
6
 
7
- require File.dirname(__FILE__) + "/../../spec_helper"
7
+ require_relative "../../spec_helper"
8
8
 
9
9
  describe Alexandria::UI::AcquireDialog do
10
10
  it "works" do
@@ -4,7 +4,7 @@
4
4
  #
5
5
  # See the file README.md for authorship and licensing information.
6
6
 
7
- require File.dirname(__FILE__) + "/../../spec_helper"
7
+ require_relative "../../spec_helper"
8
8
 
9
9
  describe Alexandria::UI::AlertDialog do
10
10
  it "works" do
@@ -4,7 +4,7 @@
4
4
  #
5
5
  # See the file README.md for authorship and licensing information.
6
6
 
7
- require File.dirname(__FILE__) + "/../../spec_helper"
7
+ require_relative "../../spec_helper"
8
8
 
9
9
  describe Alexandria::UI::BadIsbnsDialog do
10
10
  it "works" do
@@ -4,7 +4,7 @@
4
4
  #
5
5
  # See the file README.md for authorship and licensing information.
6
6
 
7
- require File.dirname(__FILE__) + "/../../spec_helper"
7
+ require_relative "../../spec_helper"
8
8
 
9
9
  describe Alexandria::UI::BookPropertiesDialog do
10
10
  it "works" do
@@ -4,7 +4,7 @@
4
4
  #
5
5
  # See the file README.md for authorship and licensing information.
6
6
 
7
- require File.dirname(__FILE__) + "/../../spec_helper"
7
+ require_relative "../../spec_helper"
8
8
 
9
9
  describe Alexandria::UI::ConfirmEraseDialog do
10
10
  it "works" do
@@ -4,7 +4,7 @@
4
4
  #
5
5
  # See the file README.md for authorship and licensing information.
6
6
 
7
- require File.dirname(__FILE__) + "/../../spec_helper"
7
+ require_relative "../../spec_helper"
8
8
 
9
9
  describe Alexandria::UI::ConflictWhileCopyingDialog do
10
10
  it "works" do