activate! & deactivate! state properly in tests (which allows easy replication of bug reported in #24)

This commit is contained in:
Scott Taylor 2009-12-02 03:13:46 -05:00
parent c2ccf482b9
commit 8355d15ec2
2 changed files with 9 additions and 0 deletions

View File

@ -4,9 +4,14 @@ class FakeFSTest < Test::Unit::TestCase
include FakeFS include FakeFS
def setup def setup
FakeFS.activate!
FileSystem.clear FileSystem.clear
end end
def teardown
FakeFS.deactivate!
end
def test_can_be_initialized_empty def test_can_be_initialized_empty
fs = FileSystem fs = FileSystem
assert_equal 0, fs.files.size assert_equal 0, fs.files.size

View File

@ -5,6 +5,10 @@ class FakeFSSafeTest < Test::Unit::TestCase
FakeFS.deactivate! FakeFS.deactivate!
end end
def teardown
FakeFS.activate!
end
def test_FakeFS_method_does_not_intrude_on_global_namespace def test_FakeFS_method_does_not_intrude_on_global_namespace
path = '/path/to/file.txt' path = '/path/to/file.txt'