diff --git a/shard.lock b/shard.lock index 9984f5f..7a23ffd 100644 --- a/shard.lock +++ b/shard.lock @@ -12,3 +12,7 @@ shards: github: kostya/myhtml version: 1.5.1 + webmock: + github: manastech/webmock.cr + commit: 78bb0e3b5850c700da0e7fbdd2d6c180cc4a061b + diff --git a/shard.yml b/shard.yml index 37050c5..4e42cbc 100644 --- a/shard.yml +++ b/shard.yml @@ -15,4 +15,9 @@ dependencies: myhtml: github: kostya/myhtml crest: - github: mamantoha/crest \ No newline at end of file + github: mamantoha/crest + +development_dependencies: + webmock: + github: manastech/webmock.cr + branch: master \ No newline at end of file diff --git a/spec/fetch_spec.cr b/spec/fetch_spec.cr index 6e97dfd..c01ed8f 100644 --- a/spec/fetch_spec.cr +++ b/spec/fetch_spec.cr @@ -2,6 +2,10 @@ require "./spec_helper" # require "errors/muse_corrupt_pdf.cr" describe Muse::Dl::Book do + headers = {"Content-Type" => "text/html"} + WebMock.stub(:get, "https://muse.jhu.edu/chapter/2379787/pdf") + .to_return(body_io: File.new("spec/fixtures/chapter-2379787.html"), headers: headers) + it "should notice the unable to construct chapter PDF error" do f = "/tmp/chapter-2379787.pdf" File.delete(f) if File.exists? f diff --git a/spec/fixtures/chapter-2379787.html b/spec/fixtures/chapter-2379787.html new file mode 100644 index 0000000..2e5e3c2 --- /dev/null +++ b/spec/fixtures/chapter-2379787.html @@ -0,0 +1,359 @@ + + + + + +
+ + + + + + + + + + +Focusing on important research about the role of academic libraries and librarianship, portal also features commentary on issues in technology and publishing. Written for all those interested in the role of libraries within the academy, portal includes peer-reviewed articles addressing subjects such as library administration, information technology, and information policy. In its inaugural year, portal earned recognition as the runner-up for best new journal, awarded by the Council of Editors of Learned Journals (CELJ). An article in portal, "Master's and Doctoral Thesis Citations: Analysis and Trends of a Longitudinal Study," won the Jesse H. Shera Award for Distinguished Published Research from the Library Research Round Table of the American Library Association.
+Copyright © The Johns Hopkins University Press.
+