Skip to content

Use File.expand_path outside temp_dir #557

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 21, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions test/test_rdoc_rdoc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,18 @@ def load_options_no_file
end

def test_normalized_file_list
test_path = File.expand_path(__FILE__)
files = temp_dir do |dir|
flag_file = @rdoc.output_flag_file dir

FileUtils.touch flag_file

@rdoc.normalized_file_list [__FILE__, flag_file]
@rdoc.normalized_file_list [test_path, flag_file]
end

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

assert_equal [File.expand_path(__FILE__)], files
assert_equal [test_path], files
end

def test_normalized_file_list_not_modified
Expand Down Expand Up @@ -189,9 +190,10 @@ def test_parse_file_binary
def test_parse_file_include_root
@rdoc.store = RDoc::Store.new

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

open 'include.txt', 'w' do |io|
io.puts ':include: test.txt'
Expand Down