Skip to content

Commit fbae5be

Browse files
authored
Merge pull request #557 from aycabta/use-expand_path-outside-temp_dir
Use File.expand_path outside temp_dir
2 parents 046126b + 1db17e4 commit fbae5be

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

test/test_rdoc_rdoc.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,17 +109,18 @@ def load_options_no_file
109109
end
110110

111111
def test_normalized_file_list
112+
test_path = File.expand_path(__FILE__)
112113
files = temp_dir do |dir|
113114
flag_file = @rdoc.output_flag_file dir
114115

115116
FileUtils.touch flag_file
116117

117-
@rdoc.normalized_file_list [__FILE__, flag_file]
118+
@rdoc.normalized_file_list [test_path, flag_file]
118119
end
119120

120121
files = files.map { |file| File.expand_path file }
121122

122-
assert_equal [File.expand_path(__FILE__)], files
123+
assert_equal [test_path], files
123124
end
124125

125126
def test_normalized_file_list_not_modified
@@ -189,9 +190,10 @@ def test_parse_file_binary
189190
def test_parse_file_include_root
190191
@rdoc.store = RDoc::Store.new
191192

193+
test_path = File.expand_path('..', __FILE__)
192194
top_level = nil
193195
temp_dir do |dir|
194-
@rdoc.options.parse %W[--root #{File.dirname(__FILE__)}]
196+
@rdoc.options.parse %W[--root #{test_path}]
195197

196198
open 'include.txt', 'w' do |io|
197199
io.puts ':include: test.txt'

0 commit comments

Comments
 (0)