Skip to content

Commit 966b9ed

Browse files
znzaycabta
authored andcommitted
Fix errors when RDoc::RI::Paths::HOMEDIR is nil
https://rubyci.org/logs/rubyci.s3.amazonaws.com/scw-ad7f67/ruby-master/log/20200425T175405Z.fail.html.gz ``` 4) Error: TestRDocServlet#test_asset: NoMethodError: undefined method `replace' for nil:NilClass /home/chkbuild/build/20200425T175405Z/ruby/test/rdoc/test_rdoc_servlet.rb:48:in `setup' 5) Error: TestRDocServlet#test_asset: NoMethodError: undefined method `replace' for nil:NilClass /home/chkbuild/build/20200425T175405Z/ruby/test/rdoc/test_rdoc_servlet.rb:63:in `teardown' ``` ... ``` 74) Error: TestRDocServlet#test_store_for_site: NoMethodError: undefined method `replace' for nil:NilClass /home/chkbuild/build/20200425T175405Z/ruby/test/rdoc/test_rdoc_servlet.rb:48:in `setup' 75) Error: TestRDocServlet#test_store_for_site: NoMethodError: undefined method `replace' for nil:NilClass /home/chkbuild/build/20200425T175405Z/ruby/test/rdoc/test_rdoc_servlet.rb:63:in `teardown' ```
1 parent b91fa98 commit 966b9ed

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

test/rdoc/test_rdoc_servlet.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ def @req.path= path
4545
@orig_base = RDoc::RI::Paths::BASE
4646
RDoc::RI::Paths::BASE.replace @base
4747
@orig_ri_path_homedir = RDoc::RI::Paths::HOMEDIR
48-
RDoc::RI::Paths::HOMEDIR.replace @home_dir
48+
RDoc::RI::Paths.send :remove_const, :HOMEDIR
49+
RDoc::RI::Paths.const_set :HOMEDIR, @home_dir
4950

5051
RDoc::RI::Paths.instance_variable_set \
5152
:@gemdirs, %w[/nonexistent/gems/example-1.0/ri]
@@ -60,7 +61,8 @@ def teardown
6061
FileUtils.rm_rf @tempdir
6162

6263
RDoc::RI::Paths::BASE.replace @orig_base
63-
RDoc::RI::Paths::HOMEDIR.replace @orig_ri_path_homedir
64+
RDoc::RI::Paths.send :remove_const, :HOMEDIR
65+
RDoc::RI::Paths.const_set :HOMEDIR, @orig_ri_path_homedir
6466
RDoc::RI::Paths.instance_variable_set :@gemdirs, nil
6567
end
6668

0 commit comments

Comments
 (0)