/vendor/gems/facets-2.4.5/test/core/module/test_prepend.rb

https://bitbucket.org/mediashelf/fedora-migrator · Ruby · 29 lines · 17 code · 8 blank · 4 comment · 0 complexity · 16421f3226dc15d102cd6ee701e8d559 MD5 · raw file

  1. require 'facets/module/prepend'
  2. require 'test/unit'
  3. class Test_Module_Prepend < Test::Unit::TestCase
  4. module M
  5. def q; "qm"; end
  6. end
  7. module N
  8. prepend M
  9. def q; "qn"; end
  10. end
  11. class X
  12. include N
  13. end
  14. def test_prepend_module_method
  15. assert_equal( "qm", N.q )
  16. end
  17. # Wish this worked.
  18. #def test_prepend_instance_method
  19. # assert_equal( "qm", X.new.q )
  20. #end
  21. end