replaces Pathname#(dirname|realpath) with File.$1

Simpler, thanks to @rubys for the hint.
This commit is contained in:
Xavier Noria 2013-04-12 02:31:23 +02:00
parent 3c5517237f
commit 481618cfc2

@ -1,11 +1,10 @@
require 'tmpdir'
require 'pathname'
require 'abstract_unit'
require 'rails/app_rails_loader'
class AppRailsLoaderTest < ActiveSupport::TestCase
def write(filename, contents=nil)
FileUtils.mkdir_p(Pathname.new(filename).dirname)
FileUtils.mkdir_p(File.dirname(filename))
File.write(filename, contents)
end
@ -13,10 +12,6 @@ def expects_exec(exe)
Rails::AppRailsLoader.expects(:exec).with(Rails::AppRailsLoader::RUBY, exe)
end
def realpath(filename)
Pathname.new(filename).realpath
end
setup do
@tmp = Dir.mktmpdir('railties-rails-loader-test-suite')
@cwd = Dir.pwd
@ -61,7 +56,7 @@ def realpath(filename)
# This happens in particular in Mac OS X, where @tmp starts
# with "/var", and Dir.pwd with "/private/var", due to a
# default system symlink var -> private/var.
assert_equal realpath("#@tmp/foo"), realpath(Dir.pwd)
assert_equal File.realpath("#@tmp/foo"), File.realpath(Dir.pwd)
end
end
end