diff --git a/lib/rdoc/rdoc.rb b/lib/rdoc/rdoc.rb index c47f639cc4..df04646f3c 100644 --- a/lib/rdoc/rdoc.rb +++ b/lib/rdoc/rdoc.rb @@ -166,6 +166,8 @@ def load_options rescue Psych::SyntaxError end + return RDoc::Options.new if options == false # Allow empty file. + raise RDoc::Error, "#{options_file} is not a valid rdoc options file" unless RDoc::Options === options or Hash === options diff --git a/test/rdoc/test_rdoc_rdoc.rb b/test/rdoc/test_rdoc_rdoc.rb index b54cec5538..3910dd4656 100644 --- a/test/rdoc/test_rdoc_rdoc.rb +++ b/test/rdoc/test_rdoc_rdoc.rb @@ -133,6 +133,17 @@ def test_load_options_invalid end end + def test_load_options_empty_file + temp_dir do + File.open '.rdoc_options', 'w' do |io| + end + + options = @rdoc.load_options + + assert_equal 'rdoc', options.markup + end + end + def test_load_options_partial_override temp_dir do File.open '.rdoc_options', 'w' do |io|