Cleanup trailing whitespace
This commit is contained in:
parent
d2264eb646
commit
2877f7d4c1
@ -37,11 +37,11 @@ Don't Fake the FS Immediately
|
||||
-----------------------------
|
||||
|
||||
require 'fakefs/safe'
|
||||
|
||||
|
||||
FakeFS.activate!
|
||||
# your code
|
||||
FakeFS.deactivate!
|
||||
|
||||
|
||||
# or
|
||||
FakeFS do
|
||||
# your code
|
||||
|
@ -24,7 +24,7 @@ module FakeFS
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
|
||||
def method_missing(*args, &block)
|
||||
entry.send(*args, &block)
|
||||
end
|
||||
|
@ -36,7 +36,7 @@ module FakeFS
|
||||
ln_s(target, path, { :force => true })
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
def cp(src, dest)
|
||||
dst_file = FileSystem.find(dest)
|
||||
|
@ -54,4 +54,4 @@ module FakeFS
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1 +1 @@
|
||||
--color
|
||||
--color
|
||||
|
@ -1,3 +1,3 @@
|
||||
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
||||
|
||||
require 'fakefs/spec_helpers'
|
||||
require 'fakefs/spec_helpers'
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user