1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
# frozen_string_literal: true
# Figure out what's missing from fakefs
#
# USAGE
#
# $ ruby test/verify.rb | grep "not implemented"
require_relative 'test_helper'
# FakeFs verifier test class
class FakeFSVerifierTest < Minitest::Test
class_mapping = {
RealFile => FakeFS::File,
RealFile::Stat => FakeFS::File::Stat,
RealFileUtils => FakeFS::FileUtils,
RealDir => FakeFS::Dir,
RealFileTest => FakeFS::FileTest
}
class_mapping.each do |real_class, fake_class|
real_class.methods.each do |method|
define_method "test_#{method}_class_method" do
assert fake_class.respond_to?(method),
"#{fake_class}.#{method} not implemented"
end
end
real_class.instance_methods.each do |method|
define_method("test_#{method}_instance_method") do
assert fake_class.instance_methods.include?(method),
"#{fake_class}##{method} not implemented"
end
end
end
end
|