This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
sandbox /
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Fri Feb 13 21:59:48 -0800 2009 | |
| |
LICENSE | Fri Feb 13 08:16:27 -0800 2009 | |
| |
README.rdoc | Fri Feb 13 21:59:48 -0800 2009 | |
| |
Rakefile | Fri Feb 13 11:09:29 -0800 2009 | |
| |
VERSION.yml | Mon Feb 23 15:51:44 -0800 2009 | |
| |
features/ | Fri Feb 13 08:16:27 -0800 2009 | |
| |
lib/ | Mon Apr 20 08:25:57 -0700 2009 | |
| |
sandbox.gemspec | Mon Feb 23 15:51:55 -0800 2009 | |
| |
spec/ | Wed Mar 04 18:45:28 -0800 2009 |
README.rdoc
sandbox
Sandbox is a very small library that creates a folder in tmp for you to be able to perform tests. Your temporary path will be available while the play block is executing. When you’re done, it will clean it up for you.
Sandbox.play do |path|
FileUtils.touch(File.join(path, 'foo'))
end
# path has been deleted
It will clean up even if you have an exception:
Sandbox.play do |path|
# do stuff in path
raise "boom"
end
# path has been deleted
You can also use the Sandbox object directly if necessary:
sbox = Sandbox.new
# do stuff
sbox.close # deletes sandbox
This could be useful for RSpec:
before(:each) do
@sbox = Sandbox.new
end
after(:each) do
@sbox.close
end
# specs using @sbox (with a new sandbox for each spec)
Copyright
Copyright © 2009 Brandon Dimcheff. See LICENSE for details.







