file_sandbox 0.3 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.txt +4 -0
- data/README.txt +2 -2
- data/Rakefile +2 -5
- data/lib/file_sandbox.rb +5 -4
- data/test/file_sandbox_test.rb +8 -0
- metadata +3 -3
data/CHANGES.txt
CHANGED
data/README.txt
CHANGED
data/Rakefile
CHANGED
@@ -6,11 +6,7 @@ require 'hoe'
|
|
6
6
|
require './lib/file_sandbox.rb'
|
7
7
|
|
8
8
|
desc "Default Task"
|
9
|
-
task :default => [:
|
10
|
-
|
11
|
-
task :generate_readme do
|
12
|
-
`erb README.in > README.txt`
|
13
|
-
end
|
9
|
+
task :default => [:clean, :test]
|
14
10
|
|
15
11
|
desc "Run all tests"
|
16
12
|
task :test => [:unit, :spec]
|
@@ -24,6 +20,7 @@ Rake::TestTask.new(:unit) do |t|
|
|
24
20
|
t.verbose = false
|
25
21
|
end
|
26
22
|
|
23
|
+
|
27
24
|
Hoe.new('file_sandbox', FileSandbox::VERSION) do |p|
|
28
25
|
p.rubyforge_name = 'filesandbox'
|
29
26
|
p.summary = p.description = p.paragraphs_of('README.txt', 2).first
|
data/lib/file_sandbox.rb
CHANGED
@@ -3,7 +3,7 @@ require 'fileutils'
|
|
3
3
|
require 'test/unit/assertions'
|
4
4
|
|
5
5
|
module FileSandbox
|
6
|
-
VERSION = "0.
|
6
|
+
VERSION = "0.4"
|
7
7
|
|
8
8
|
attr_reader :sandbox
|
9
9
|
|
@@ -14,9 +14,7 @@ module FileSandbox
|
|
14
14
|
original_error = nil
|
15
15
|
|
16
16
|
begin
|
17
|
-
|
18
|
-
yield @sandbox
|
19
|
-
end
|
17
|
+
yield @sandbox
|
20
18
|
rescue => e
|
21
19
|
original_error = e
|
22
20
|
raise
|
@@ -36,10 +34,13 @@ module FileSandbox
|
|
36
34
|
|
37
35
|
def setup_sandbox(path = '__sandbox')
|
38
36
|
@sandbox = Sandbox.new(path)
|
37
|
+
@__old_path_for_sandbox = Dir.pwd
|
38
|
+
Dir.chdir(@sandbox.root)
|
39
39
|
end
|
40
40
|
|
41
41
|
def teardown_sandbox
|
42
42
|
if @sandbox
|
43
|
+
Dir.chdir(@__old_path_for_sandbox)
|
43
44
|
@sandbox.clean_up
|
44
45
|
@sandbox = nil
|
45
46
|
end
|
data/test/file_sandbox_test.rb
CHANGED
@@ -3,6 +3,14 @@ require File.expand_path(File.dirname(__FILE__) + '/../lib/file_sandbox')
|
|
3
3
|
|
4
4
|
class FileSandboxTest < Test::Unit::TestCase
|
5
5
|
include FileSandbox
|
6
|
+
|
7
|
+
def test_we_are_in_the_sandbox
|
8
|
+
dir = Dir.pwd
|
9
|
+
in_sandbox do |sandbox|
|
10
|
+
assert_equal sandbox.root, Dir.pwd
|
11
|
+
end
|
12
|
+
assert_equal dir, Dir.pwd
|
13
|
+
end
|
6
14
|
|
7
15
|
def test_sandbox_cleans_up_file
|
8
16
|
in_sandbox do |sandbox|
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
|
|
3
3
|
specification_version: 1
|
4
4
|
name: file_sandbox
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: "0.
|
7
|
-
date: 2007-
|
6
|
+
version: "0.4"
|
7
|
+
date: 2007-11-02 00:00:00 -07:00
|
8
8
|
summary: File sandbox creates a space for your tests to safely hit the file system. It also makes it easier for them to do so. By cleaning up after them.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -61,5 +61,5 @@ dependencies:
|
|
61
61
|
requirements:
|
62
62
|
- - ">="
|
63
63
|
- !ruby/object:Gem::Version
|
64
|
-
version: 1.
|
64
|
+
version: 1.3.0
|
65
65
|
version:
|