Sha256: a8a16931dfcd905224c0c5f100f1fd611f45825201827fa149e75f1c98dcce5e

Contents?: true

Size: 636 Bytes

Versions: 4

Compression:

Stored size: 636 Bytes

Contents

covers 'facets/memoizable'

tests Memoizable do

  unit :memoize => "returns expected values" do
    c = Class.new do
      include Memoizable
      def initialize(a)
        @a = a
      end
      attr_accessor :a
      memoize :a
    end

    o = c.new("A")
    o.a.assert == "A"
    o.a = "B"
    o.a.assert == "A"
  end

  unit :memoize => "returns identical objects" do
    c = Class.new do
      include Memoizable
      def initialize(a)
        @a = a
      end
      attr_accessor :a
      memoize :a
    end

    o = c.new("A")
    o.a.__id__.assert == o.a.__id__
    o.a = "B"
    o.a.__id__.assert == o.a.__id__
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
facets-2.9.1 test/supplemental/test_memoizable.rb
facets-2.9.0 test/more/test_memoizable.rb
facets-2.9.0.pre.2 test/more/test_memoizable.rb
facets-2.9.0.pre.1 test/more/test_memoizable.rb