|
|
@ -89,13 +89,18 @@ class DocsUrlScraperTest < MiniTest::Spec
|
|
|
|
|
|
|
|
|
|
|
|
describe "#process_response?" do
|
|
|
|
describe "#process_response?" do
|
|
|
|
let :response do
|
|
|
|
let :response do
|
|
|
|
OpenStruct.new success?: true, html?: true, effective_url: scraper.root_url
|
|
|
|
OpenStruct.new success?: true, html?: true, effective_url: scraper.root_url, error?: false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
let :result do
|
|
|
|
let :result do
|
|
|
|
scraper.send :process_response?, response
|
|
|
|
scraper.send :process_response?, response
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "raises when the response is an error" do
|
|
|
|
|
|
|
|
response.send 'error?=', true
|
|
|
|
|
|
|
|
assert_raises(RuntimeError) { result }
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
it "returns false when the response isn't successful" do
|
|
|
|
it "returns false when the response isn't successful" do
|
|
|
|
response.send 'success?=', false
|
|
|
|
response.send 'success?=', false
|
|
|
|
refute result
|
|
|
|
refute result
|
|
|
|