Fix OpenJDK scraper
Unified · Split
| @@ -29,7 +29,7 @@ module Docs · 28 unmodified lines | |||
| 29 | 29 | ||
| 30 | def request_one(url) | 30 | def request_one(url) |
| 31 | assert_source_directory_exists | 31 | assert_source_directory_exists |
| 32 | Response.new read_file(url_to_path(url)), URL.parse(url) | 32 | Response.new read_file(File.join(source_directory, url_to_path(url))), URL.parse(url) |
| 33 | end | 33 | end |
| 34 | 34 | ||
| 35 | def request_all(urls) | 35 | def request_all(urls) |
| @@ -50,7 +50,7 @@ module Docs · 14 unmodified lines | |||
| 50 | end | 50 | end |
| 51 | 51 | ||
| 52 | def read_file(path) | 52 | def read_file(path) |
| 53 | File.read(File.join(source_directory, path)) | 53 | File.read(path) |
| 54 | rescue | 54 | rescue |
| 55 | instrument 'warn.doc', msg: "Failed to open file: #{path}" | 55 | instrument 'warn.doc', msg: "Failed to open file: #{path}" |
| 56 | nil | 56 | nil |
| @@ -63,7 +63,7 @@ class FileScraperTest < MiniTest::Spec · 62 unmodified lines | |||
| 63 | end | 63 | end |
| 64 | 64 | ||
| 65 | it "reads a file" do | 65 | it "reads a file" do |
| 66 | mock(scraper).read_file(path) | 66 | mock(scraper).read_file(File.join(ROOT_PATH, 'docs/scraper', path)) |
| 67 | result | 67 | result |
| 68 | end | 68 | end |
| 69 | 69 | ||
| @@ -165,7 +165,7 @@ class FileScraperTest < MiniTest::Spec · 95 unmodified lines | |||
| 165 | 165 | ||
| 166 | describe "#read_file" do | 166 | describe "#read_file" do |
| 167 | let :result do | 167 | let :result do |
| 168 | scraper.send :read_file, 'file' | 168 | scraper.send :read_file, File.join(ROOT_PATH, 'docs', 'scraper', 'file') |
| 169 | end | 169 | end |
| 170 | 170 | ||
| 171 | it "returns the file's content when the file exists in the source directory" do | 171 | it "returns the file's content when the file exists in the source directory" do |