/vendor/gems/facets-2.4.5/test/core/module/test_alias_method_chain.rb
Ruby | 30 lines | 24 code | 6 blank | 0 comment | 0 complexity | 2cbf33b47c1057a561807c186e8470f7 MD5 | raw file
Possible License(s): GPL-3.0, GPL-2.0, IPL-1.0, AGPL-1.0, LGPL-3.0
- require 'facets/module/alias_method_chain'
- require 'test/unit'
- class Test_Module_Alias_Method_Chain < Test::Unit::TestCase
- module X
- def self.included(base)
- base.module_eval {
- alias_method_chain :foo, :feature
- }
- end
- def foo_with_feature
- foo_without_feature + '!'
- end
- end
- class Y
- def foo
- "FOO"
- end
- include X
- end
- def test_alias_method_chian
- y = Y.new
- assert_equal( "FOO!", y.foo )
- end
- end