2020-04-01 21:39:32 +00:00
|
|
|
require "./spec_helper"
|
2020-06-30 08:38:28 +00:00
|
|
|
require "webmock"
|
2020-04-01 21:39:32 +00:00
|
|
|
# require "errors/muse_corrupt_pdf.cr"
|
|
|
|
|
|
|
|
describe Muse::Dl::Book do
|
2020-04-07 20:18:48 +00:00
|
|
|
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)
|
|
|
|
|
2020-04-01 21:39:32 +00:00
|
|
|
it "should notice the unable to construct chapter PDF error" do
|
|
|
|
f = "/tmp/chapter-2379787.pdf"
|
|
|
|
File.delete(f) if File.exists? f
|
|
|
|
expect_raises Muse::Dl::Errors::MuseCorruptPDF do
|
|
|
|
Muse::Dl::Fetch.save_chapter("/tmp", "2379787", "NA")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|