muse-dl/spec/book_spec.cr

44 lines
2.7 KiB
Crystal
Raw Normal View History

2020-03-28 20:02:55 +00:00
require "./spec_helper"
describe Muse::Dl::Book do
html = File.new("spec/fixtures/book-875.html").gets_to_end
book = Muse::Dl::Book.new html
2020-03-28 20:14:43 +00:00
it "it should parse the infobox for 875" do
2020-03-28 20:02:55 +00:00
book.info["ISBN"].should eq "9780813928517"
book.info["Related ISBN"].should eq "9780813928456"
book.info["OCLC"].should eq "755633557"
book.info["Pages"].should eq "432"
book.info["Launched on MUSE"].should eq "2012-01-01"
book.info["Language"].should eq "English"
book.info["Open Access"].should eq "No"
book.title.should eq "Accommodating Revolutions: Virginia's Northern Neck in an Era of Transformations, 1760-1810"
book.author.should eq "Albert H. Tillson, Jr."
book.date.should eq "2010"
book.publisher.should eq "University of Virginia Press"
end
it "should parse the summary" do
book.summary.should eq "Accommodating Revolutions addresses a controversy of long standing among historians of eighteenth-century America and Virginia—the extent to which internal conflict and/or consensus characterized the society of the Revolutionary era. In particular, it emphasizes the complex and often self-defeating actions and decisions of dissidents and other non-elite groups. By focusing on a small but significant region, Tillson elucidates the multiple and interrelated sources of conflict that beset Revolutionary Virginia, but also explains why in the end so little changed."
book.summary_html.should eq "<u>Accommodating Revolutions </u>addresses a controversy of long standing among historians of eighteenth-century America and Virginia—the extent to which internal conflict and/or consensus characterized the society of the Revolutionary era. In particular, it emphasizes the complex and often self-defeating actions and decisions of dissidents and other non-elite groups. By focusing on a small but significant region, Tillson elucidates the multiple and interrelated sources of conflict that beset Revolutionary Virginia, but also explains why in the end so little changed."
end
it "should parse the cover" do
book.cover_url.should eq "https://muse.jhu.edu/book/875/image/front_cover.jpg"
book.thumbnail_url.should eq "https://muse.jhu.edu/book/875/image/front_cover.jpg?format=180"
2020-03-28 20:14:43 +00:00
end
it "it should parse the DOI for 68534" do
html = File.new("spec/fixtures/book-68534.html").gets_to_end
book = Muse::Dl::Book.new html
book.info["ISBN"].should eq "9781501737695"
book.info["Related ISBN"].should eq "9781501742583"
book.info["OCLC"].should eq "1122613406"
book.info["Launched on MUSE"].should eq "2019-10-10"
book.info["Language"].should eq "English"
book.info["Open Access"].should eq "Yes"
2020-03-28 20:02:55 +00:00
book.info["DOI"].should eq "10.1353/book.68534"
end
end