Sha256: ffac621a9623783bb0681f599edea5691d97c59b13171056c81547729988a91e

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

require "test_helper"

class ModuleSnapshotTest < Test::Unit::TestCase

  def test_detect_module_method_on_module
    for_all_method_visibilities do |visibility|
      mod = Module.new
      mod.metaclass.send(:define_method, :foo) {}
      mod.metaclass.send(visibility, :foo)
      assert_method_exists(mod, mod.metaclass, :foo, visibility)
    end
  end

  def test_detect_method_on_module_included_as_module_method_on_module
    for_all_method_visibilities do |visibility|
      supermod = Module.new
      supermod.send(:define_method, :foo) {}
      supermod.send(visibility, :foo)
      mod = Module.new do
        extend supermod
      end
      assert_method_exists(mod, supermod, :foo, visibility)
    end
  end

  def test_detect_method_on_module_included_into_module_included_as_module_method_on_module
    for_all_method_visibilities do |visibility|
      superdupermod = Module.new
      superdupermod.send(:define_method, :foo) {}
      superdupermod.send(visibility, :foo)
      supermod = Module.new do
        include superdupermod
      end
      mod = Module.new do
        extend supermod
      end
      assert_method_exists(mod, superdupermod, :foo, visibility)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
introspection-0.0.1 test/module_snapshot_test.rb