Skip to content

Commit fd610f7

Browse files
committed
Ignore locale at write_options
`@locale` is set from `@locale_name` and loaded from `@locale_dir` after `write_options`, and `RDoc::I18n::Locale` does not seem to expected to be loaded.
1 parent 4c9a690 commit fd610f7

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

lib/rdoc/options.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ class RDoc::Options
105105
generator_name
106106
generator_options
107107
generators
108+
locale
108109
op_dir
109110
page_dir
110111
option_parser

test/rdoc/test_rdoc_options.rb

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ def test_to_yaml
6868
'exclude' => %w[~\z \.orig\z \.rej\z \.bak\z \.gemspec\z],
6969
'hyperlink_all' => false,
7070
'line_numbers' => false,
71-
'locale' => nil,
7271
'locale_dir' => 'locale',
7372
'locale_name' => nil,
7473
'main_page' => nil,
@@ -902,6 +901,28 @@ def test_no_skip_test_value
902901
assert_equal false, @options.skip_tests
903902
end
904903

904+
def test_locale_name_default
905+
temp_dir do
906+
@options.parse %w[]
907+
assert_equal 'locale', @options.instance_variable_get(:@locale_dir)
908+
assert_nil @options.instance_variable_get(:@locale_name)
909+
assert_nil @options.locale
910+
@options.finish
911+
assert_nil @options.locale
912+
end
913+
end
914+
915+
def test_locale_name
916+
temp_dir do
917+
@options.parse %w[--locale fr]
918+
assert_equal 'locale', @options.instance_variable_get(:@locale_dir)
919+
assert_equal 'fr', @options.instance_variable_get(:@locale_name)
920+
assert_nil @options.locale
921+
@options.finish
922+
assert_equal 'fr', @options.locale.name
923+
end
924+
end
925+
905926
class DummyCoder < Hash
906927
alias add :[]=
907928
def tag=(tag)

0 commit comments

Comments
 (0)