spec/alexandria/library_spec.rb in alexandria-book-collection-manager-0.6.9 vs spec/alexandria/library_spec.rb in alexandria-book-collection-manager-0.7.0
- old
+ new
@@ -1,9 +1,9 @@
#-- -*- ruby -*-
# Copyright (C) 2004-2006 Dafydd Harries
# Copyright (C) 2007 Cathal Mc Ginley
-# Copyright (C) 2011, 2014, 2015 Matijs van Zuijlen
+# Copyright (C) 2011, 2014-2016 Matijs van Zuijlen
#
# Alexandria is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
@@ -47,15 +47,15 @@
end
end
describe '#canonicalise_isbn' do
it 'returns the correct value for several examples' do
- expect(Alexandria::Library.canonicalise_isbn('014143984X')).to eq '014143984X'
- expect(Alexandria::Library.canonicalise_isbn('0-345-43192-8')).to eq '0345431928'
- expect(Alexandria::Library.canonicalise_isbn('3522105907')).to eq '3522105907'
- # EAN number
- expect(Alexandria::Library.canonicalise_isbn('9780345431929')).to eq '0345431928'
+ expect(Alexandria::Library.canonicalise_isbn('014143984X')).to eq '014143984X'
+ expect(Alexandria::Library.canonicalise_isbn('0-345-43192-8')).to eq '0345431928'
+ expect(Alexandria::Library.canonicalise_isbn('3522105907')).to eq '3522105907'
+ # EAN number
+ expect(Alexandria::Library.canonicalise_isbn('9780345431929')).to eq '0345431928'
end
end
context 'with an empty library' do
before(:each) do
@@ -65,11 +65,11 @@
it 'disallows multiple deletion of the same copy of a book' do
my_library = Alexandria::Library.loadall[0]
first_copy = an_artist_of_the_floating_world
my_library << first_copy
my_library.delete(first_copy)
- expect { my_library.delete(first_copy) }.to raise_error
+ expect { my_library.delete(first_copy) }.to raise_error ArgumentError
end
it 'allows multiple copies of a book to be added and deleted in turn' do
my_library = Alexandria::Library.loadall[0]
first_copy = an_artist_of_the_floating_world
@@ -83,11 +83,10 @@
my_library << third_copy
# puts "AAA my_library.size #{my_library.size}"
# puts "second_copy #{second_copy.object_id}"
- # lambda { my_library.delete(second_copy) }.should raise_error
expect { my_library.delete(second_copy) }.not_to raise_error
# puts "BBB my_library.size #{my_library.size}"
# my_library.size.should == 1 # not yet an established feature...
end
@@ -110,15 +109,15 @@
end
it "doesn't work quite yet" do
skip
# Doesn't work quite yet.
- on_iterate_cb = proc { }
- on_error_cb = proc { }
- library, libraries = __test_fake_import_isbns
- test_file = "data/isbns.txt"
- library.import_as_isbn_list("Test Library", test_file, on_iterate_cb, on_error_cb)
+ on_iterate_cb = proc {}
+ on_error_cb = proc {}
+ library, _libraries = __test_fake_import_isbns
+ test_file = 'data/isbns.txt'
+ library.import_as_isbn_list('Test Library', test_file, on_iterate_cb, on_error_cb)
end
end
context 'imported from 0.6.1 data files' do
before(:each) do
@@ -243,11 +242,9 @@
end
end
after(:each) do
FileUtils.rm_rf(TESTDIR)
- if File.exist? @outfile
- File.unlink @outfile
- end
+ File.unlink @outfile if File.exist? @outfile
end
end
end