PageRenderTime 41ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

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

https://bitbucket.org/mediashelf/fedora-migrator
Ruby | 51 lines | 31 code | 18 blank | 2 comment | 0 complexity | 8d3cbbeff283e8ab6f5b2be7d8609c2c MD5 | raw file
Possible License(s): GPL-3.0, GPL-2.0, IPL-1.0, AGPL-1.0, LGPL-3.0
  1. require 'facets/module/revise.rb'
  2. require 'test/unit'
  3. class TestModuleModifyRevisal < Test::Unit::TestCase
  4. module M
  5. def x ; 1 ; end
  6. end
  7. class C
  8. include M.revisal {
  9. rename :y, :x
  10. }
  11. end
  12. def test_revisal
  13. c = C.new
  14. assert_raises( NoMethodError ) { c.x }
  15. assert_equal( 1, c.y )
  16. end
  17. end
  18. # nodef
  19. class Test_Module_NoDef < Test::Unit::TestCase
  20. def the_undefined_method ; 'not here' ; end
  21. nodef :the_undefined_method
  22. def test_nodef
  23. assert( ! respond_to?( :the_undefined_method ) )
  24. end
  25. end
  26. # remove method
  27. class Test_Module_Remove < Test::Unit::TestCase
  28. def the_removed_method ; 'not here' ; end
  29. remove :the_removed_method
  30. def test_remove
  31. assert( ! respond_to?( :the_removed_method ) )
  32. end
  33. end