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.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +9 -0
- data/.gitignore +4 -1
- data/.rubocop.yml +51 -29
- data/.rubocop_todo.yml +33 -155
- data/.simplecov +5 -2
- data/.travis.yml +10 -4
- data/CHANGELOG.md +19 -0
- data/INSTALL.md +23 -11
- data/README.md +36 -35
- data/Rakefile +7 -5
- data/alexandria-book-collection-manager.gemspec +8 -3
- data/doc/dependency_decisions.yml +22 -3
- data/lib/alexandria.rb +2 -2
- data/lib/alexandria/book_providers.rb +47 -49
- data/lib/alexandria/book_providers/adlibris.rb +8 -13
- data/lib/alexandria/book_providers/amazon_aws.rb +47 -60
- data/lib/alexandria/book_providers/amazon_ecs_util.rb +283 -298
- data/lib/alexandria/book_providers/barnes_and_noble.rb +8 -8
- data/lib/alexandria/book_providers/douban.rb +2 -2
- data/lib/alexandria/book_providers/proxis.rb +12 -11
- data/lib/alexandria/book_providers/pseudomarc.rb +60 -70
- data/lib/alexandria/book_providers/siciliano.rb +5 -6
- data/lib/alexandria/book_providers/thalia.rb +8 -9
- data/lib/alexandria/book_providers/worldcat.rb +25 -31
- data/lib/alexandria/book_providers/z3950.rb +62 -69
- data/lib/alexandria/default_preferences.rb +37 -0
- data/lib/alexandria/execution_queue.rb +13 -12
- data/lib/alexandria/export_library.rb +4 -8
- data/lib/alexandria/import_library.rb +38 -62
- data/lib/alexandria/import_library_csv.rb +16 -16
- data/lib/alexandria/library_sort_order.rb +3 -1
- data/lib/alexandria/library_store.rb +16 -16
- data/lib/alexandria/logging.rb +4 -8
- data/lib/alexandria/models/book.rb +2 -2
- data/lib/alexandria/models/library.rb +18 -14
- data/lib/alexandria/net.rb +1 -2
- data/lib/alexandria/preferences.rb +27 -31
- data/lib/alexandria/scanners.rb +2 -2
- data/lib/alexandria/scanners/cue_cat.rb +5 -5
- data/lib/alexandria/scanners/keyboard.rb +1 -1
- data/lib/alexandria/smart_library.rb +22 -26
- data/lib/alexandria/ui.rb +7 -7
- data/lib/alexandria/ui/about_dialog.rb +1 -1
- data/lib/alexandria/ui/acquire_dialog.rb +9 -10
- data/lib/alexandria/ui/alert_dialog.rb +34 -19
- data/lib/alexandria/ui/bad_isbns_dialog.rb +13 -9
- data/lib/alexandria/ui/barcode_animation.rb +5 -5
- data/lib/alexandria/ui/book_properties_dialog.rb +2 -2
- data/lib/alexandria/ui/book_properties_dialog_base.rb +23 -17
- data/lib/alexandria/ui/callbacks.rb +141 -120
- data/lib/alexandria/ui/completion_models.rb +1 -1
- data/lib/alexandria/ui/confirm_erase_dialog.rb +1 -1
- data/lib/alexandria/ui/conflict_while_copying_dialog.rb +1 -1
- data/lib/alexandria/ui/error_dialog.rb +1 -1
- data/lib/alexandria/ui/export_dialog.rb +13 -15
- data/lib/alexandria/ui/icons.rb +34 -40
- data/lib/alexandria/ui/iconview_tooltips.rb +40 -53
- data/lib/alexandria/ui/import_dialog.rb +48 -47
- data/lib/alexandria/ui/init.rb +3 -2
- data/lib/alexandria/ui/keep_bad_isbn_dialog.rb +2 -2
- data/lib/alexandria/ui/libraries_combo.rb +10 -9
- data/lib/alexandria/ui/listview.rb +5 -6
- data/lib/alexandria/ui/main_app.rb +2 -2
- data/lib/alexandria/ui/multi_drag_treeview.rb +4 -6
- data/lib/alexandria/ui/new_book_dialog.rb +52 -52
- data/lib/alexandria/ui/new_provider_dialog.rb +12 -11
- data/lib/alexandria/ui/new_smart_library_dialog.rb +39 -27
- data/lib/alexandria/ui/preferences_dialog.rb +23 -82
- data/lib/alexandria/ui/provider_preferences_base_dialog.rb +9 -5
- data/lib/alexandria/ui/provider_preferences_dialog.rb +5 -5
- data/lib/alexandria/ui/really_delete_dialog.rb +1 -1
- data/lib/alexandria/ui/sidepane_manager.rb +35 -37
- data/lib/alexandria/ui/skip_entry_dialog.rb +3 -2
- data/lib/alexandria/ui/smart_library_properties_dialog.rb +35 -36
- data/lib/alexandria/ui/smart_library_properties_dialog_base.rb +59 -138
- data/lib/alexandria/ui/smart_library_rule_box.rb +119 -0
- data/lib/alexandria/ui/sound.rb +4 -6
- data/lib/alexandria/ui/ui_manager.rb +62 -64
- data/lib/alexandria/version.rb +2 -2
- data/lib/alexandria/web_themes.rb +15 -15
- data/po/cs.po +991 -874
- data/po/cy.po +957 -870
- data/po/de.po +991 -866
- data/po/el.po +987 -863
- data/po/es.po +986 -862
- data/po/fr.po +988 -868
- data/po/ga.po +910 -822
- data/po/gl.po +983 -863
- data/po/it.po +984 -862
- data/po/ja.po +969 -849
- data/po/mk.po +983 -859
- data/po/nb.po +982 -862
- data/po/nl.po +992 -869
- data/po/pl.po +1018 -963
- data/po/pt.po +983 -852
- data/po/pt_BR.po +983 -863
- data/po/ru.po +992 -869
- data/po/sk.po +986 -864
- data/po/sv.po +980 -860
- data/po/uk.po +975 -861
- data/po/zh_TW.po +974 -854
- data/share/alexandria/glade/main_app__builder.glade +6 -21
- data/share/gnome/help/alexandria/C/smart-libraries.xml +2 -2
- data/share/gnome/help/alexandria/C/working-with-libraries.xml +1 -1
- data/share/gnome/help/alexandria/fr/alexandria.xml +1 -1
- data/share/gnome/help/alexandria/ja/smart-libraries.xml +1 -1
- data/spec/alexandria/book_providers/world_cat_provider_spec.rb +160 -0
- data/spec/alexandria/book_providers_spec.rb +73 -129
- data/spec/alexandria/console_spec.rb +0 -5
- data/spec/alexandria/export_library_spec.rb +27 -38
- data/spec/alexandria/library_spec.rb +56 -44
- data/spec/alexandria/preferences_spec.rb +29 -3
- data/spec/alexandria/scanners/cue_cat_spec.rb +1 -1
- data/spec/alexandria/ui/about_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/acquire_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/alert_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/bad_isbns_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/book_properties_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/confirm_erase_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/conflict_while_copying_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/error_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/export_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/icons_spec.rb +26 -0
- data/spec/alexandria/ui/iconview_spec.rb +1 -1
- data/spec/alexandria/ui/import_dialog_spec.rb +30 -3
- data/spec/alexandria/ui/keep_bad_isbn_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/main_app_spec.rb +1 -1
- data/spec/alexandria/ui/new_book_dialog_manual_spec.rb +1 -1
- data/spec/alexandria/ui/new_provider_dialog_spec.rb +19 -3
- data/spec/alexandria/ui/new_smart_library_dialog_spec.rb +28 -3
- data/spec/alexandria/ui/preferences_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/provider_preferences_dialog_spec.rb +23 -8
- data/spec/alexandria/ui/really_delete_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/sidepane_manager_spec.rb +2 -2
- data/spec/alexandria/ui/skip_entry_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/smart_library_properties_dialog_spec.rb +21 -7
- data/spec/alexandria/ui/ui_manager_spec.rb +39 -2
- data/spec/spec_helper.rb +46 -3
- data/tasks/spec.rake +3 -5
- data/util/rake/fileinstall.rb +12 -11
- metadata +82 -10
- data/spec/alexandria/ui/ui_utilities_spec.rb +0 -62
- 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(:
|
11
|
-
|
12
|
-
|
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(:
|
16
|
-
|
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
|
-
|
22
|
-
|
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(
|
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.
|
44
|
-
expect(
|
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(
|
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.
|
58
|
-
expect(
|
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(
|
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(
|
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(
|
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(
|
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(
|
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(
|
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
|
-
|
103
|
+
before do
|
108
104
|
libraries = Alexandria::LibraryCollection.instance
|
109
|
-
library =
|
105
|
+
library = described_class.new("Test Library")
|
110
106
|
libraries.add_library(library)
|
111
|
-
|
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 "
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
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
|
-
|
132
|
-
|
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.
|
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.
|
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 "
|
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.
|
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.
|
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
|
-
|
180
|
-
|
181
|
-
|
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.
|
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.
|
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 "
|
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,
|
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
|
-
|
7
|
+
require_relative "../spec_helper"
|
8
8
|
|
9
9
|
describe Alexandria::Preferences do
|
10
10
|
let(:instance) { described_class.instance }
|
11
11
|
|
12
|
-
|
13
|
-
|
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
|