Skip to content

Commit

Permalink
Added RakeFileUtils methods to list of private methods (to avoid leak…
Browse files Browse the repository at this point in the history
…ing into

Object as public methods).


git-svn-id: svn+ssh://rubyforge.org/var/svn/rake/trunk@579 5af023f1-ac1a-0410-98d6-829a145c37ef
  • Loading branch information
jimweirich committed Feb 14, 2007
1 parent 3210a02 commit 858eae6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
VanderWerf)
* Added a protected 'require "rubygems"' to test/test_application to
unbreak cruisecontrol.rb.
* Added the handful of RakeFileUtils to the private method as well.

== Version 0.7.1

Expand Down
4 changes: 2 additions & 2 deletions lib/rake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -942,8 +942,8 @@ def rake_check_options(options, *optdecl)
# define methods on other objects.

include RakeFileUtils
#private(*FileUtils.instance_methods(false))
private(*FileUtils::OPT_TABLE.keys)
private(*FileUtils.instance_methods(false))
private(*RakeFileUtils.instance_methods(false))

######################################################################
module Rake
Expand Down
2 changes: 1 addition & 1 deletion test/functional.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

begin
require 'rubygems'
require_gem 'session'
gem 'session'
rescue LoadError
puts "UNABLE TO RUN FUNCTIONAL TESTS"
puts "No Session Found"
Expand Down
11 changes: 9 additions & 2 deletions test/test_fileutils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,16 @@ def test_nowrite
assert_equal false, nowrite
end

def test_file_utils_methods_are_available_at_top_level
create_file("testdata/a")
rm_rf "testdata/a"
assert ! File.exist?("testdata/a")
end

def test_fileutils_methods_dont_leak
obj = Object.new
assert_raise(NoMethodError){ obj.copy }
assert_raise(NoMethodError) { obj.copy } # from FileUtils
assert_raise(NoMethodError) { obj.ruby } # from RubyFileUtils
end

def test_sh
Expand Down Expand Up @@ -209,7 +216,7 @@ def test_split_all
assert_equal ['/', 'a', 'b'], RakeFileUtils.split_all('/a/b')
assert_equal ['..', 'a', 'b'], RakeFileUtils.split_all('../a/b')
end

private

def redirect_stderr
Expand Down

0 comments on commit 858eae6

Please sign in to comment.