PageRenderTime 113ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

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

https://bitbucket.org/mediashelf/fedora-migrator
Ruby | 24 lines | 14 code | 9 blank | 1 comment | 0 complexity | 2931c4713fffa739f4f0f40bdeb05f85 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/wrap_method'
  2. require 'test/unit'
  3. class Test_Module_WrapMethod < Test::Unit::TestCase
  4. def a; "A"; end
  5. wrap_method(:a) { |old| old.call + "B" }
  6. def test_wrap_method
  7. assert_equal( "AB", a )
  8. end
  9. # wrap
  10. def b; "B"; end
  11. wrap(:b) { |old| old.call + "C" }
  12. def test_wrap
  13. assert_equal( "BC", b )
  14. end
  15. end