From 8325ed78ef6fffd79bfa3ad1c5d9fc0053184958 Mon Sep 17 00:00:00 2001 From: Jasper van Merle Date: Wed, 17 Jul 2019 21:51:39 +0200 Subject: [PATCH 1/2] Fix OpenJDK scraper --- lib/docs/core/scrapers/file_scraper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/docs/core/scrapers/file_scraper.rb b/lib/docs/core/scrapers/file_scraper.rb index 9d354631..72a99b99 100644 --- a/lib/docs/core/scrapers/file_scraper.rb +++ b/lib/docs/core/scrapers/file_scraper.rb @@ -29,7 +29,7 @@ module Docs def request_one(url) assert_source_directory_exists - Response.new read_file(url_to_path(url)), URL.parse(url) + Response.new read_file(File.join(source_directory, url_to_path(url))), URL.parse(url) end def request_all(urls) @@ -50,7 +50,7 @@ module Docs end def read_file(path) - File.read(File.join(source_directory, path)) + File.read(path) rescue instrument 'warn.doc', msg: "Failed to open file: #{path}" nil From b31dc9d0c2338f831d87608a5c078f6e582b9ac6 Mon Sep 17 00:00:00 2001 From: Jasper van Merle Date: Wed, 17 Jul 2019 22:44:48 +0200 Subject: [PATCH 2/2] Fix tests --- test/lib/docs/core/scrapers/file_scraper_test.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/lib/docs/core/scrapers/file_scraper_test.rb b/test/lib/docs/core/scrapers/file_scraper_test.rb index 7d90d262..88b5e8d5 100644 --- a/test/lib/docs/core/scrapers/file_scraper_test.rb +++ b/test/lib/docs/core/scrapers/file_scraper_test.rb @@ -63,7 +63,7 @@ class FileScraperTest < MiniTest::Spec end it "reads a file" do - mock(scraper).read_file(path) + mock(scraper).read_file(File.join(ROOT_PATH, 'docs/scraper', path)) result end @@ -165,7 +165,7 @@ class FileScraperTest < MiniTest::Spec describe "#read_file" do let :result do - scraper.send :read_file, 'file' + scraper.send :read_file, File.join(ROOT_PATH, 'docs', 'scraper', 'file') end it "returns the file's content when the file exists in the source directory" do