summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorschneems <richard.schneeman+foo@gmail.com>2020-10-27 13:54:23 -0500
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2024-10-04 11:15:33 +0900
commit08346e7267b4f17ae207d67543d5f78c2541dc86 (patch)
tree423ac74bcb74580e1aa3404d25d51a4427f11ec9 /test
parente90862f0edc08400183c81e08b7a20d5449f6f9b (diff)
Introduce Pathname.mktmpdir
When I want to create a tmpdir I often want to manipulate it as a pathname. By introducing Pathname.mktmpdir I can get this behavior. Currently I must: ```ruby Dir.mktmpdir do |dir| dir = Pathname(dir) # ... code end ``` I would like to be able to instead: ```ruby Pathname.mktmpdir do |dir| # ... code end ```
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3709
Diffstat (limited to 'test')
-rw-r--r--test/pathname/test_pathname.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/pathname/test_pathname.rb b/test/pathname/test_pathname.rb
index a23dc21ae3..edd96e2724 100644
--- a/test/pathname/test_pathname.rb
+++ b/test/pathname/test_pathname.rb
@@ -1333,6 +1333,14 @@ class TestPathname < Test::Unit::TestCase
}
end
+ def test_mktmpdir
+ Pathname.mktmpdir do |dir|
+ assert_equal Pathname(dir), dir
+ assert dir.directory?
+ assert dir.exist?
+ end
+ end
+
def test_s_getwd
wd = Pathname.getwd
assert_kind_of(Pathname, wd)