Sha256: 0c28359425526152923dfd247c1f2c12c4c0eaaa8104c0c13facfeded631b9a9

Contents?: true

Size: 647 Bytes

Versions: 9

Compression:

Stored size: 647 Bytes

Contents

require File.dirname(__FILE__) + "/../../spec_helper"

describe Walruz::Memoization do

  before(:each) do
    @foo = Foo.new 
  end

  it "should invoke the original method the first time" do
    @foo.highcost.should == "This is the first time"
  end

  it "should invoke the memoized result the second time" do
    @foo.highcost.should == "This is the first time"
    @foo.highcost.should == "This is the first time"
  end

  it "should invoke the method once memoized if and only if the reload parameter is given" do
    @foo.highcost.should == "This is the first time"
    @foo.highcost(:reload).should == "This is the second time"
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
walruz-0.0.16 spec/walruz/core_ext/memoization_spec.rb
walruz-0.0.15 spec/walruz/core_ext/memoization_spec.rb
walruz-0.0.14 spec/walruz/core_ext/memoization_spec.rb
walruz-0.0.13 spec/walruz/core_ext/memoization_spec.rb
walruz-0.0.12 spec/walruz/core_ext/memoization_spec.rb
walruz-0.0.11 spec/walruz/core_ext/memoization_spec.rb
walruz-0.0.10 spec/walruz/core_ext/memoization_spec.rb
walruz-0.0.9 spec/walruz/core_ext/memoization_spec.rb
walruz-0.0.8 spec/walruz/core_ext/memoization_spec.rb