diff --git a/lib/fakefs/base.rb b/lib/fakefs/base.rb index cba54c9..e5d90fb 100644 --- a/lib/fakefs/base.rb +++ b/lib/fakefs/base.rb @@ -28,4 +28,12 @@ module FakeFS const_set(:FileUtils, RealFileUtils) end end -end \ No newline at end of file +end + +def FakeFS + return ::FakeFS unless block_given? + ::FakeFS.activate! + yield + ::FakeFS.deactivate! +end + diff --git a/lib/fakefs/safe.rb b/lib/fakefs/safe.rb index 61eebab..2413598 100644 --- a/lib/fakefs/safe.rb +++ b/lib/fakefs/safe.rb @@ -9,9 +9,3 @@ require 'fakefs/fileutils' require 'fakefs/file' require 'fakefs/dir' -def FakeFS - return ::FakeFS unless block_given? - ::FakeFS.activate! - yield - ::FakeFS.deactivate! -end