/vendor/gems/facets-2.4.5/test/more/test_instantiable.rb
Ruby | 37 lines | 26 code | 11 blank | 0 comment | 0 complexity | f3007eec2149b8ee40941382e47c08f2 MD5 | raw file
Possible License(s): GPL-3.0, GPL-2.0, IPL-1.0, AGPL-1.0, LGPL-3.0
- require 'facets/instantiable.rb'
- require 'test/unit'
- class TestInstantiable < Test::Unit::TestCase
- module M
- extend Instantiable
- attr :a
- def initialize( a )
- @a = a
- end
- end
- module N
- include Instantiable
- attr :a
- def initialize( a )
- @a = a
- end
- end
- def test_m_new
- m = M.new( 1 )
- assert_equal( 1, m.a )
- end
- def test_n_new
- m = N.new( 1 )
- assert_equal( 1, m.a )
- end
- end