file_sandbox 0.3 → 0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGES.txt CHANGED
@@ -1,5 +1,9 @@
1
1
  = Change Log
2
2
 
3
+ == Version 0.4
4
+
5
+ * including FileSandbox in a test now makes sandbox root the cwd for that test
6
+
3
7
  == Version 0.3
4
8
 
5
9
  * Support for rspec 1.0
data/README.txt CHANGED
@@ -1,4 +1,4 @@
1
- = Project: File Sandbox v0.3
1
+ = Project: File Sandbox v0.4
2
2
 
3
3
  == Description
4
4
 
@@ -51,4 +51,4 @@ License:: LGPL License
51
51
 
52
52
  == Home Page
53
53
 
54
- http://onemanswalk.com
54
+ http://onemanswalk.com
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 => [:test, :generate_readme]
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.3"
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
- Dir.chdir(@sandbox.root) do
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
@@ -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.3"
7
- date: 2007-07-06 00:00:00 -07:00
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.2.1
64
+ version: 1.3.0
65
65
  version: