From 8355d15ec2cbdf562c87407fe56fef781846de1e Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Wed, 2 Dec 2009 03:13:46 -0500 Subject: [PATCH] activate! & deactivate! state properly in tests (which allows easy replication of bug reported in #24) --- test/fakefs_test.rb | 5 +++++ test/safe_test.rb | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/test/fakefs_test.rb b/test/fakefs_test.rb index a0863a4..67ab301 100644 --- a/test/fakefs_test.rb +++ b/test/fakefs_test.rb @@ -4,9 +4,14 @@ class FakeFSTest < Test::Unit::TestCase include FakeFS def setup + FakeFS.activate! FileSystem.clear end + def teardown + FakeFS.deactivate! + end + def test_can_be_initialized_empty fs = FileSystem assert_equal 0, fs.files.size diff --git a/test/safe_test.rb b/test/safe_test.rb index 9db2de0..f16dc4e 100644 --- a/test/safe_test.rb +++ b/test/safe_test.rb @@ -5,6 +5,10 @@ class FakeFSSafeTest < Test::Unit::TestCase FakeFS.deactivate! end + def teardown + FakeFS.activate! + end + def test_FakeFS_method_does_not_intrude_on_global_namespace path = '/path/to/file.txt'