Sha256: 0580259e74c6db80f2d700249583a30756381b91089adee05660ae0e730f877d

Contents?: true

Size: 355 Bytes

Versions: 2

Compression:

Stored size: 355 Bytes

Contents

require 'helper'

$called = 0
class Foo
  extend LazyConst
  lazy_const :TEST do
    $called += 1
    42
  end
end


class TestLazyConst < MiniTest::Unit::TestCase
  def test_lazy_const
    called = 0
    assert_equal $called, 0
    assert_equal Foo.TEST, 42
    assert_equal $called, 1
    assert_equal Foo.TEST, 42
    assert_equal $called, 1
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lazy_const-0.1.2 test/test_lazy_const.rb
lazy_const-0.1.1 test/test_lazy_const.rb