Skip to content

Commit

Permalink
Allow empty .rdoc_options
Browse files Browse the repository at this point in the history
  • Loading branch information
aycabta committed Mar 15, 2021
1 parent e06094c commit 8ed8e4a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/rdoc/rdoc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 11 additions & 0 deletions test/rdoc/test_rdoc_rdoc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down

0 comments on commit 8ed8e4a

Please sign in to comment.