aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/core/file
diff options
context:
space:
mode:
authoreregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-30 00:05:56 +0000
committereregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-30 00:05:56 +0000
commit7f54f1b5543b4a3267a64c47cff9127cbcafcc42 (patch)
treeb4321a0e6aca9aed1a05cfc97b9ca209a5e5a0fd /spec/ruby/core/file
parent2eee74ef54a2e23eb870680a83dcf74c5d9d9d01 (diff)
downloadruby-7f54f1b5543b4a3267a64c47cff9127cbcafcc42.tar.gz
Update to ruby/spec@2d89e48
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/core/file')
-rw-r--r--spec/ruby/core/file/expand_path_spec.rb58
1 files changed, 27 insertions, 31 deletions
diff --git a/spec/ruby/core/file/expand_path_spec.rb b/spec/ruby/core/file/expand_path_spec.rb
index cbc3d34bdb..9ecd730a7b 100644
--- a/spec/ruby/core/file/expand_path_spec.rb
+++ b/spec/ruby/core/file/expand_path_spec.rb
@@ -56,40 +56,10 @@ describe "File.expand_path" do
File.expand_path(".", "#{@rootdir}").should == "#{@rootdir}"
end
- # FIXME: do not use conditionals like this around #it blocks
- unless not home = ENV['HOME']
- platform_is_not :windows do
- it "converts a pathname to an absolute pathname, using ~ (home) as base" do
- File.expand_path('~').should == home
- File.expand_path('~', '/tmp/gumby/ddd').should == home
- File.expand_path('~/a', '/tmp/gumby/ddd').should == File.join(home, 'a')
- end
-
- it "does not return a frozen string" do
- File.expand_path('~').frozen?.should == false
- File.expand_path('~', '/tmp/gumby/ddd').frozen?.should == false
- File.expand_path('~/a', '/tmp/gumby/ddd').frozen?.should == false
- end
- end
- platform_is :windows do
- it "converts a pathname to an absolute pathname, using ~ (home) as base" do
- File.expand_path('~').should == home.tr("\\", '/')
- File.expand_path('~', '/tmp/gumby/ddd').should == home.tr("\\", '/')
- File.expand_path('~/a', '/tmp/gumby/ddd').should == File.join(home.tr("\\", '/'), 'a')
- end
-
- it "does not return a frozen string" do
- File.expand_path('~').frozen?.should == false
- File.expand_path('~', '/tmp/gumby/ddd').frozen?.should == false
- File.expand_path('~/a', '/tmp/gumby/ddd').frozen?.should == false
- end
- end
- end
-
platform_is_not :windows do
before do
@var_home = ENV['HOME'].chomp('/')
- @db_home = Dir.home
+ @db_home = Dir.home(ENV['USER'])
end
# FIXME: these are insane!
@@ -217,6 +187,32 @@ describe "File.expand_path" do
end
platform_is_not :windows do
+ describe "File.expand_path when HOME is set" do
+ before :each do
+ @home = ENV["HOME"]
+ ENV["HOME"] = "/rubyspec_home"
+ end
+
+ after :each do
+ ENV["HOME"] = @home
+ end
+
+ it "converts a pathname to an absolute pathname, using ~ (home) as base" do
+ home = "/rubyspec_home"
+ File.expand_path('~').should == home
+ File.expand_path('~', '/tmp/gumby/ddd').should == home
+ File.expand_path('~/a', '/tmp/gumby/ddd').should == File.join(home, 'a')
+ end
+
+ it "does not return a frozen string" do
+ home = "/rubyspec_home"
+ File.expand_path('~').frozen?.should == false
+ File.expand_path('~', '/tmp/gumby/ddd').frozen?.should == false
+ File.expand_path('~/a', '/tmp/gumby/ddd').frozen?.should == false
+ end
+ end
+
+
describe "File.expand_path when HOME is not set" do
before :each do
@home = ENV["HOME"]