spec/alexandria/library_spec.rb in alexandria-book-collection-manager-0.7.8 vs spec/alexandria/library_spec.rb in alexandria-book-collection-manager-0.7.9

- old
+ new

@@ -148,11 +148,11 @@ expect(malory_book.version).to eq(Alexandria::DATA_VERSION) # Guide to LaTeX latex_book = my_library.find { |b| b.title.include? "Latex" } expect(latex_book.isbn).to eq("9780201398250") - expect(latex_book.publisher).to eq("Addison Wesley") # note, no Ruby-Amazon cruft + expect(latex_book.publisher).to eq("Addison Wesley") end end context "when importing from 0.6.1 with books without an ISBN" do let(:libs) { loader.load_all_libraries } @@ -174,11 +174,11 @@ it "loads a book with ISBN" do # Guide to LaTeX latex_book = my_library.find { |b| b.title.include? "Latex" } expect(latex_book.isbn).to eq("9780201398250") - expect(latex_book.publisher).to eq("Addison Wesley") # note, no Ruby-Amazon cruft + expect(latex_book.publisher).to eq("Addison Wesley") expect(latex_book.version).to eq(Alexandria::DATA_VERSION) end it "loads a book without ISBN" do # Lex and Yacc @@ -227,8 +227,26 @@ expect(File.exist?(source.yaml(book))).to be_falsey expect(File.exist?(source.cover(book))).to be_falsey expect(File.exist?(target.yaml(book))).to be_truthy expect(File.exist?(target.cover(book))).to be_truthy end + end + end + + describe "#name=" do + let(:my_library) { loader.load_library("Empty") } + + before do + FileUtils.mkdir(TESTDIR) unless File.exist? TESTDIR + end + + it "changes the library's name" do + my_library.name = "Really Empty" + expect(my_library.name).to eq "Really Empty" + end + + it "moves the library's directory" do + my_library.name = "Really Empty" + expect(File.exist?(File.join(TESTDIR, "Really Empty"))).to be_truthy end end end