diff --git a/README.markdown b/README.markdown index b64e457..f4fdfcd 100644 --- a/README.markdown +++ b/README.markdown @@ -37,11 +37,11 @@ Don't Fake the FS Immediately ----------------------------- require 'fakefs/safe' - + FakeFS.activate! # your code FakeFS.deactivate! - + # or FakeFS do # your code diff --git a/lib/fakefs/fake/symlink.rb b/lib/fakefs/fake/symlink.rb index 81d6c3c..5132542 100644 --- a/lib/fakefs/fake/symlink.rb +++ b/lib/fakefs/fake/symlink.rb @@ -24,7 +24,7 @@ module FakeFS end private - + def method_missing(*args, &block) entry.send(*args, &block) end diff --git a/lib/fakefs/fileutils.rb b/lib/fakefs/fileutils.rb index 6eb5c6f..bb61c07 100644 --- a/lib/fakefs/fileutils.rb +++ b/lib/fakefs/fileutils.rb @@ -36,7 +36,7 @@ module FakeFS ln_s(target, path, { :force => true }) end - + def cp(src, dest) dst_file = FileSystem.find(dest) diff --git a/spec/fakefs/spec_helpers_spec.rb b/spec/fakefs/spec_helpers_spec.rb index 8d73f03..8a6f801 100644 --- a/spec/fakefs/spec_helpers_spec.rb +++ b/spec/fakefs/spec_helpers_spec.rb @@ -54,4 +54,4 @@ module FakeFS end end end -end \ No newline at end of file +end diff --git a/spec/spec.opts b/spec/spec.opts index 5052887..4e1e0d2 100644 --- a/spec/spec.opts +++ b/spec/spec.opts @@ -1 +1 @@ ---color \ No newline at end of file +--color diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 6d83b80..d0c8905 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,3 @@ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib') -require 'fakefs/spec_helpers' \ No newline at end of file +require 'fakefs/spec_helpers' diff --git a/test/fake/file_test.rb b/test/fake/file_test.rb index dcd87af..4dc5930 100644 --- a/test/fake/file_test.rb +++ b/test/fake/file_test.rb @@ -7,7 +7,7 @@ class FakeFileTest < Test::Unit::TestCase def setup FileSystem.clear - + @file = FakeFile.new end @@ -43,9 +43,9 @@ class FakeFileTest < Test::Unit::TestCase def test_links_are_mutual other_file = FakeFile.new - + @file.link(other_file) - + assert_equal [@file, other_file], other_file.links end diff --git a/test/fakefs_test.rb b/test/fakefs_test.rb index 2d6babc..cb396d6 100644 --- a/test/fakefs_test.rb +++ b/test/fakefs_test.rb @@ -24,7 +24,7 @@ class FakeFSTest < Test::Unit::TestCase FileUtils.mkdir_p("/path/to/dir") assert_kind_of FakeDir, FileSystem.fs['path']['to']['dir'] end - + def test_can_create_directories_with_mkpath FileUtils.mkpath("/path/to/dir") assert_kind_of FakeDir, FileSystem.fs['path']['to']['dir'] @@ -74,14 +74,14 @@ class FakeFSTest < Test::Unit::TestCase FileUtils.ln_s(target, '/path/to/link') end end - + def test_can_force_creation_of_symlinks FileUtils.mkdir_p(target = "/path/to/first/target") FileUtils.ln_s(target, "/path/to/link") assert_kind_of FakeSymlink, FileSystem.fs['path']['to']['link'] FileUtils.ln_s(target, '/path/to/link', :force => true) end - + def test_create_symlink_using_ln_sf FileUtils.mkdir_p(target = "/path/to/first/target") FileUtils.ln_s(target, "/path/to/link") @@ -1126,38 +1126,38 @@ class FakeFSTest < Test::Unit::TestCase def test_tmpdir assert Dir.tmpdir == "/tmp" end - + def test_hard_link_creates_file FileUtils.touch("/foo") - + File.link("/foo", "/bar") assert File.exists?("/bar") end - + def test_hard_link_with_missing_file_raises_error assert_raises(Errno::ENOENT) do File.link("/foo", "/bar") end end - + def test_hard_link_with_existing_destination_file FileUtils.touch("/foo") FileUtils.touch("/bar") - + assert_raises(Errno::EEXIST) do File.link("/foo", "/bar") end end - + def test_hard_link_returns_0_when_successful FileUtils.touch("/foo") - + assert_equal 0, File.link("/foo", "/bar") end - + def test_hard_link_returns_duplicate_file File.open("/foo", "w") { |x| x << "some content" } - + File.link("/foo", "/bar") assert_equal "some content", File.read("/bar") end diff --git a/test/safe_test.rb b/test/safe_test.rb index d87c00f..4d9ace3 100644 --- a/test/safe_test.rb +++ b/test/safe_test.rb @@ -26,7 +26,7 @@ class FakeFSSafeTest < Test::Unit::TestCase assert_equal result, "Yatta!" end - + def test_FakeFS_method_deactivates_FakeFS_when_block_raises_exception begin FakeFS do @@ -34,9 +34,9 @@ class FakeFSSafeTest < Test::Unit::TestCase end rescue end - + assert_equal RealFile, File, "File is #{File} (should be #{RealFile})" - assert_equal RealFileUtils, FileUtils, "FileUtils is #{FileUtils} (should be #{RealFileUtils})" + assert_equal RealFileUtils, FileUtils, "FileUtils is #{FileUtils} (should be #{RealFileUtils})" assert_equal RealDir, Dir, "Dir is #{Dir} (should be #{RealDir})" - end + end end diff --git a/test/verify.rb b/test/verify.rb index 9fa1ff7..87f72fe 100644 --- a/test/verify.rb +++ b/test/verify.rb @@ -5,20 +5,20 @@ # $ ruby test/verify.rb | grep "not implemented" require 'fakefs' require 'test/unit' - + class FakeFSVerifierTest < Test::Unit::TestCase (RealFile.methods - Class.new.methods).each do |name| define_method("test #{name} class method") do assert File.respond_to?(name), "File.#{name} not implemented" end end - + (RealFile.instance_methods - Enumerable.instance_methods).each do |name| define_method("test #{name} instance method") do assert File.instance_methods.include?(name), "File##{name} not implemented" end end - + (RealFileUtils.methods - Class.new.methods).each do |name| define_method("test #{name} module method") do assert FileUtils.respond_to?(name), "FileUtils.#{name} not implemented"