File: verify.rb

package info (click to toggle)
ruby-fakefs 0.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 288 kB
  • sloc: ruby: 2,782; makefile: 3
file content (31 lines) | stat: -rw-r--r-- 893 bytes parent folder | download | duplicates (2)
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
# Figure out what's missing from fakefs
#
# USAGE
#
#   $ RUBYLIB=test ruby test/verify.rb | grep "not implemented"

require "test_helper"

class FakeFSVerifierTest < Test::Unit::TestCase
  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