Ensure that every method in IO and File (RealFile) is in FakeFS::File (since File < IO). raise NotImplemenetedErrors for methods which have not yet been implemented.

This commit is contained in:
Scott Taylor 2009-11-01 18:07:01 -05:00
parent 95b06b00df
commit daad2bb625
2 changed files with 66 additions and 0 deletions

View File

@ -229,6 +229,66 @@ module FakeFS
alias_method :tell=, :pos=
def ioctl(integer_cmd, arg)
raise NotImplementedError
end
def read_nonblock(maxlen, outbuf = nil)
raise NotImplementedError
end
def stat
raise NotImplementedError
end
def sysseek(offset, whence = SEEK_SET)
raise NotImplementedError
end
def to_i
raise NotImplementedError
end
def to_io
raise NotImplementedError
end
def write_nonblock(string)
raise NotImplementedError
end
def readpartial(maxlen, outbuf = nil)
raise NotImplementedError
end
def atime
raise NotImplementedError
end
def chmod(mode_int)
raise NotImplementedError
end
def chown(owner_int, group_int)
raise NotImplementedError
end
def ctime
raise NotImplementedError
end
def flock(locking_constant)
raise NotImplementedError
end
def lstat
raise NotImplementedError
end
def mtime
raise NotImplementedError
end
private
def check_modes!

View File

@ -487,6 +487,12 @@ class FakeFSTest < Test::Unit::TestCase
assert_equal 1, fp.pos
end
RealFile.instance_methods.each do |method_name|
define_method "test_should_have_method_#{method_name}_from_io_class" do
assert File.instance_methods.include?(method_name)
end
end
def test_chdir_changes_directories_like_a_boss
# I know memes!
FileUtils.mkdir_p '/path'