Sha256: fe5635dab2591d8ca3bd6a36d3788896b698c70da2890616ec165c541f8cf427

Contents?: true

Size: 745 Bytes

Versions: 4

Compression:

Stored size: 745 Bytes

Contents

require 'facets/module/alias.rb'
require 'test/unit'

class Test_Module_Alias < Test::Unit::TestCase

  module MockModule
    # for alias_module_method
    def x ; 33 ; end
    module_function :x
    alias_module_function :y, :x
  end

  def test_alias_module_function
    assert_equal( 33, MockModule.y )
    #assert_equal( 33, @m.send(:y) ) # use send b/c private
  end

  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
    #alias_method_chain :foo, :feature
  end


  def test_001
    y = Y.new
    assert_equal( "FOO!", y.foo )
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
facets-2.4.0 test/module/test_alias.rb
facets-2.4.1 test/module/test_alias.rb
facets-2.4.2 test/core/module/test_alias.rb
facets-2.4.3 test/core/module/test_alias.rb