/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
- require 'facets/module/wrap_method'
- require 'test/unit'
- class Test_Module_WrapMethod < Test::Unit::TestCase
- def a; "A"; end
- wrap_method(:a) { |old| old.call + "B" }
- def test_wrap_method
- assert_equal( "AB", a )
- end
- # wrap
- def b; "B"; end
- wrap(:b) { |old| old.call + "C" }
- def test_wrap
- assert_equal( "BC", b )
- end
- end