≡

wincent.dev

  • Products
  • Blog
  • Wiki
  • Issues
You are viewing an historical archive of past issues. Please report new issues to the appropriate project issue tracker on GitHub.
Home » Issues » Feature request #1624

Feature request #1624: Add chmkdtemp method

Kind feature request
Product mkdtemp
When 2010-07-28T15:11:06Z
Status closed
Reporter Greg Hurrell
Tags no tags

Description

As a convenience, add a method like this:

def chmkdtemp *args, &block
  dir = Dir.mkdtemp *args
  Dir.chdir dir do
    yield
  end
  dir
end

So that we can do this kind of thing:

describe 'foo' do
  it 'bar' do
    Dir.chmkdtemp do
      # test code inside temp dir here
    end
  end
end

Instead of manually doing the chdir ourselves.

The other alternative is to just teach the mkdtemp method to take an optional block and do this itself.

Comments

  1. Greg Hurrell 2010-07-28T16:08:29Z

    Done. In the end decided to make mkdtemp take an optional block.

  2. Greg Hurrell 2010-07-28T16:10:08Z

    Status changed:

    • From: new
    • To: closed
Add a comment

Comments are now closed for this issue.

  • contact
  • legal

Menu

  • Blog
  • Wiki
  • Issues
  • Snippets