Skip to content

Commit 8737538

Browse files
committed
Add unit test for "standard" system dir
1 parent 4943ea7 commit 8737538

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

test/test_rake_application.rb

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,44 @@ def @app.standard_system_dir
365365
flunk "failed to find system rakefile"
366366
end
367367

368+
def test_load_from_calculated_system_rakefile_on_windows
369+
rakefile_default
370+
def @app.windows?
371+
true
372+
end
373+
374+
@app.instance_eval do
375+
handle_options []
376+
options.silent = true
377+
options.load_system = true
378+
options.rakelib = []
379+
load_rakefile
380+
end
381+
382+
assert_equal File.join(Dir.home, "Rake"), @app.system_dir
383+
rescue SystemExit
384+
flunk "failed to find system rakefile"
385+
end
386+
387+
def test_load_from_calculated_system_rakefile_on_unix
388+
rakefile_default
389+
def @app.windows?
390+
false
391+
end
392+
393+
@app.instance_eval do
394+
handle_options []
395+
options.silent = true
396+
options.load_system = true
397+
options.rakelib = []
398+
load_rakefile
399+
end
400+
401+
assert_equal File.join(Dir.home, ".rake"), @app.system_dir
402+
rescue SystemExit
403+
flunk "failed to find system rakefile"
404+
end
405+
368406
def test_terminal_columns
369407
old_rake_columns = ENV["RAKE_COLUMNS"]
370408

0 commit comments

Comments
 (0)